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
 
Hi @Bloodbane, for my new game I set this level:
C:
music        data/bgs/levels/stage_1-3/03.bor
bossmusic data/bgs/levels/stage_1-3/Boss_1_(Stage_1,5).ogg
background    data/bgs/levels/stage_1-3/3b.gif
water        data/bgs/levels/stage_1-3/3w.gif  1
panel        data/bgs/levels/stage_1-3/3n.gif
#frontpanel    data/bgs/stage3/3f.gif
order        a

#88 nemici dinosaurs warriors

#z 162 242
#lunghezza 689 pixel quindi ultimo at 257

spawn   Drum
item    RandBonuspoints
coords    162 172
at 0

spawn   Drum
item    RandFood
coords    222 172
at 0

spawn   Drum
item    RandBonuspoints
coords    282 172
at 0

#--group1-----

wait
at  1

group 5 5
at  1

spawn    RandEnemyAliasMap #1
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords    550 220
#health  100
at    1

spawn    RandEnemyAliasMap #2
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords    580 170
#health  100
at      1

spawn    RandEnemyAliasMap #3
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords  580 190
#health  100
at      1

spawn    RandEnemyAliasMap #4
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords    -30 220
#health  100
at      1

spawn    RandEnemyAliasMap #5
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords  580 230
#health  100
at      1

spawn    RandEnemyAliasMap #6
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 580 195
#health 100
at     1

spawn    RandEnemyAliasMap #7
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 580 170
#health 100
at     1

spawn    RandEnemyAliasMap #8
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 222
#health 100
at     1

spawn    RandEnemyAliasMap #9
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 580 233
#health 100
#map 2
at 162

spawn    RandEnemyAliasMap #10
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 162

spawn    RandEnemyAliasMap #11
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 580 232
#health 100
at 186

spawn    RandEnemyAliasMap #12
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -80 213
#health 100
#map 2
at 186

#---group2----------

group 6 6
at 206

spawn    RandEnemyAliasMap #13
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 570 230
#health 120
at 206

spawn    RandEnemyAliasMap #14
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 570 230
#health 100
at 206

spawn    RandEnemyAliasMap #15
spawnscript data/scripts/enemies/rand_x_z_axis.c
item    RandBonuspoints
coords -30 230
#health 100
at   206

spawn    RandEnemyAliasMap #16
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 590 230
#health 100
at 206

spawn    RandEnemyAliasMap #17
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 230
#health 100
at 206

spawn    RandEnemyAliasMap #18
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 570 230
#health 100
at 206

spawn    RandEnemyAliasMap #19
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 570 230
#health 100
#map 2
at 221

spawn    RandEnemyAliasMap #20
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -40 194
#health 120
at 221

spawn    RandEnemyAliasMap #21
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords 570 230
#health 100
at 221

spawn    RandEnemyAliasMap #22
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at   236

spawn    RandEnemyAliasMap #23
spawnscript data/scripts/enemies/rand_x_z_axis.c
#health    800
#boss    1
coords    570 230
at      236

spawn    RandEnemyAliasMap #24
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 236

spawn    RandEnemyAliasMap #25
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 173
#health 100
#map 2
at 236

spawn    RandEnemyAliasMap #26
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 224
#health 120
at 236

spawn    RandEnemyAliasMap #27
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 236

spawn    RandEnemyAliasMap #28
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 236

spawn    RandEnemyAliasMap #29
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 220
#health 100
at 236

spawn    RandEnemyAliasMap #30
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 247

spawn    RandEnemyAliasMap #31
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 172
#health 100
at 247

spawn    RandEnemyAliasMap #32
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 223
#health 100
#map 2
at 247

#music data/bgs/levels/stage_1-3/Boss_1_(Stage_1,5).ogg
#at 257

spawn    Rock_Hopper #33
spawnscript data/scripts/enemies/randZ.c
coords 462 194
#health 120
at 257

spawn    Vice #34
spawnscript data/scripts/enemies/randZ.c
item    BossDed
coords 462 170
#health 100
at 257

spawn    RandEnemyAliasMap #35
spawnscript data/scripts/enemies/rand_x_z_axis.c
item    RandFood
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #36
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #37
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 173
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #38
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #39
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #40
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #41
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #42
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 210
#health 100
at 257

spawn    RandEnemyAliasMap #43
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 171
#health 100
at 257

spawn    RandEnemyAliasMap #44
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #45
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #46
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #47
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 257

spawn    RandEnemyAliasMap #48
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #49
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #50
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #51
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 174
#health 120
at 257

spawn    RandEnemyAliasMap #52
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 257

spawn    RandEnemyAliasMap #53
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #54
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #55
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #56
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 173
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #57
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 224
#health 120
at 257

spawn    RandEnemyAliasMap #58
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 257

spawn    RandEnemyAliasMap #59
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #60
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 222
#health 100
at 257

spawn    RandEnemyAliasMap #61
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #62
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #63
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 220
#health 100
at 257

spawn    RandEnemyAliasMap #64
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #65
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 172
#health 100
at 257

spawn    RandEnemyAliasMap #66
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 223
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #67
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #68
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 170
#health 100
at 257

spawn    RandEnemyAliasMap #69
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #70
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #71
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #72
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #73
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #74
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #75
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 210
#health 100
at 257

spawn    RandEnemyAliasMap #76
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 171
#health 100
at 257

spawn    RandEnemyAliasMap #77
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #78
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #79
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257

spawn    RandEnemyAliasMap #80
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 257

spawn    RandEnemyAliasMap #81
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #82
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 192
#health 100
at 257

spawn    RandEnemyAliasMap #83
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 174
#health 120
at 257

spawn    RandEnemyAliasMap #84
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 190
#health 100
at 257

spawn    RandEnemyAliasMap #85
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 191
#health 100
at 257

spawn    RandEnemyAliasMap #86
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 202
#health 100
at 257

spawn    RandEnemyAliasMap #87
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 193
#health 100
#map 2
at 257

spawn    RandEnemyAliasMap #88
spawnscript data/scripts/enemies/rand_x_z_axis.c
coords -30 194
#health 120
at 257



#questo per attivare l'anim victory npc
spawn   delay
@script
void main()
{
    setglobalvar("Vict", 0);
    setglobalvar("Victor", "X");
}
@end_script
health    5
coords  200 190
at      0

group   1 1
at      0

spawn   delay
health  20
coords  200 190
at      0
It happens that when the boss dies, other enemies are spawned. How can I prevent this?
As you can see after the boss I put other 54 enemies.
 
Back
Top Bottom