anim special
@script
void vSelf = getlocalvar("self"); //Caller.
void vEntity; //Target entity placeholder.
int iEntity; //Entity enumeration holder.
int iType; //Entity type.
int iMax = openborvariant("ent_max"); //Entity count.
if(frame==2){
//Enumerate and loop through entity collection.
for(iEntity=0; iEntity<iMax; iEntity++){
vEntity = getentity(iEntity); //Get target entity from current loop.
iType = getentityproperty(vEntity, "type"); //Get target type.
//Enemy type?
if (iType == openborconstant("TYPE_ENEMY")){
void iTime = openborvariant("elapsed_time") + getentityproperty(vEntity, "freezetime");
changeentityproperty(vEntity, "frozen", 1);
changeentityproperty(vEntity, "freezetime", iTime + 3*200);
}
}
}
@end_script
energycost 20
mponly 1
subentity flare
summonframe 2 160 240 0 1
unsummonframe 3
offset 102 215
sound data/chars/krillin/flare.wav
delay 40
frame data/chars/krillin/fl1.gif
delay 20
frame data/chars/krillin/fl2.gif
frame data/chars/krillin/fl2.gif
frame data/chars/krillin/fl2.gif
Bloodbane said://Enumerate and loop through entity collection.
for(iEntity=0; iEntity<iMax; iEntity++){
int iMax = openborvariant("ent_max"); //Entity count.
vEntity = getentity(iEntity); //Get target entity from current loop.
Bloodbane said:@malik:
"I tried to follow your code but could you please explain this part in more detail ?"
That part is highly related to this:
Code:int iMax = openborvariant("ent_max"); //Entity count.
This is to get number of active entities currently.
and this:
Code:vEntity = getentity(iEntity); //Get target entity from current loop.
As info mentions, it gets entity by its number. AFAIK all entities are numbered and you can get them with this function.
The idea is to check all existing entities and do something if type matches, in this case check all entities to find enemy type then stun them.
So to do that, we get the number of all active entities then using iteration like this, we check from number 0 to last number.