DarkCrafter Posted January 13, 2015 Author Share Posted January 13, 2015 You are missing something: inst:AddComponent("hauntable") inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ) inst.components.hauntable:SetOnHauntFn(onhaunt)And you may want to replace 0.8 with 0.2 or it will break often.inst.components.hauntable:SetOnHauntFn(onhaunt) made the resurrect part not work. :\ Link to comment Share on other sites More sharing options...
DarkXero Posted January 14, 2015 Share Posted January 14, 2015 local function onhaunt(inst) inst.components.resurrector.active = true inst.SoundEmitter:PlaySound("dontstarve/common/resurrectionstone_activate") if math.random() <= 0.8 then inst:Remove() end return trueend Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 14, 2015 Author Share Posted January 14, 2015 Thanks for the help so far. That worked perfectly. Now all i ask is how do i make my character not get attacked by terrorbreaks (unless attacked) and immune to charley? Link to comment Share on other sites More sharing options...
rezecib Posted January 14, 2015 Share Posted January 14, 2015 immune to charley? inst:RemoveComponent("grue") Link to comment Share on other sites More sharing options...
DarkXero Posted January 14, 2015 Share Posted January 14, 2015 (edited) After trying, I don't think what you want to get with shadows is doable, since the only way you can hit them is when they are pissed at something, like you or other players. If they ignore me and they don't have targets, then I can't target them. I tried removing the grue component but strangely it didn't work, so you can also try:AddComponentPostInit("grue", function(Grue) local old = Grue.SetSleeping function Grue:SetSleeping(asleep) old(self, asleep) if self.inst.prefab == "MyCharacter" then self.sleeping = true end endend)in modmain.lua andinst.components.grue:SetSleeping(false)in your character prefab. EDIT: Toying around, I got something that you may like.Add this to modmain.lua:AddPrefabPostInit("crawlinghorror", function(inst) inst.hitbyfriend = false inst.warnings = 0end)AddPrefabPostInit("terrorbeak", function(inst) inst.hitbyfriend = false inst.warnings = 0end)AddStategraphPostInit("shadowcreature", function(sg) sg.events.attacked.fn = function(inst) if not inst.components.health:IsDead() and not inst.sg:HasStateTag("attack") then if inst.components.combat.target:HasTag("shadowfriend") then inst.hitbyfriend = true end inst.sg:GoToState("hit") end end sg.events.doattack.fn = function(inst, data) if not inst.components.health:IsDead() and not inst.sg:HasStateTag("busy") then local check = inst.components.combat.target:HasTag("shadowfriend") if (inst.hitbyfriend and check) or not check then inst.sg:GoToState("attack", data.target) else if inst.warnings < 3 then inst.warnings = inst.warnings + 1 inst.sg:GoToState("taunt") else inst.warnings = 0 inst.sg:GoToState("hit") end end end endend)And this to your character prefab:inst:AddTag("shadowfriend")Shadows will go to yell at you and get aggressive when you hit them. Edited January 14, 2015 by DarkXero Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 14, 2015 Author Share Posted January 14, 2015 For some reason, no matter what i do, I cant remove charlie. The other shadow code worked tho! Link to comment Share on other sites More sharing options...
DarkXero Posted January 14, 2015 Share Posted January 14, 2015 Use the code I gave you and where it saysif self.inst.prefab == "MyCharacter" thenreplace MyCharacter for the name of your character prefab. And it will work. Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 14, 2015 Author Share Posted January 14, 2015 That didnt work... Link to comment Share on other sites More sharing options...
DarkXero Posted January 14, 2015 Share Posted January 14, 2015 AddComponentPostInit("grue", function(Grue) local old = Grue.SetSleeping function Grue:SetSleeping(asleep) old(self, asleep) if self.inst.prefab == "wilson" then self.sleeping = true end endend)AddPlayerPostInit(function(player) if player.prefab == "wilson" then player.components.grue:SetSleeping(false) endend)Put this in modmain.lua and rename "wilson" into whatever your character prefab is.You have a custom character, right? Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 15, 2015 Author Share Posted January 15, 2015 AddComponentPostInit("grue", function(Grue) local old = Grue.SetSleeping function Grue:SetSleeping(asleep) old(self, asleep) if self.inst.prefab == "wilson" then self.sleeping = true end endend)AddPlayerPostInit(function(player) if player.prefab == "wilson" then player.components.grue:SetSleeping(false) endend)Put this in modmain.lua and rename "wilson" into whatever your character prefab is.You have a custom character, right? yes Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 15, 2015 Author Share Posted January 15, 2015 It works Link to comment Share on other sites More sharing options...
DarkCrafter Posted January 15, 2015 Author Share Posted January 15, 2015 Ok everything worked. Sorry for asking so many questions. How do i make my character eat only meat and benefit from eating monstermeat? Link to comment Share on other sites More sharing options...
DarkXero Posted January 15, 2015 Share Posted January 15, 2015 Try subscribing to the RoG characters mod and see how they do it. 1 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