Damaged state for entities and damaged pain animation

Mr.Q!

Well-known member
I have this pillar entity that after receiving damage it turns into a damaged version of itself, it changes from its normal idle animation into a desired follow animation after some % of damage. Thing is, despite working well, whenever I hit it, it changes into his "no damaged" pain animation, and it looks wrong of course, because it has already received some damage.

Is there any way in this .txt to tell the engine to use a desired anim follow instead the normal anim pain? Like, if it's using its anim follow2, it should use anim follow7 as anim pain, etc.

You can take a look at the attached image for reference.


Code:
anim spawn
     loop      0
     delay     1
     offset    40 144
     bbox      0
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
sound    data/sounds/fallbr3.wav
@cmd landFrame
@cmd spawn001 "gslam1" "gslam1" 0 0 0 0 0
@cmd spawn001 "fslam1" "fslam1" 0 0 0 0 0
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif


anim idle
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.7*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif

anim follow1
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.4*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar2.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar2.gif

anim follow2
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.2*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar3.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar3.gif

anim follow3
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar4.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar4.gif

anim pain
     loop      0
     delay     2
     offset    39 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
sound    data/sounds/debris1.wav
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    40 144
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    39 144
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    40 141
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
 

Attachments

  • Untitled-1.png
    Untitled-1.png
    37.6 KB · Views: 1
Last edited:
I have this pillar entity that after receiving damage it turns into a damaged version of itself, it changes from its normal idle animation into a desired follow animation after some % of damage. Thing is, despite working well, whenever I hit it, it changes into his "no damaged" pain animation, and it looks wrong of course, because it has already received some damage.

Is there any way in this .txt to tell the engine to use a desired anim follow instead the normal anim pain? Like, if it's using its anim follow2, it should use anim follow7 as anim pain, etc.

You can take a look at the attached image for reference.


Code:
anim spawn
     loop      0
     delay     1
     offset    40 144
     bbox      0
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
sound    data/sounds/fallbr3.wav
@cmd landFrame
@cmd spawn001 "gslam1" "gslam1" 0 0 0 0 0
@cmd spawn001 "fslam1" "fslam1" 0 0 0 0 0
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif


anim idle
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.7*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif

anim follow1
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.4*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar2.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar2.gif

anim follow2
@script
 void self = getlocalvar("self");
 int hp = getentityproperty(self, "health");
 int maxhp = getentityproperty(self, "maxhealth");
 if(hp <= 0.2*maxhp){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
 }
@end_script
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar3.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar3.gif

anim follow3
     loop      0
     delay     1
     offset    40 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
     frame     Data/bgs/bonus/ffury2/ff2pilar4.gif
     frame     Data/bgs/bonus/ffury2/ff2pilar4.gif

anim pain
     loop      0
     delay     2
     offset    39 144
     bbox      15 23 50 123
platform 13 149 -10 -10 64 64 10 150
sound    data/sounds/debris1.wav
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    40 144
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    39 144
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif
     offset    40 141
     frame     Data/bgs/bonus/ffury2/ff2pilar1.gif


There's a couple of techniques you could use.

Just for simplicity, I would simply reverse it. Instead of scripting the damaged animation on hit, make the damaged version the default state, and script the undamaged animation on spawn. Then all you have to do is let it go back to normal once hit. That way you're not fighting anything once it starts taking damage.

DC
 
Hmm can you provide an example? Because the thing I would want is to trigger a different animation instead of the normal pain animation, it should reflect the current damage that it has taken.

For example, if it's 100% healt, it should display its normal anim pain, but if it's at 70%health and changes into anim follow1, it should display for example, anim follow10 of it takes damage...Most sure thing I am not understanding your answer :dunce:
 
Hmm can you provide an example? Because the thing I would want is to trigger a different animation instead of the normal pain animation, it should reflect the current damage that it has taken.

For example, if it's 100% healt, it should display its normal anim pain, but if it's at 70%health and changes into anim follow1, it should display for example, anim follow10 of it takes damage...Most sure thing I am not understanding your answer :dunce:

That's a bit different. I thought you wanted normal -> damaged -> Destroyed. If you want different levels of damage it's just a little more complex. Certainly doable, but I'm turning in for the night. I'll try to write a in depth if no one beats me to it tomorrow.

DC
 
Back
Top Bottom