anim victory also for npcs

I have two questions:
1) Why Kassar starts the animation from the first frame if there is written " if(frame >= 2)" ?
2) Why there is loop 1 2 4 instead of loop 0 ?

1) Kassar or any entity will start animation from first frame naturally. And that has nothing to do with the script.
2) Ilu has given the first half of the answer, the second half of the answer is : Kassar need to perform first and second frame to show his victory animation. The remaining frames are looped and played to wait for victory state to be ended. Ending the animation is the purpose of the script.
 
1) Kassar or any entity will start animation from first frame naturally. And that has nothing to do with the script.
2) Ilu has given the first half of the answer, the second half of the answer is : Kassar need to perform first and second frame to show his victory animation. The remaining frames are looped and played to wait for victory state to be ended. Ending the animation is the purpose of the script.
Thank you.
 
@Bloodbane Hi, in my new game there is a level where the boss when dies transforms into another entity. I would like the victory animation to trigger when this latter entity dies. Is it possible?
 
It is doable but you need to move BossDed spawn from item drop to the transformed boss's DEATH animation.

Hmmm.... there is a way without moving that but might need extra script work.
 
C:
I found the solution: 
in models.txt I have put load (not know) : load    BossDed        data/chars/misc/BossDed.txt

in level.txt: spawn    name of first boss
                   coords ....
                   at .....

in firstboss.txt: 
falldie 2
load    name of second boss
nodieblink  2

anim death 
    custentity name of second boss
    spawnframe 0 0 0 0 0
    delay    8
    offset    98 126
    attack 0 0 0 0 0 0 
    frame    data/chars/enemies/bosses/firstboss/rise1.gif

in secondboss.txt: 
nodieblink 3
falldie 2

anim    spawn 
    @script
    if(frame == 2){
      // Genera entità senza alterare il nome originale
      //void Spawn = spawn01("2ndboss", 0, 0, 0);  //name of second boss
      void self = getlocalvar("self");
      
      // Conta le mappe disponibili per l'entità
      int maps = getentityproperty(self, "mapcount"); //self al posto di Spawn
      
      // Se l'entità ha più di una palette, ne sceglie una a caso
      if(maps > 1){
        int Mt = rand() % maps;   
        if(Mt < 0){ Mt = Mt * -1; }
        changeentityproperty(self, "map", Mt); //self al posto di Spawn 
      }
    }
@end_script
    loop 0
    #ultimo frame anim death 1st boss
    delay    8
    offset    98 126
    attack 0 0 0 0 0 0 
    frame    data/chars/enemies/bosses/1stboss/rise1.gif
    offset 1 1
    delay 100 
    frame   data/chars/misc/empty.gif 
    #anim rise 2ndboss
    delay    250 #8
    offset    89 121
    #@cmd changeentityproperty getlocalvar("self") "map" 1
    frame    data/chars/enemies/bosses/secondboss/fall2.gif
    delay    8
    offset    112 130
    frame    data/chars/enemies/bosses/secondboss/rise.gif
              
anim    fall
@script
void self = getlocalvar("self");

if(frame == 0){

    int HP = getentityproperty(self,"health");

    if(HP <= 0){

        spawn01("BossDed",0,0,0); //BossDed

    }
}
@end_script

    delay    8
    offset    95 148
    attack 64 55 40 99 5 1
    frame    data/chars/enemies/bosses/2ndboss/fall.gif
    delay    8
    offset    90 120
    attack 0 0 0 0 0 
    frame    data/chars/enemies/bosses/2ndboss/fall2.gif

anim  death
delay 8
offset 90 120
attack 0 0 0 0 0
frame data/chars/enemies/bosses/2ndboss/fall2.gif
 
Back
Top Bottom