• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Flying enemy refuses to attack?

MysticalMist

Active member
I'm making a basic flying enemy that has a downward-diagonal kick attack like the Jet enemies from SOR. Very basic stuff.

I've made enemies like this in the past without much issue, but for some reason, I can't help but feel like I'm missing something painfully obvious, yet I can't seem to figure it out. Here's some of the code with the header, idle and attack:

Code:
name Beatrix
health        50
speed        14
type        enemy
gfxshadow    1
risetime    300
knockdowncount    20
hostile        player npc
candamage    player npc obstacle
icon        data/chars/beatrix/icon.png 1
diesound    data/sounds/fdie01.wav
animationscript    data/scripts/escript.c
subject_to_platform 0
subject_to_hole 0

anim idle
    loop    1
    delay   7
        offset 45 88
    bbox.position.x 33
    bbox.position.y 9
    bbox.size.x 25
    bbox.size.y 78
    seta 70
    frame    data/chars/beatrix/idle/2.png
    frame    data/chars/beatrix/idle/1.png
    frame    data/chars/beatrix/idle/0.png

anim attack1
    loop    0
    delay   7
    seta    0
    @cmd    degravity 1
    offset 45 88
    bbox.position.x 33
    bbox.position.y 9
    bbox.size.x 25
    bbox.size.y 78
    range 0 200
    frame    data/chars/beatrix/dmg/2.png
        delay   24
        offset 45 84
    bbox.position.x 33
    bbox.position.y 5
    bbox.size.x 25
    bbox.size.y 78
    attack.damage.force 20
    attack.position.x 34
    attack.position.y 51
    attack.reaction.fall.force 99
    attack.reaction.fall.velocity.x 2.0
    attack.reaction.fall.velocity.y 2.0
    attack.size.x 26
    attack.size.y 32
    @cmd    dasher 3 -3 0
    frame    data/chars/beatrix/atk/0.png
    delay   40
    offset 45 84
    bbox.position.x 33
    bbox.position.y 5
    bbox.size.x 25
    bbox.size.y 78
    attack.position.x 0
    attack.position.y 0
    attack.size.x 0
    attack.size.y 0
        @cmd    degravity 0
    frame    data/chars/beatrix/dmg/5.png
    loop    0
    delay   7
        offset 45 88
    bbox.position.x 33
    bbox.position.y 9
    bbox.size.x 25
    bbox.size.y 78
    movea 10
    frame    data/chars/beatrix/idle/2.png
    frame    data/chars/beatrix/idle/1.png
    frame    data/chars/beatrix/idle/0.png

Update: I have tried using enemies such as @Bloodbane's harpy from his Map9 example and strangely enough, it counters the same issue. At least on the test stage I've made since the beginning of my project. So maybe something is wrong with the level?

Stage txt:
Code:
background    data/bgs/training/bg.png

direction both
panel        data/bgs/training/ring.png

order    a
settime 0
notime 1



#---------------------
wall 49 281 -85 -85 106 -18 89 9999
wall 694 275 -158 -28 28 29 92 9999

spawn1 150 0 0
spawn1 150 10 0

spawn drug_machine
coords 207 220
item medkit
at 0

spawn speaker
coords 325 217
item money
at 0

group 1 1
at 0

spawn beatrix
alias Test_Enemy
coords 500 239
at 0
 
Last edited:
I'm making a basic flying enemy that has a downward-diagonal kick attack like the Jet enemies from SOR. Very basic stuff.
Is this attack?


If yes, this is how I coded the animation:

Code:
anim attack2 #SHORT RANGE CHARGE
    range 0 200
    rangea -999 999
    rangeb -999 999
    fastattack 1
    jugglecost 8
    forcedirection -1
    otg 1
    loop    0
    delay    4
    offset    158 181
    bbox    144 106 25 77
    @cmd hitfx "data/sounds/sor2_hit6.wav"
    @cmd gravity 0
    @cmd hole 0
    @cmd leaper 0 1 0
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    frame    data/chars/bosses/jet/sor2/backwalk01.png
    frame    data/chars/bosses/jet/sor2/backwalk00.png
    @cmd gravity 1
    frame    data/chars/bosses/jet/sor2/backwalk01.png
        delay    4
    @cmd sound "data/sounds/sor3_jet.wav"
    @cmd leaper 4 -3 0
    attack 141 147 36 36 16 1 0 0 20 12
    bbox    137 124 37 43
    frame    data/chars/bosses/jet/sor2/a200.png
    @cmd voice "data/voices/sor2_jet_attack2.wav"
    frame    data/chars/bosses/jet/sor2/a201.png
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    @cmd landFrame 4
    @cmd leaper 4 0 0
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    @cmd leaper 3 0 0
    attack 0 0 0 0 0 0 0 0 0 0
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    @cmd leaper 2 0 0
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    @cmd leaper 1 0 0
    frame    data/chars/bosses/jet/sor2/a200.png
    frame    data/chars/bosses/jet/sor2/a201.png
    @cmd aniChange 1 openborconstant("ANI_FOLLOW5")
    frame    data/chars/bosses/jet/sor2/a201.png

Here's the gravity script I'm using, the other scripts you can replace with your own versions (or remove some, like the "hole"), plus the landframe you can use the native command too.
Code:
void gravity(int flag)
{//Changes gravity effect
    void self                = getlocalvar("self");
    float defaultGravity    = getentityproperty(self, "antigravity");
    float savedGravity        = getentityvar(self, "antigravity");
    
    //GRAVITY DISABLED
    if(flag == 0){

        //SAVE THE ENTITY'S DEFAULT ANTIGRAVITY VALUE INTO A VARIABLE ONCE
        if(savedGravity == NULL()){setentityvar(self, "antigravity", defaultGravity);}

        //DISABLE THE ENTITY'S GRAVITY BY CHANGING IT TO 1
        changeentityproperty(self, "antigravity", 1);
    }

    //GRAVITY ENABLED
    if(flag == 1){

        //DEFINE A DEFAULT VALUE IF THE VARIABLE IS EMPTY TO AVOID THE ENGINE TO CRASH
        if(savedGravity == NULL()){savedGravity = 0;}

        //APPLY THE DEFAULT ANTIGRAVITY VALUE AND CLEAR THE VARIABLE
        changeentityproperty(self, "antigravity", savedGravity);
        setentityvar(self, "antigravity", NULL());
    }
}
 
I can't help but feel like I'm missing something painfully obvious, yet I can't seem to figure it out.

I had to wonder, what do you mean by refuses to attack?
Anyways, I've reviewed Harpy and its attack goes like this: wait a bit, dives, stop at ground, flies up and stop.
Beatrix only has dives part. Wait could be omitted but the remaining steps should be there for good animation. Try giving her the missing steps.

So maybe something is wrong with the level?

Well, you could try Beatrix in other level to see if the issue persists there.
 
I have actually managed to figure out the problem thanks to @Kratus's post. I applied the "rangea -999 999 rangeb -999 999" parameters and now Beatrix works just fine! Of course with a few more additional tweaks to make her downward kick a lot more polished. Thanks guys!
 
Back
Top Bottom