how to push an enemy back?

  • Thread starter Thread starter Rayzero-x
  • Start date Start date
R

Rayzero-x

Guest
ok i would like to know how to make in enemy move backwards after you hit them? and i would like to know how to float in the air  for just a few seconds (not going up)
 
For pushing enemy backwards, modders usually have alternate PAIN animation in which enemy is pushed backwards. This is paired with appropriate attackbox in player's attack animation.

As for float in air, a script is needed for this, here's an example:

@script
    void vSelf = getlocalvar("self");

    if(frame==1){
      int  iTime = openborvariant("elapsed_time");

      changeentityproperty(vSelf, "tosstime", iTime + 400);
    }
@end_script

If set in an animation, entity will float in for 2 seconds at 2nd frame. You won't see the effect unless entity is in air when this script is run.
 
well i don't mean push them back with a basic attack i mean push them back with a certain attack like a freespecial, is it scripted?.
 
sparkshocker said:
well i don't mean push them back with a basic attack i mean push them back with a certain attack like a freespecial, is it scripted?.

It can be with any attacking animation, and it's not scripted. Remember how to set up an attackbox, right? Like, attack # # # # etc? Well if you change it to something likeattack3 # # # #, then if the enemy has anim pain3, the enemy will play that pain animation instead of the standard one.

Then in the enemies pain animation, use move -#, where # is the amount of pixels they will move back per frame.

Bloodbane said:
As for float in air, a script is needed for this, here's an example:

@script
    void vSelf = getlocalvar("self");

    if(frame==1){
      int  iTime = openborvariant("elapsed_time");

      changeentityproperty(vSelf, "tosstime", iTime + 400);
    }
@end_script

If set in an animation, entity will float in for 2 seconds at 2nd frame. You won't see the effect unless entity is in air when this script is run.

So this is supposed to work in an enemies fall animation? Like, after I've knocked them in the air? If so, will they retain aerial velocity and float upwards as the player attacks; or will they float in place and just receive damage?
 
NickyP said:
sparkshocker said:
well i don't mean push them back with a basic attack i mean push them back with a certain attack like a freespecial, is it scripted?.

It can be with any attacking animation, and it's not scripted. Remember how to set up an attackbox, right? Like, attack # # # # etc? Well if you change it to something likeattack3 # # # #, then if the enemy has anim pain3, the enemy will play that pain animation instead of the standard one.

Then in the enemies pain animation, use move -#, where # is the amount of pixels they will move back per frame.

The move command is actually rather suboptimal for most things because the movement you get from it is choppy and synchronized to the animation, which doesn't look good.

It's better to set the velocity with inline script like this, which gives you smooth x-axis movement like the engine uses for walking:
anim pain3
loop 0
delay 20
bbox 30 30 50 50
@cmd changeentityproperty getlocalvar("self") "xdir" -#
frame data/chars/foo/pain3-1.png
frame data/chars/foo/pain3-2.png
frame data/chars/foo/pain3-3.png

Where # is the speed you want the entity to be pushed back at.  I don't know the exact conversion factor to convert it to pixels per second, but the number is in the same units used by the speedf command.
 
I remember in mugen you set that veloicty in attackers attack animation so enemy will move according to it when gets hit by this attack, something like this would be nice in openbor so we could save some space on duplicated pain animations.Identical to dropv feature, maybe call it painv or somethin.
 
@NickyP:

If so, will they retain aerial velocity and float upwards as the player attacks; or will they float in place and just receive damage?

I need to check what will happen if this script is run while moving up but one thing for sure is this floating script only stops entity from falling down. Other velocities such as x and z will remain active.

If you still have Castlevania Collab demo, check Charlotte's freespecials. She floats while casting any spells she has.

@Plombo: Don't you think jumpframe is enough?
Anyways, script Plombo posted is great combined with jumpframe to stop enemy if you want enemy to stop before PAIN animation ends.

I agree about move command. It's best used for teleport actions.
 
If we want more than one movement value won't we still have to make extra pain anims and also set the script up for each one?

I've just been using velocity script, I tried Plombo's method but it crashed with latest build.
 
No, you don't need custom pains and all that. You can get the attack values and with some conditionals and pre-planning, have the script dynamically decide how much push back is meted out. A simple but effective method would be tying push back amount = a small % of the damage.

Another is using dropv settings. It's true that dropv is ignored by the engine when an attack doesn't knock its target down, but why not set it anyway? Then a single didhitscript can read and use it as a parameter to decide how much push is applied.

One thing I also like to do is get the defender's current velocity and combine it with the push back force. That way you get a more dynamic effect - for example, a defender rushing forward would be pushed back less (or maybe just slowed down) as compared to one standing still.

DC
 
All very clever ideas, I'll have to try something like this if I can manage to script it.

My mods are fairly simple thou, I think the dropv idea would be best, then I can set things as I need.

Nice post, great info
 
Bloodbane said:
@Plombo: Don't you think jumpframe is enough?
Anyways, script Plombo posted is great combined with jumpframe to stop enemy if you want enemy to stop before PAIN animation ends.

I agree about move command. It's best used for teleport actions.

Yeah, I kinda forgot that jumpframe existed. :-X
 
Back
Top Bottom