LesSV Posted November 29, 2015 Share Posted November 29, 2015 (edited) Hey guys, I am currently working on a character mod and I ran into a problem regarding character tranformation and animation. So what I basically want is that my character transforms when certain circumstances are met with her getting a new look and new animations.I read nearly every thread related to that topic and followed this guide to add the animation. I made it work on my custom character and added the code to my modmain.lua. What I want now is that the idle animation just changes when the character transforms. I tried to make this work by just adding the code from the sample-animations-mod to the if-statement of my transformation code. But that doesn't seem to work. Can anyone help me on this one? I can't really figure out why it is not working. I don't get any errors but the character is still using the default animations. Here is the relevant code from my modmain.lua. I marked what I added for the animations.--Transformationlocal function IrisFn(inst)local player = GLOBAL.ThePlayerif inst:HasTag("playerghost") then return endif inst.transformed theninst.AnimState:SetBuild("zoey") inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt") local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("lightning") fx.Transform:SetPosition(x, y, z) SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 6inst.components.locomotor.runspeed = 8.5inst.components.health.absorb = 0.10inst.components.combat.damagemultiplier = 1inst.Transform:SetScale(1, 1, 1)inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)inst.soundsname = "willow"inst.components.talker:Say("Poiiiiiiiiiiiiiiii!", 2.5,true) elseinst.AnimState:SetBuild("irisheart") inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt") local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("lightning") fx.Transform:SetPosition(x, y, z) SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 7inst.components.locomotor.runspeed = 9.5inst.components.health.absorb = 0.80inst.components.combat.damagemultiplier = 1.5inst.Transform:SetScale(1, 1, 1)inst.components.hunger:SetRate(1)inst.soundsname = "iris"------------------------------------------------------------------------------- local new_idle_state = { name = "idle", tags = {"idle", "canrotate"}, onenter = function(inst, pushanim) inst.components.locomotor:Stop() inst.AnimState:PlayAnimation("spriter_idle", true) end, } AddStategraphState("wilson", GLOBAL.State(new_idle_state))---------------------------------------------------------------------------------inst.components.talker:Say("I have business to attend to.", 2.5,true) end inst.transformed = not inst.transformed-- inst.components.health:DoDelta(-20)return true end Edited November 29, 2015 by LesSV Link to comment https://forums.kleientertainment.com/forums/topic/59526-custom-animations-upon-transformation/ 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