Conditional attacks

O Ilusionista

Captain 100K
Hi there.

I have a common enemy which I spawn in different colors, with different names. To avoid making a new file for new moves, there is a way to say "this move just can be done if the map (palette) is higher than X"?

So, If I spawn it with map 0 or 1, he will use just attack1, attack2. But with map 2, it can use attack3 and so on.
 
There are couple ways to do that with script depending on enemy's AI.

Here's an example of a function I use in Contra mod:
void attackM(void Ani, int Remap)
{// Attack interruption if there's player
// Only occurs if remap matches
    void self = getlocalvar("self");
    int Map = getentityproperty(self, "map");
    void target = findtarget(self); //Find player

    if(target!=NULL() && Map==Remap){
      performattack(self, openborconstant(Ani)); //Attack!
    }
}

This function is declared in IDLE but also works in WALK.
The enemy has automated attack BTW.

This function can be modified adding range check to simulate enemy's attack AI. Though I'm not sure how to incorporate aggression value to the function (aggression value can be acquired).
 
the good thing is that I understand the syntax and the logic behind the scrpit, so this isn't a alien thing to me :)

Just one thing I don't get: we are telling him to attack, but not WHICH attack. I want to make him use, for example, attack3
 
That's what the 1st parameter is for, it tells which animation to play or which attack to perform.

For example, we want to order to perform attack3,

@cmd attackM "ANI_ATTACK3" 2

That's how to input the animation.
 
Back
Top Bottom