Script to perform animation after a certain time?

Joshiro

Member
I need help making a script that will make an entity perform an animation after a certain amount of time. For example, I have an enemy that I want to make it use death animation after a certain amount of time has passed. I tried creating scripts but none work.
 
Are you only requesting script to kill enemy after some defined time has passed? I asked cause there's big difference between changing to certain animation and playing DEATH

Also changing animation directly after some defined time is kinda risky cause it is possible the entity is playing FALL animation when 'changing time' is on

So what is exactly you wanted to create?
 
lifespan will play death animation when it expires.

lifespan {value}

~Sets entity's lifespan after the entity is spawned. {value} is in seconds and it supports decimals.
~After {value} expires, entity will die and will play entity's death animation if the entity has it.
~Entity who uses this can die normally if {value} hasn't expired of course.
 
Bloodbane said:
Are you only requesting script to kill enemy after some defined time has passed? I asked cause there's big difference between changing to certain animation and playing DEATH

Also changing animation directly after some defined time is kinda risky cause it is possible the entity is playing FALL animation when 'changing time' is on

So what is exactly you wanted to create?

I wanted to kill the enemy after a certain period of time then play an animation. I'll just kill the entity then I'll spawn the death animation, if that is easier.

BeasTie said:
lifespan will play death animation when it expires.

lifespan {value}

~Sets entity's lifespan after the entity is spawned. {value} is in seconds and it supports decimals.
~After {value} expires, entity will die and will play entity's death animation if the entity has it.
~Entity who uses this can die normally if {value} hasn't expired of course.

Thanks. I'll give that a try.

 
I think it's best to do it in reverse: perform the animation first then kill the enemy.

Anyways, I have a script which can be modified for this purpose, let me look for it :)
 
Whoa, it's been almost a month since my last post

Anyways, I finally found and modified the script for this purpose. Here it is:
anim spawn
@script
    if(frame==7){
      void self = getlocalvar("self");
      setentityvar(self, 1, openborvariant("elapsed_time"));
    }
@end_script
(SPAWN animation here)

anim idle
@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);

    if(Summon <= openborvariant("elapsed_time") - 6000){
      setentityvar(self, 1, NULL());
      performattack(self,openborconstant("ANI_FOLLOW2"));
    }
@end_script
(IDLE animation here)

anim walk
@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);

    if(Summon <= openborvariant("elapsed_time") - 6000){
      setentityvar(self, 1, NULL());
      changeentityproperty(self, "velocity", 0, 0, 0);
      performattack(self,openborconstant("ANI_FOLLOW2"));
    }
@end_script
(WALK animation here)

It works like this, when entity is spawn, it will play SPAWN animation in which timer is set. Later in entity's IDLE and WALK animation, timer is checked periodically. When timer hit the limit, 30 seconds in this example, entity will perform FOLLOW2 animation

You can have anything for FOLLOW2 animation such as perform something then dies or just taunting ;)
 
Back
Top Bottom