Orim Posted June 12, 2015 Share Posted June 12, 2015 So I've been working on making structure prefabs for the last couple of days and it is all going fine. However, I have reached a point where I want to add fancy things to them and you guessed it, it's not working because I am way over my head. The structure prefab is attached to this message. The Modmain can also be provided if need be. Forgive the formating, I have not yet figured out how to make the fancy code boxes.First is adding a sanity aura to a structure. Looking at the nightmare light prefab, it says to add the following under local function fn() of the prefab file but it is not working. inst:AddComponent("sanityaura")inst.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE Second thing is making it do the super creepy deerclops growl upon being struck. I have not found any code within the game's prefabs that works nor any tutorial about sound beyond making a sound mod.Last but not least, I'd love for it to spawn spiders every time it gets hit but just like above, all my attempts have failed horribly. I have looked at pighouse, spiderqueen and pighouse but they all have a whole lot of code and I know that modifying and pruning them will most likely end in failure.This is probably a lot of work but I would be grateful for any help nightmare_scarecrow.zip Link to comment Share on other sites More sharing options...
Isosurface Posted June 12, 2015 Share Posted June 12, 2015 To play sound, add:inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/hurt") To spawn a spider:local x, y, z = inst.Transform:GetWorldPosition()SpawnPrefab("spider").Transform:SetPosition(x,y,z) Link to comment Share on other sites More sharing options...
Orim Posted June 12, 2015 Author Share Posted June 12, 2015 (edited) @Isosurface,Got sounds and spawn figured out, thanks to you! Both the sound and the spawn work perfectly. Oddly enough, I had tried the sound command you posted but it was not working. Could have been a pathing issue.Now I just have to figure out the sanity aura Toyed around with the MakeObstaclePhysics and changing the value made the sanityaura work. All good! Edited June 12, 2015 by Orim Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now