Delay Script to spawn Bosses

dantedevil

Well-known member
I'm trying to create a modified version to spawn a Boss after certain time.
First spawn a entity with idle animation of the boss, then spawn the boss and kill the spawner.

That the idea, but not work.



Code:
ame       balrog_0
health       100
type       enemy
shadow     0
nomove     1

animationscript data/scripts/escript.c 

anim idle
@script
    void self = getlocalvar("self");
    int  Health = getentityproperty(self, "health");

    if(frame==1){
      changeentityproperty(self, "health", Health-5);
      if (Health <= 0){
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
   loop   1
   delay   49
   offset   82 177
   frame   data/chars/balrog/spawn1.png
   delay   1
   frame   data/chars/balrog/spawn1.png


anim follow1
	loop	0
   delay   1
   offset	82 177
   @cmd    spawn01 "balrog" 0 0 1
   frame   data/chars/balrog/spawn1.png
   @cmd    killentity getlocalvar("self")
   frame   data/chars/balrog/spawn1.png     
 
Thanks Maggas, I do not want to use the standard method, I would like to experiment with the script to create new animations on the heads and not limit myself to create an animation spawn too long.
My script is based in the Bloodbane script of the link you post.
 
Not sure what effect your making either.  A boss introduction ?

I think maggas meant you should make one entity and just control what anim it plays when you spawn it in the stage.

Like in your stage you would have something like.

Code:
spawn  Balrog
@script void main() {
   performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW10"));
} @end_script
coords  480 470 0
at      1010

This will spawn Balrog and force him to play FOLLOW10 animation

Also FOLLOW10 in Balrog could also be be a looped animation with range check.  When player gets in range he will switch animation.

For this use attack1 script
THREAD LINK - http://www.chronocrash.com/forum/index.php?topic=621.0


USAGE:
Code:
@cmd   attack1 240 2000 100 "ANI_FOLLOW1"

Code:
void attack1(int RxMin, int RxMax, int Rz, void Ani)
{// Attack interruption with range check
    void self = getlocalvar("self");
    void target = findtarget(self); //Get nearest player
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");
    int dir = getentityproperty(self, "direction");

    if(target!=NULL()){
      float Tx = getentityproperty(target, "x");
      float Tz = getentityproperty(target, "z");
      float Disx = Tx - x;
      float Disz = Tz - z;

      if(Disz < 0){
        Disz = -Disz;
      }

      if( Disx >= RxMin && Disx <= RxMax && Disz <= Rz && dir == 1) // Target within range on right facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      } else if( Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz && dir == 0) // Target within range on left facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      }
    }
}





 
Back
Top Bottom