Solved Throwing enemies into each other

Question that is answered or resolved.

Okamijoe

Member
Hello,

I did everything according to the manual, so I could throw enemies into each other as well as destroying objects.

projectilehit enemy obstacle

anim fall
loop 0
offset 81 177
delay 9
dropframe 2
landframe 4
sound data/sounds/hidie1.wav
hitflash hitsparkc
frame data/chars/orange/falldown1.png
frame data/chars/orange/falldown2.png
attack 30 100 85 45 1 1
frame data/chars/orange/falldown3.png
delay 1000
attack 30 132 85 45 1 1
frame data/chars/orange/falldown4.png
delay 9
sound data/sounds/falldown1.wav
attack 0 0 0 0
frame data/chars/orange/falldown5.png
delay 25
frame data/chars/orange/falldown6.png
It worked fine using Build 6391.
But after switching to Build 7123 it does not work anymore.
The sprite will pass through enemies without hitting them, and obstacles will stop their fall without taking any damage.

Do I have to change something for this to work properly again in this newer build?
Thanks for your help!
 
Last edited:
Hello,

I did everything according to the manual, so I could throw enemies into each other as well as destroying objects.




It worked fine using Build 6391.
But after switching to Build 7123 it does not work anymore.
The sprite will pass through enemies without hitting them, and obstacles will stop their fall without taking any damage.

Do I have to change something for this to work properly again in this newer build?
Thanks for your help!
Hello @Okamijoe,

Are you using scripted throws? It's strange because SOR2X is using the build 7123 and it works fine.
In my scripted throw system the projectilehit is defined as soon as the opponent is thrown, and has the aiflag projectile flag set to 1.

C:
void throw(int damage, int type, int Vx, int Vy, int Vz, int face)
{//Damage as throw finisher
    void self    = getlocalvar("self");
    void target    = getentityvar(self,"grabbed");
    int z        = getentityproperty(self,"z");
    int tDir    = getentityproperty(target,"direction");
    int vDir;
    
    if(face == 0){ //SAME FACING?
        vDir = tDir;
    }

    if(face == 1){ //OPPOSITE FACING?
        if(tDir == 0){ //FACING LEFT?
            vDir = 1;
        }
        else
        {
            vDir = 0;
        }
    }

    if(target != NULL()){
        void atkType;
        void eType        = getentityproperty(target,"type");
        int dir            = getentityproperty(target,"direction");
        int dropType    = 1;
        
        if(dir == 0){Vx = -Vx;}
        if(type == 1){atkType = openborconstant("ATK_NORMAL8");}
        if(type == 2){atkType = openborconstant("ATK_NORMAL9");}
        
        if(eType == openborconstant("TYPE_PLAYER") || eType == openborconstant("TYPE_NPC")){
            changeentityproperty(target, "projectilehit", "type_player", "type_npc", "type_obstacle");
        }
        else
        if(eType == openborconstant("TYPE_ENEMY")){
            changeentityproperty(target, "projectilehit", "type_enemy", "type_obstacle");
        }
        
        damageentity(target, self, 0, dropType, atkType);
        lockMpG();

        //AUTOMATICALLY REDUCES THE JUGGLEPOINTS TO ZERO IN ANY THROW/SLAM
        if(getglobalvar("juggleSystem") == "off"){changeentityproperty(target, "jugglepoints", 0);}

        changeentityproperty(target, "direction", vDir);
        changeentityproperty(target, "aiflag", "projectile", 1);
        changeentityproperty(target, "damage_on_landing", damage); //RESET PROJECTILE STATUS TO 0 WHEN FALL ON THE GROUND, TOTAL DAMAGE
        finishGrab(Vx, Vy, Vz); //EXECUTE ALL NECESSARY TASKS TO END THE GRAB MOVE (ANTIWALL, UNBIND AND TOSSENTITY)
        setentityvar(self, "grabbed", NULL()); //CLEAR ENTITYVAR
    }
}
 
@Kratus

