Solved Making an obstacle slowdown during "anim fall" then stop

Question that is answered or resolved.

NED

Well-known member
For some chair obstacle.
I have this problem in mind for some time now.

When the obstacle is hit, it slide out of screen (just like usual barels)

But I would like it to slide when it's "alive", then slowdown, then stop moving to go back to idle animation.
and only when it's "dead" (hit many times), it should break.

any suggestion?
thanks

The actual code

Code:
name    chaira
type    obstacle
subtype    flydie
cantgrab 1
shadow  0
gfxshadow  1
health  1#30#20
diesound  data/sounds/drumb.wav#drum.wav
nolife  1
#flash   obfla
noatflash 1
offscreenkill  2000


anim idle
    loop    0
    delay    5
    offset    31 72#26 73#38 52#58#52
    bbox    7 16 50 65 #2 1 75 57
      platform   15 80 0 -7 48 56 7 32#13 58 0 0 52 52 13 49#10 52

    frame    data/chars/misc/chaira.gif
    
anim fall
    loop    1#0
    delay    9999#5#10#5
    offset    31 72#26 73#38 52#58#52
    sound    data/sounds/chairslide.wav
    hitfx   data/sounds/indirect.wav
    bbox    7 16 50 65 #2 1 75 57
      platform   15 80 0 -7 48 56 7 32#13 58 0 0 52 52 13 49#10 52
    attack    27 61 12 18 5 1 1 0 6 30#20#assez fin et bas
        frame    data/chars/misc/chaira.gif
 
Why not give it a lot of life like 9000 but each time just before it returns to idle use damageentity to hit it by 1000 that way after 9 falls it will break.

Oh and dasher to make it slide and setidle to return it to idle or have a short risetime.
 
  • Like
Reactions: NED
@machok @msmalik681 So. for the dasher part,
I should put it in the pain/fall anim ?
I understand what it will make ingame, but not what happens in code part.

My guess
Something like : idle -> pain anim (with a dasher inside) + a setidle -> idle
(am I right here ?)

Also, I suppose, I should get rid of "subtype flydie"

BTW, never heard of "setidle" I checked the manual, seems like a new command (I'm a bit outdated I think)
 
@machok @msmalik681 So. for the dasher part,
I should put it in the pain/fall anim ?
I understand what it will make ingame, but not what happens in code part.
I am not sure if obstacle type can do many variation anim like pain etc since I only use obstacle type just for idle and fall when it dies
you can use Npc type or enemy type if you want more "complete" anim
just don't forget to add feature like nomove and stealth on header if you use npc/enemy type
or
if you still want to use obstacle type, I usually use facingpain script

My guess
Something like : idle -> pain anim (with a dasher inside) + a setidle -> idle
(am I right here ?)

Also, I suppose, I should get rid of "subtype flydie"

BTW, never heard of "setidle" I checked the manual, seems like a new command (I'm a bit outdated I think)
for setidle, maybe add something like this:

Code:
anim    follow1
    loop    0
    delay    5
    offset    100 68
    bbox    75 15 74 59
    hitfx    data/sounds/kni1.wav
    frame    data/chars/misc/bonus/c3.gif
    offset    99 67
    frame    data/chars/misc/bonus/c3.gif
    offset    98 66
    frame    data/chars/misc/bonus/c3.gif
    offset    98 68
    frame    data/chars/misc/bonus/c3.gif
    offset    99 67
    frame    data/chars/misc/bonus/c3.gif
    offset    100 68
    @cmd    setidle getlocalvar("self") openborconstant("ANI_IDLE") 1
    frame    data/chars/misc/bonus/c3.gif
 
  • Like
Reactions: NED
Dasher is a animation script used in many games you will find it in the manual under the entity property under "velocity" and like I said if your chair is in a fall animation it will return to idle on rise or you can force it using "setidle" script command.

example dasher animation script.
C-like:
void dasher( float Vx, float Vy, float Vz )
{// Dash with desired speed!
void self = getlocalvar("self");
    changeentityproperty(self, "velocity", getentityproperty(self,"direction") == 0 ? -Vx:Vx, Vz, Vy); //Move!
}
 
  • Like
Reactions: NED
Back
Top Bottom