Scupake Posted May 4, 2019 Share Posted May 4, 2019 This is my second mod the first one was just testing and I want this new one to be he character that I mainly play on here's what I want this character to be A very weak character during the day but he changes forms during the night to a shadow creature like thing wich is very strong Link to comment https://forums.kleientertainment.com/forums/topic/105691-how-to-make-a-character-change-his-form-during-the-night-in-singleplayer-dont-starve/ Share on other sites More sharing options...
Ultroman Posted May 4, 2019 Share Posted May 4, 2019 (edited) You can combine the code from these two topics: Listen to phase change events. Change animation build at runtime. For the last one, only the two first functions are interesting to you, SetNormalKin and SetNightmareKin. Edited May 4, 2019 by Ultroman Link to comment https://forums.kleientertainment.com/forums/topic/105691-how-to-make-a-character-change-his-form-during-the-night-in-singleplayer-dont-starve/#findComment-1189218 Share on other sites More sharing options...
Scupake Posted May 5, 2019 Author Share Posted May 5, 2019 (edited) 16 hours ago, Ultroman said: You can combine the code from these two topics: Listen to phase change events. Change animation build at runtime. For the last one, only the two first functions are interesting to you, SetNormalKin and SetNightmareKin. I screwed up domething here's what I added and it didn't work local myDayFunction = function() local function SetNormalKin(inst) inst:RemoveTag("nightmare") inst.components.combat.damagemultiplier = 1 inst.components.locomotor.walkspeed = 5 end end local myNightFunction = function() local function SetNightmareKin(inst) inst:AddTag("nightmare") inst.components.combat.damagemultiplier = 5 inst.components.locomotor.walkspeed = 9 end end inst:ListenForEvent( "daytime", myDayFunction(), GetWorld()) inst:ListenForEvent( "nighttime", myNightFunction(), GetWorld()) Edited May 5, 2019 by Scupake Link to comment https://forums.kleientertainment.com/forums/topic/105691-how-to-make-a-character-change-his-form-during-the-night-in-singleplayer-dont-starve/#findComment-1189405 Share on other sites More sharing options...
Ultroman Posted May 5, 2019 Share Posted May 5, 2019 (edited) Several things: You should just use the functions as they are. No need to make new ones. You're essentially just hooking up a couple of functions, each of which declares a local function which is not called or hooked up to anything. The functions you made do not have the parameters passed by the events you're listening to, in this case there is only one parameter: inst, the instance of the entity listening for the event, in this case your character. When you pass an existing function to an event hook-up (like ListenForEvent), you should not include the parentheses. You only do that if you write a full in-line function. local function SetNormal(inst) -- Do whatever is needed to be in the normal state. -- You at least need to change the animation build, if your character needs to look different. inst.AnimState:SetBuild("normal") end local function SetShadowCreature(inst) -- Do whatever is needed to be in the shadow creature state. -- You at least need to change the animation build, if your character needs to look different. inst.AnimState:SetBuild("shadowcreature") end inst:ListenForEvent( "daytime", SetNormal, GetWorld()) inst:ListenForEvent( "nighttime", SetShadowCreature, GetWorld()) Edited May 6, 2019 by Ultroman Link to comment https://forums.kleientertainment.com/forums/topic/105691-how-to-make-a-character-change-his-form-during-the-night-in-singleplayer-dont-starve/#findComment-1189412 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