No, there's no script in place, here's my player's txt:
anim throw
offset 82 177
loop 0
delay 6
flipframe 7
frame data/chars/cam/throw1.png
frame data/chars/cam/throw2.png
frame data/chars/cam/throw3.png
frame data/chars/cam/throw4.png
delay 25
frame data/chars/cam/throw5.png
delay 8
frame data/chars/cam/throw6.png
frame data/chars/cam/throw7.png
frame data/chars/cam/idle1.png
So, I want to make sure I have a correct understanding how this is supposed to work:

1) This line has to be in the enemy's textfile and not the player's text file:
projectilehit enemy obstacle
2) In order for this to work an attackbox must be declared in the enemy's fall anim at certain frames:
anim fall
loop 0
offset 81 177
delay 9
dropframe 2
landframe 4
sound data/sounds/hidie1.wav
hitflash hitsparkc
frame data/chars/orange/falldown1.png
frame data/chars/orange/falldown2.png
attack 30 100 85 45 1 1
frame data/chars/orange/falldown3.png
delay 1000
attack 30 132 85 45 1 1
frame data/chars/orange/falldown4.png
delay 9
sound data/sounds/falldown1.wav
attack 0 0 0 0
frame data/chars/orange/falldown5.png
delay 25
frame data/chars/orange/falldown6.png
If this is correct, my only guess is that something was changed in between build 6391 and 7123.
Maybe there's some other setting missing that has become mandatory for the newer build?

What I can say for sure is that the attack boxes in his fall anim are working correctly - when I'm throwing an enemy against an obstacle when standing right next to it, I'm able to hit myself. But it won't hit or damage another enemy or obstacle for some strange reason. It's like the projectilehit line is not there at all.

Any ideas?
 
@Kratus

No, there's no script in place, here's my player's txt:

So, I want to make sure I have a correct understanding how this is supposed to work:

1) This line has to be in the enemy's textfile and not the player's text file:

2) In order for this to work an attackbox must be declared in the enemy's fall anim at certain frames:

If this is correct, my only guess is that something was changed in between build 6391 and 7123.
Maybe there's some other setting missing that has become mandatory for the newer build?

What I can say for sure is that the attack boxes in his fall anim are working correctly - when I'm throwing an enemy against an obstacle when standing right next to it, I'm able to hit myself. But it won't hit or damage another enemy or obstacle for some strange reason. It's like the projectilehit line is not there at all.

Any ideas?
@Okamijoe I never tested the native throw system in the 7123, I will check it. However, keep in mind that this 7123 is not a stable build like the 6391 is, so you can have some issues.
I will do some tests to see what's going on.
 
@Kratus
Thank you for your help! Much appreciated!
@Okamijoe
Please, test the build I attached in this post and let me know if it solves the problem, it's a modified version based on the 7123.

I remembered that DC made a fix for the native projectilehit command bug in the past year but I don't know if your game is facing the same issue. If yes, indeed it's a bug but is fixed now. In addition, you can manually bypass it with a small script inside every throw animation, like the example below:

C:
anim throw #THROW
@script
void self = getlocalvar("self");
void target = getentityproperty(self, "grabbing");
if(frame == 3){
    if(target != NULL()){
        changeentityproperty(target, "projectile", 1); //APPLY THE "PROJECTILE" STATUS TO ANY THROWN OPPONENT
    }
}
@end_script
    throwframewait 3
    loop    0
    delay    24
    offset    62 126
    sound    data/voices/Axel2.wav
    frame    data/chars/heroes/axel/throw00.gif
        delay    8
    frame    data/chars/heroes/axel/throw01.gif
    frame    data/chars/heroes/axel/throw02.gif
        delay    24
    frame    data/chars/heroes/axel/throw03.gif
        delay    8
    frame    data/chars/heroes/axel/throw01.gif
 

Attachments

@Kratus
I did lots of testing and here's what I found:

The native throw system works correctly now with this new build!
As for your bypass script, I have trouble to get it to work as intended.

@script
void self = getlocalvar("self");
void target = getentityproperty(self, "grabbing");
if(frame == 3){
if(target != NULL()){
changeentityproperty(target, "projectile", 1); //APPLY THE "PROJECTILE" STATUS TO ANY THROWN OPPONENT
}
}
@end_script

If I understand this correctly, the script is supposed to be used in the player's txt as a replacement for the projectilehit line in the enemy text file?

