Make Enemy Invincible to Normal1 attacks when dizzy

Aerisetta

Active member
Im trying to make an animation where the enemy becomes dizzy at 1HP (this works, follow1)

While they are in dizzy (follow1) I want them to be invincible to attack1 normal1 type of attacks

I thought the below script would work, but it crashes, can anyone see why?

anim follow1
@script
void self = getlocalvar("self");
getentityproperty(self, "defense");

if(frame==0){
changeentityproperty(self, "defense", openborconstant("ATK_NORMAL1"), 1, 999);
}

if(frame==14){
changeentityproperty(self, "defense", openborconstant("ATK_NORMAL1"), 0, 999);
}
@end_script
delay 10
offset 800 750
bbox 700 500 241 163
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
@cmd hpgain 2
frame data/chars/badguy/raise101.png
 
@Aerisetta
have yout tried modifying another entity property instead, like making the enemy "cant hurt" or somethihg similar instead?

sorry i am very rusty on the whole coding stuff and cant name anythihg specific, but i vaguely remeber that there is some bunch o entity options or attributes that make enemies untouchable or invincible-like
 
Can anyone see what im doing wrong?

You set them in wrong order. Setting 0 defense to certain attack type means setting invincibility to that attack type. OTOH setting 1 means no invincibility.
Try this:
C:
@script
   void self = getlocalvar("self");
 
   if(frame==0){
   changeentityproperty(self, "defense", openborconstant("ATK_NORMAL1"), 0, 999);
   }

   if(frame==14){
   changeentityproperty(self, "defense", openborconstant("ATK_NORMAL1"), 1, 0);
   }
@end_script
...
 
Back
Top Bottom