Solved Immune to freeze attacks

Question that is answered or resolved.

MysticalMist

Well-known member
I have a boss enemy that I want to remain unaffected from any attack that uses the "freeze" type. I've tried using the defense parameter in the header, but it still gets stuck in place instead of ignoring its effect entirely. What's the best way to go about doing this?
 
Solution
You have to use a takedamagescript for that.

save those under your scripts folder:

antifreeze.c
C-like:
#import "data/scripts/antifreeze_actual.c"

void main()
{
    actual_main();
}

antifreeze_actual.c

C-like:
void actual_main()
{// Make the target immune to freeze
// Douglas Baldan / O Ilusionista - 2023.12.10
    
    void self = getlocalvar("self"); //Get calling entity.
    void Health = getentityproperty(self,"health");
    int Type = getlocalvar("attacktype");
    int Map = getentityproperty(self,"colourmap");
    
    if(Type == openborconstant("ATK_FREEZE")){
        if (Health > 0){
        changeentityproperty(self, "colourmap", Map);
        changeentityproperty(self, "freezetime", 0);   
        }
    }

}

I haven't...
You have to use a takedamagescript for that.

save those under your scripts folder:

antifreeze.c
C-like:
#import "data/scripts/antifreeze_actual.c"

void main()
{
    actual_main();
}

antifreeze_actual.c

C-like:
void actual_main()
{// Make the target immune to freeze
// Douglas Baldan / O Ilusionista - 2023.12.10
    
    void self = getlocalvar("self"); //Get calling entity.
    void Health = getentityproperty(self,"health");
    int Type = getlocalvar("attacktype");
    int Map = getentityproperty(self,"colourmap");
    
    if(Type == openborconstant("ATK_FREEZE")){
        if (Health > 0){
        changeentityproperty(self, "colourmap", Map);
        changeentityproperty(self, "freezetime", 0);   
        }
    }

}

I haven't tested it myself as I adapted it from another code I use, but it should work.
 
Solution
Back
Top Bottom