Several spawn animations

mtrain

New member
Is there a way to spawn the enemy with animation i want? For example: enemy have several spawn animations like spawn, spawn1, spawn2... and to load him i need something like next:

spawn Galsia
map 1
@cmd spawnani "spawn3"
coords 680 464
at 50
 
script when spawning from another entity?
Not to tricky....

What you need todo is run a script that loops through all entities.

You can see an example in mixMasters , search for void healallenemy(void healamount, void vName, float fX, float fY, float fZ)

You can do things like, search for a type (enemy, player, name etc) and find entity you want.
 
I use health as variable, i just give enemy different health and in spawn anim i have script, if health is 10 then it goes to follow1 animation, this way i dont have to us script in levels, i just give enemies different health value and this script goes to spawn anim :
@script
                void self = getlocalvar("self");
          int HP = getentityproperty(self,"health");
if ( HP == 10 ){
  changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
@end_script
Or use
performattack(self, openborconstant("ANI_FOLLOW1"));  }
 
I use entity variable to control enemy's SPAWN animation. However, I'm going to try changing animation directly.

@mtrain:Here's how to do it:

spawn Galsia
@script
void main()
{
    void self = getlocalvar("self");
    changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
@end_script
map 1
coords  680 464
at  50

Galsia will change to FOLLOW1 instead of his default SPAWN animation.

Is there a way to use performattack script when spawning from another entity? Like a door entity for example.

There is a way but you need a real special spawn function for this.

Oh if you want to spawn enemy walking out of door, you shouldn't use such function. You simply need to spawn door opening animation and enemy walking out of door at same time.
Doing this is more efficient, since you can have more enemies walking out of door.
 
Bloodbane said:
Oh if you want to spawn enemy walking out of door, you shouldn't use such function. You simply need to spawn door opening animation and enemy walking out of door at same time.
Doing this is more efficient, since you can have more enemies walking out of door.

That's how I used to do it in old BOR and still do for some doors that open automatically.  But now most doors I use are entities that player can open manually, enemies are spawned with script when needed.  But I have to use additional ents for door spawns, also enemies have a different spawn anim for when they are summoned by another enemy too.
 
Thank you! Can it be applied to players?

Hmmm.... never tried that before but I believe that's possible.
spawn  empty
@script
void main()
{
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

    if(P1){
      changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW1"));
    }
    if(P2){
      changeentityproperty(P2, "animation", openborconstant("ANI_FOLLOW1"));
    }
}
@end_script

Unlike enemy, this script is declared in a blank entity.
This script checks if each player is available and change animation to FOLLOW1 if he/she is.

This script only affects players which are available when this blank entity is spawned however.

@ned: That's the beauty of using spawn script! it makes enemy making more efficient. Remember Golden Axe series? enemies in higher levels usually just clone of ones met in early levels but they have higher damage and different remap. With this spawn script, setting higher offense is straight forward and we don't need to make clones of same enemy :)

Credits to utunnels :D (I missed that beer smiley)
 
Back
Top Bottom