Solved wall effect

Question that is answered or resolved.

DD Tokki

Well-known member
DDR_v.1.1.F._ENG - 0004.png
hello.
I was playing Double Dragon and found the move I was looking for.
When the enemy is knocked down, the effect is to hit the wall and fall down in the opposite direction.
Can I get some advice on this?
 
Last edited:
Solution
You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:
void main()
{// Wall bounce on falling state
    void self = getlocalvar("self");
    int Vx = getentityproperty(self,"xdir");
    int Vy = getentityproperty(self,"tossv");
    int Vz = getentityproperty(self,"zdir");
    int Fall = getentityproperty(self, "aiflag", "drop");

    if(Fall==1){
      changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
    }
}

Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
onblockwscript data/scripts/wallbons.c
Anim HITWALL (players,enemies)

Optional.
This animation is played when entity hits a wall while falling.

Check the manual
thank you However, if you apply this command and climb the terrain corresponding to the wall, the fallen enemy will instantly move away.

hitwall {enemies, players}

Removed. No longer valid.
If an entity had this animation, when they hit a wall after being thrown or flung, they would hang on the wall for about two seconds before sliding down.
This didn't work for screen edges, just for the ends of stages with the blocked command.
This animation has been removed. It no longer works.
 
You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:
void main()
{// Wall bounce on falling state
    void self = getlocalvar("self");
    int Vx = getentityproperty(self,"xdir");
    int Vy = getentityproperty(self,"tossv");
    int Vz = getentityproperty(self,"zdir");
    int Fall = getentityproperty(self, "aiflag", "drop");

    if(Fall==1){
      changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
    }
}

Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
onblockwscript data/scripts/wallbons.c
 
Solution
You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:
void main()
{// Wall bounce on falling state
    void self = getlocalvar("self");
    int Vx = getentityproperty(self,"xdir");
    int Vy = getentityproperty(self,"tossv");
    int Vz = getentityproperty(self,"zdir");
    int Fall = getentityproperty(self, "aiflag", "drop");

    if(Fall==1){
      changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
    }
}

Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
thank you It works fine. Now it looks natural on the wall.
 
Very cool!!!

Could this work when the player is on stage facing a group of enemies? independent of walls as in the new TMNT Sheredder's Revenge, something like unless walls the enemy hits the screen limits as it is subject to the screen.
 
@kdo,

Yes, you can do that. It's not exactly the same technique but very similar. You can use onmovex scripts to monitor position relative to screen limits and bounce any entity that starts to cross the border while falling. There's also an onblock event for screen edges that can do the same thing. The only catch for that method is enemies are normally allowed out of the screen, so you'd have to toggle their subject to screen flags.

DC
 
something like unless walls the enemy hits the screen limits as it is subject to the screen.

As Damon posted above, you could use onblocksscript with the above WallBons.c to get same effect. However, since enemies normally aren't subject to screen, you'll need to force them to.
One way to do it is to force it in their damage script. Then disable subject to screen when they rise or when they are bounced.
 
You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:
void main()
{// Wall bounce on falling state
    void self = getlocalvar("self");
    int Vx = getentityproperty(self,"xdir");
    int Vy = getentityproperty(self,"tossv");
    int Vz = getentityproperty(self,"zdir");
    int Fall = getentityproperty(self, "aiflag", "drop");

    if(Fall==1){
      changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
    }
}

Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
How to do it for screen edge?
Try this but not working:

Code:
onblocksscript          data/scripts/wallbons.c
 
The script only works if the enemy is subject to screen. If you want to use this, either make enemies subject to screen or make them subject to screen only if they are knocked down by certain attack. Subject to screen is disabled after enemy lands or when enemy rises.
 
The script only works if the enemy is subject to screen. If you want to use this, either make enemies subject to screen or make them subject to screen only if they are knocked down by certain attack. Subject to screen is disabled after enemy lands or when enemy rises.
Thank you it's working but I need to use subject to screen on every fall and rise anim to do this, is there a way to modify this wallbons script to get a similar result?
 
Thank you it's working but I need to use subject to screen on every fall and rise anim to do this, is there a way to modify this wallbons script to get a similar result?
@machok
As a suggestion, you can use the same way I'm using on SORX. Basically, the subject to screen is changed to 1 when the enemy take any damage and is changed to 0 if is blocked by the screen edge while walking. To make it work you need to use respectively the takedamagescript and onblocksscript events.

takedamagescript
C:
void main()
{//Lock the screen edge (for enemies) if take any damage
    void self    = getlocalvar("self");
    void type  = getentityproperty(self,"type");
    int dead    = getentityproperty(self, "dead");

    if(type == openborconstant("TYPE_ENEMY") && !dead){
        changeentityproperty(self, "subject_to_screen", 1);
    }
}

onblocksscript
C:
void main()
{//Unlock the screen edge (for enemies) according to defined animations
    void self    = getlocalvar("self");
    void type  = getentityproperty(self,"type");
    int anim    = getentityproperty(self, "animationID");

    if(type == openborconstant("TYPE_ENEMY")){
        if( anim == openborconstant("ANI_WALK")||
            anim == openborconstant("ANI_RUN")){
            changeentityproperty(self, "subject_to_screen", 0);
        }
    }
}
 
@Kratus It works perfectly many thanks 🤗
but how you make enemy bounce back with screen edges? I mean like the screen edge hitting the enemy back inside so player can continue the combo
 
@Kratus It works perfectly many thanks 🤗
but how you make enemy bounce back with screen edges? I mean like the screen edge hitting the enemy back inside so player can continue the combo
You can combine the wall previous bouncing script inside the onblocksscript, like this

C:
void main()
{
    wallBounce();
    wallUnlock();
}

void wallBounce()
{// Wall bounce on falling state
    void self = getlocalvar("self");
    int Vx = getentityproperty(self,"xdir");
    int Vy = getentityproperty(self,"tossv");
    int Vz = getentityproperty(self,"zdir");
    int Fall = getentityproperty(self, "aiflag", "drop");

    if(Fall==1){
      changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
    }
}

void wallUnlock()
{//Unlock the screen edge (for enemies) according to defined animations
    void self    = getlocalvar("self");
    void type  = getentityproperty(self,"type");
    int anim    = getentityproperty(self, "animationID");

    if(type == openborconstant("TYPE_ENEMY")){
        if( anim == openborconstant("ANI_WALK")||
            anim == openborconstant("ANI_RUN")){
            changeentityproperty(self, "subject_to_screen", 0);
        }
    }
}
 
Back
Top Bottom