Jump to content

Recommended Posts

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

@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()	endend

Remember to change the variables you need to accordingly.

 

@Blueberrys

Thanks 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.lua

tuning_wred.lua

log.txt

@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 = 10
local transform_moisture_threshold = TUNING.YOUR_CHARACTER.TRANSFORM_MOISTURE_THRESHOLD

 

@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 = 10
local 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.lua

tuning_wred.lua

log.txt

@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))    endend

Get rid of one of them.

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...