Eir Posted January 15, 2015 Share Posted January 15, 2015 I am working on a character mod based on the Little Red Riding Hood. I want her to transform to a certain monster form when she reaches a certain wetness level/threshold during a rainstorm. However, I have no idea where to start. Any help would be much appreciated. I have attached my character lua, if you would like to look.wred.lua Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/ Share on other sites More sharing options...
Blueberrys Posted January 16, 2015 Share Posted January 16, 2015 @Eir, You can try adding it at the end of moisture's OnUpdate function. (in character's create fn)local transform_moisture_threshold -- can be retrieved from TUNINGinst.old_moisture_OnUpdate = inst.components.moisture.OnUpdateinst.components.moisture.OnUpdate = function(dt) inst:old_moisture_OnUpdate(dt) local moisture = inst.components.moisture:GetMoisture() if moisture >= transform_moisture_threshold then your_character_transform_fn() endendRemember to change the variables you need to accordingly. Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/#findComment-602410 Share on other sites More sharing options...
Eir Posted January 16, 2015 Author Share Posted January 16, 2015 @BlueberrysThanks for answering! I tried to follow your instructions, but my screen froze after I updated my mods list ingame. Please check the attached to see if I have may have made a mistake in following your instructions. I have provided my lua file, log/troubleshooting file, and my tuning file. wred.luatuning_wred.lualog.txt Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/#findComment-602446 Share on other sites More sharing options...
Blueberrys Posted January 16, 2015 Share Posted January 16, 2015 @Eir, you have an extra "end" on line 52. Remove it and try again. Also.. you'll actually have to set the transform_moisture_threshold variable for it to work.TUNING.YOUR_CHARACTER.TRANSFORM_MOISTURE_THRESHOLD = 10local transform_moisture_threshold = TUNING.YOUR_CHARACTER.TRANSFORM_MOISTURE_THRESHOLD Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/#findComment-602454 Share on other sites More sharing options...
Eir Posted January 16, 2015 Author Share Posted January 16, 2015 @Eir, you have an extra "end" on line 52. Remove it and try again. Also.. you'll actually have to set the transform_moisture_threshold variable for it to work.TUNING.YOUR_CHARACTER.TRANSFORM_MOISTURE_THRESHOLD = 10local transform_moisture_threshold = TUNING.YOUR_CHARACTER.TRANSFORM_MOISTURE_THRESHOLD I thought I wouldn't need to set the transform_moisture_threshold variable in my character LUA file if I included in my character tuning LUA file. But I did try to include it in my LUA (and in my tuning file) and follow your instructions, and I got the same freezing result. Is this happening because I didn't set a detransformation/turn normal scenario? Sorry to burden you, but would you be check the attached if I made a mistake in my coding again? wred.luatuning_wred.lualog.txt Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/#findComment-602779 Share on other sites More sharing options...
Blueberrys Posted January 17, 2015 Share Posted January 17, 2015 @Eir, the transform_moisture_threshold is a local variable, you can't define it outside of the file. But you can get the information to put into it from outside the file, using the global TUNING variable, as I showed above. (transform_moisture_threshold = TUNING...) You did not correct the error I pointed out last time. Line 52 (now line 57) contains an extra "end". Remove it. Two "end"s for one function in there (line 47 - 57)local function TurnMonster(inst) inst.AnimState:SetBuild("wredmonster") inst.SoundEmitter:PlaySound("dontstarve/wilson/death") inst.SoundEmitter:PlaySound("dontstarve/characters/willow/death_voice") inst.AnimState:PlayAnimation("amulet_rebirth") inst.SoundEmitter:PlaySound("dontstarve/common/rebirth_amulet_raise") TheCamera:SetDistance(14) inst.components.sanity:DoDelta(TUNING.WRED_MONSTER_SANITYPENALTY) inst.components.talker:Say(SayRandom(TUNING.WRED_TURNMONSTER)) endendGet rid of one of them. Link to comment https://forums.kleientertainment.com/forums/topic/49198-transform-when-reach-a-wetness-threshold/#findComment-602791 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