I'm trying to change these window background objects from type none to type obstacle - but only under the condition that
2 or more enemies exist on the screen - I have set anim idle to loop 1
please see the code below.
This is the script in question :
2 or more enemies exist on the screen - I have set anim idle to loop 1
please see the code below.
Code:
name windowb
health 10000
type NONE
nolife 1
nodieblink 3
facing 1
candamage none
projectilehit player enemy npc
offscreenkill 70000
noatflash 1
flash woodhit
nomove 1 1
subject_to_wall 0
load gdebris
anim spawn
@script
void self = getlocalvar("self");
if(frame==0){
changeentityproperty(self, "Subject_to_Gravity", 0);
changeentityproperty(self, "Subject_to_Wall", 0);
}
@end_script
loop 0
delay 3
offset 0 0
frame data/levels/st2c/windowb0.png
anim idle
@script
void self = getlocalvar("self");
void target = findtarget(self); // locked opponent
if( target != NULL() && getentityproperty(target,"exists")){
int vEnemy = openborvariant("count_enemies");
if ( vEnemy > 1 ) {
changeentityproperty(self, "type", openborconstant("TYPE_OBSTACLE"));
}
}
@end_script
@script
void self = getlocalvar("self");
if(frame==0){
changeentityproperty(self, "Subject_to_Gravity", 0);
changeentityproperty(self, "Subject_to_Wall", 0);
}
@end_script
@script
void self = getlocalvar("self");
int health = getentityproperty(self,"health");
if (health < 10000){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
@end_script
loop 1
move 0
delay 3
offset 0 0
platform 1 1 1 1 1 1 1 1
bbox 65 40 55 100 #bbox 0 0 156 144
frame data/levels/st2c/windowb0.png
anim FOLLOW1
@script
void self = getlocalvar("self");
if (frame==1){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
@end_script
loop 0
delay 3
move 0
offset 0 0
platform 1 1 1 1 1 1 1 1
frame data/levels/st2c/windowb.png
frame data/levels/st2c/windowb.png
spawnframe 0 0 0 0 0
custentity gdebris
anim FOLLOW2
@script
void self = getlocalvar("self");
if(frame==1){
changeentityproperty(self, "type", openborconstant("TYPE_NONE"));
}
@end_script
@script
void self = getlocalvar("self");
if (frame==1){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
@end_script
loop 1
delay 5555
move 0
offset 0 0
platform 1 1 1 1 1 1 1 1
frame data/levels/st2c/windowb.png
frame data/levels/st2c/windowb.png
This is the script in question :
Code:
@script
void self = getlocalvar("self");
void target = findtarget(self); // locked opponent
if( target != NULL() && getentityproperty(target,"exists")){
int vEnemy = openborvariant("count_enemies");
if ( vEnemy > 1 ) {
changeentityproperty(self, "type", openborconstant("TYPE_OBSTACLE"));
}
}
@end_script