Jump to content

my custom character die as invisible ghost


Recommended Posts

*Closed Topic* Thank you for Ryuushu

 

I tried to figure it out every way I know now but I have no clue. ;_;
I use "extended sample character-DST1.1.1" ghost template to make mine.

I try to fix like copy and replace anim.bin and build.bin from esctemplate to my mod and rename build.bin.
everything is fine, no crash but the ghost is invisible in game. please help me!!

 

post-275840-0-05190700-1420408714_thumb.

 

This is all files of my mod

https://drive.google.com/file/d/0B58QJDwa4vq3S1ZZTVU2dkp3cU0/view?usp=sharing

Thank you ;A;

*Closed Topic* Thank you for Ryuushu

Edited by Coffgirl
Link to comment
Share on other sites

@Coffgirl
 

inst:DoPeriodicTask(1/10, function()         if inst.components.hunger.current > 100 then        inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.5)        inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.5)        inst.AnimState:SetBuild("coffgirl")    elseif inst.components.hunger.current > 30 then        inst.components.locomotor.walkspeed = 4.5        inst.components.locomotor.runspeed = 5.5        inst.AnimState:SetBuild("coffgirl_hungry")    else	inst.components.locomotor.walkspeed = 3        inst.components.locomotor.runspeed = 4        inst.components.eater.ignoresspoilage = true        inst.components.eater.strongstomach = true        inst.AnimState:SetBuild("coffgirl_starving")    endend)

 
^^^
That part. You're running that function every .1 seconds, all the time, even when you're a ghost. So, when you are a ghost, it'll check for your hunger (ghosts don't update it) and say something like "Well, her hunger is 102. Let's make her faster and set her anim build to coffgirl"... which is pretty bad for the ghost since that build lacks all ghost anims, thus making her invisible.

 

You should first check if the player is a ghost, and if it is, immediately return. Also, you could change DoPeriodicTask for ListenForEvent("hungerdelta", -function goes here-). I think it's a bit more efficient, since the  function will only run when the character hunger changes.

 

.. So! You'd end up with something like this:

inst:ListenForEvent("hungerdelta", function(inst)        if inst:HasTag("playerghost") then return end -- If the player is a ghost then exit.                if inst.components.hunger.current > 100 then            inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.5)            inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.5)            inst.AnimState:SetBuild("coffgirl")        elseif inst.components.hunger.current > 30 then            inst.components.locomotor.walkspeed = 4.5            inst.components.locomotor.runspeed = 5.5            inst.AnimState:SetBuild("coffgirl_hungry")        else            inst.components.locomotor.walkspeed = 3            inst.components.locomotor.runspeed = 4            inst.components.eater.ignoresspoilage = true            inst.components.eater.strongstomach = true            inst.AnimState:SetBuild("coffgirl_starving")        endend)
Edited by Ryuushu
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...