I tried various combinations with this new build:
1) no script in player text, no projectilehit line in enemy text -> enemy fall anim will damage anything according to it's attackboxes (same as in build 6391)
2) no script in player text, with projectilehit line in enemy text -> only damages the defined entities (native throw system)
3) with script in player text, no projectilehit line in enemy text -> enemy fall anim will damage anything (same as 1)
4) with script in player text, with projectilehit line in enemy text -> only damages the defined entities (same as 2)

It seems the script lacks the definition of what can be hit and what not, which would be the default behaviour without the projectilehit line.
Could you please take a look?

Thank you!
 
@Okamijoe

The native throw system works correctly now with this new build!
So, we can conclude that the issue you have is exactly the bug that was fixed.

I tried various combinations with this new build:
Sorry, I forgot to explain that the test build I attached doesn't need to use the script. You will only use the script I posted in the 7123 build you have.
In addition, the script just activates the projectile status to allow collisions when thrown but you also need to define the projectilehit types at the entity's header.

In short, in case you use the 7123:
- put the script I posted in all throw animations
- define the projectilehit types in all entities
 
@Okamijoe


So, we can conclude that the issue you have is exactly the bug that was fixed.


Sorry, I forgot to explain that the test build I attached doesn't need to use the script. You will only use the script I posted in the 7123 build you have.
In addition, the script just activates the projectile status to allow collisions when thrown but you also need to define the projectilehit types at the entity's header.

In short, in case you use the 7123:
- put the script I posted in all throw animations
- define the projectilehit types in all entities
@Kratus

I tried the script with the older Build (7123 (commit hash: 7123), Compile Date: May 18 2021), but unfortunately it still doesn't work.
I made sure the script was in the player's throw anim, the projectilehit in the enemy's fall anim, and that the attackboxes are enabled.
Is there anything else I can try other than using the newer build?
 
the projectilehit in the enemy's fall anim
@Okamijoe

No, the projectilehit is not in the fall anim, it must be placed in the entity's header no matter what build you are using, the same place where you define name, health, mp and other properties.

1680379987719.png

Is there anything else I can try other than using the newer build?
The build I sent no need scripts, just put the projectilehit properties at the header and the attackboxes in the fall anim.

EDIT2: I attached a BOR mod with the projectilehit properly configured, you can use as a reference to configure your game.

 

Attachments

Last edited:
@Kratus
I'm sorry, I mistyped that part in my last post, here's what I really meant:
I made sure the script was in the player's throw anim, the attackboxes are enabled in the enemy's fall anim, and that projectilehit was set in enemy text (header).
So there was nothing done wrong in my mod, and yet, the script has still no effect.
To make absolutely sure that there's nothing in my mod that might cause this, I took the Projectilehit Testbuild from your last post, swapped the engine back to the basic build 7123 and applied the script to Maxmia's throw anim. It does not work here as well.
 
@Kratus

OMG. That was the reason! It works now!
I'm sorry, I didn't realize that if(frame == 3) needed the throwframewait function in order to work, since I don't use that one in my mod.
I thought it was just for applying the projectile status starting at frame 3 of the throw anim. Thank you for your help!

I have one last question:
Can this script be adjusted so I can apply the same logic to attacks that have a knockdown setting?
I'd like to power punch or jump kick enemies into obstacles to break them in the same way a throw does.
Is that possible?
 
OMG. That was the reason! It works now!
I'm sorry, I didn't realize that if(frame == 3) needed the throwframewait function in order to work, since I don't use that one in my mod.
I thought it was just for applying the projectile status starting at frame 3 of the throw anim. Thank you for your help!
Good, I'm glad it worked :)

I have one last question:
Can this script be adjusted so I can apply the same logic to attacks that have a knockdown setting?
I'd like to power punch or jump kick enemies into obstacles to break them in the same way a throw does.
Is that possible?
It works but in this case I suggest to put the code inside a didhit event instead of using inline scripts, or you can use the native "blast" feature instead of the common attack boxes in which I believe will have the same effect.
I used this way exclusively for the native throw system because we don't have any other location to place the code, differently from scripted grabs where we can put the projectile status inside the same code.
 
Back
Top Bottom