Jump to content

How to add frozen animation to custom prefabs?


Recommended Posts

I have some custom prefabs with their own animation file (the .scml file). Everything works OK, except when I try to freeze them. There is no "frozen ice" effect, only their colors are modified to light blue. I dig deeper into the code, and see this in stategraph: 

local function onenterthawpre(inst)
    if inst.components.locomotor ~= nil then
        inst.components.locomotor:StopMoving()
    end
    inst.AnimState:PlayAnimation("frozen_loop_pst", true)
    inst.SoundEmitter:PlaySound("dontstarve/common/freezethaw", "thawing")
    inst.AnimState:OverrideSymbol("swap_frozen", "frozen", "frozen")
end

However, I checked some ingame animation, there is no symbol swap_frozen. This is so magic... How can I get my custom prefab to have this frozen animation? Please help. 

Link to comment
Share on other sites

inst.AnimState:OverrideSymbol(z, x, y)

Z anim file Name that you are digging 

X override source folder (look up in SCML) 

Y override target folder

(xy or visa versa cant remember) 

This function is used to replace texture folder of inst (there are folders in SCML) of inst with texture folder from another file. 

Basically there is an invisible placeholder that you replace with some texture. 

Check how nightsword works. Adding ice to your creature is the same technic. 

Add swap frozen folder into SCML with some placeholder textures and place them in frozen anim. 

Edited by Desblat
  • Like 1
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...