Solved Enemy immune script attack

Question that is answered or resolved.

dantedevil

Well-known member
I want to know how make an enemy immune in specific animation when it attacked by this script:

Code:
void damage_all_enemies(int damage, int drop, int stay, void atk_type)
{

     int  iEntity;
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max");  
              
        for(iEntity=0; iEntity<iMax; iEntity++)
        {

       
        vEntity = getentity(iEntity);
        if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy"))
        {
       
        damageentity(vEntity,self,damage,drop,openborconstant(atk_type));
        changeentityproperty(vEntity, "staydown", "riseattack", stay);
   
        }

    }
       

}
 
Last edited:
Solution
I've just tried it myself and I don't understand why disabling immunity fails. It fails with attacktype 60 but not with attacktype 4

One suggestion I can give is to swap attacktype. Find any attacktype from 2 to 10 which is only used by attackbox (not by script) and swap it with attacktype used for immunity
This requires lot of work swapping everything but it's the best way I know for now  :-\
Not work my friend, the immunity still active.

I think maybe can work upside down.

I mean no set "defense normal60 0" in the header of enemy and set an script to activate immunity only in the first part of custom spawn animation.

Like this:


anim follow11
loop 1 2 4
@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);

    if(frame==0){
      setentityvar(self, 1, openborvariant("elapsed_time"));
    }
    if(Summon <= openborvariant("elapsed_time") - 3500){
      setentityvar(self, 1, NULL());
      performattack(self,openborconstant("ANI_FOLLOW12"));
    }
    if(frame == 0){
      void self = getlocalvar("self");
      changeentityproperty(self, "setlayer", -1);
    }
here the script to activate the immunity
@end_script
delay 10
offset 82 348
frame data/chars/hunter/spawn.png
frame data/chars/hunter/spawn.png
frame data/chars/hunter/spawn.png
frame data/chars/hunter/spawn.png
 
Bloodbane said:
Hmmm.... have you expanded attacktypes to 60?

Yes my friend.

Remember this work for me:
Code:
void damage_all_enemies(int damage, int drop, int stay, void atk_type)
{
 	int  iEntity;
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max"); 
    int Def;
               
        for(iEntity=0; iEntity<iMax; iEntity++)
        {       
        vEntity = getentity(iEntity);
        Def = getentityproperty(vEntity, "defense", openborconstant("ATK_NORMAL50"));
		if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy") && Def != 0)
		{		
		damageentity(vEntity,self,damage,drop,openborconstant(atk_type));
		changeentityproperty(vEntity, "staydown", "riseattack", stay);	
		}
	}	
}

I mean the enemy imunity works with this script.

The problem is disable the immunity.
 
I've just tried it myself and I don't understand why disabling immunity fails. It fails with attacktype 60 but not with attacktype 4

One suggestion I can give is to swap attacktype. Find any attacktype from 2 to 10 which is only used by attackbox (not by script) and swap it with attacktype used for immunity
This requires lot of work swapping everything but it's the best way I know for now  :-\
 
Solution
Back
Top Bottom