Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 150
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: Scripted slam/throw  (Read 20681 times)

0 Members and 1 Guest are viewing this topic.

Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Scripted slam/throw
« on: May 12, 2008, 03:45:58 pm »
This has become a hot topic recently. Quite a few users have PM'd me for help on this subject so I thought I may as well publicly share it!

Different people may have different methods , but this is what I see as the best technique. Even professional companies use it.

Take a look at the following video. I've deliberately slowed down the animation so that you can see it working.

http://www.youtube.com/watch?v=yi8txA5WXrY

You can see how Ryo1 manipulates Ryo2 on a frame by frame basis.

Firstly , you need to set up a special set of animations. They will be all the possible frames your character might be put into in any given throw/slam. Including mirrored copies. Don't worry about memory usage as it is a negligible amount.

Here is a small idea of the sorts of frames to use.



Here is an example of one such animation.

Code: [Select]
# Vertical. Head down. Legs slightly bent.
anim follow41
loop  1
delay  1
offset   20 101
bbox 0 0 0 0
frame data/chars/Ryo/0004_193.gif

Easy right? Note that these animations should loop and have a delay of 1. This will allow us to manipulate the victim at any point in the attackers animation. Also note that I've made a detailed description of what the frame looks like. Very useful.  ;)

Next , the script.

Code: [Select]
void bind(int null, float x, float z, float y, int dir){
void self = getlocalvar("self");
void opp = getentityproperty(self, "opponent");
if(null == 1)
{
bindentity(opp, self, x, z, y, dir, 0);
}
else if(null == 0)
{
bindentity(opp, NULL());
}
}

void forceanim(int anim){
void self = getlocalvar("self");
void opp = getentityproperty(self, "opponent");
changeentityproperty(opp, "animation", anim);
}

I will not patronise anyone by explaining what the scripts do. They are extremely easy to follow.

Copy the above script into a text file and name it whatever you like (I call mine library.c) and place it in the data/scripts directory.

In your character's header , add the line (as per my example) animationscript data/scripts/library.c

Next , the attacker's animation.

Code: [Select]
# Throw  Attempt
anim attackbackward
attackone 1
followcond 3
followanim 22
                    loop           0
                    delay         5
                    offset         30 95
frame data/chars/Ryo/0004_03c.gif
                    offset           32 93
frame data/chars/Ryo/0004_03d.gif
                     delay          17
                     offset           16 85
                     attack          58 2 39 81 0 0 0 0 0 10
frame data/chars/Ryo/0004_03e.gif
                     attack          0 0 0 0 0 0
                     delay          5
                    offset           32 93
frame data/chars/Ryo/0004_03d.gif
                    delay         7
                    offset         30 95
frame data/chars/Ryo/0004_03c.gif

#Successful Throw.
anim follow22
                    loop           0
                    delay         100
                    offset         29 100
@cmd bind 1 26 -1 0 -1
@cmd forceanim openborconstant("ANI_FOLLOW50")
frame data/chars/Ryo/0004_126.gif
offset 44 69
@cmd bind 1 -2 -1 0 -1
@cmd forceanim openborconstant("ANI_FOLLOW49")
frame data/chars/Ryo/0004_127.gif
offset 43 63
@cmd bind 1 6 -1 49 -1
@cmd forceanim openborconstant("ANI_FOLLOW42")
frame data/chars/Ryo/0004_128.gif
delay 1
offset 62 60
@cmd bind 1 -50 -1 75 -1
@cmd forceanim openborconstant("ANI_FOLLOW41")
frame data/chars/Ryo/0004_129.gif
delay 24
@cmd bind 0 0 0 0 0
@cmd toss001 3 2 0
frame data/chars/Ryo/0004_129.gif
delay 8
offset 39 52
frame data/chars/Ryo/0004_037.gif
offset 36 61
frame data/chars/Ryo/0004_038.gif
offset 30 77
frame data/chars/Ryo/0004_01e.gif
offset 31 84
frame data/chars/Ryo/0004_01d.gif

You will notice I use attackbackward with a followanim.

The work is done by the 2 @cmd's so I'll explain them for you.

@cmd bind {bind/release} {X} {Z} {Y} {direction}
{bind/release} 1 to bind , 0 to release.
{X} {Z} {Y} X,Z,Y, adjustment. Counted from the attackers offset.
{direction} 0 no change 1 same direction as target -1 opposite direction as target 2 always right -2 always left. For the most part , this should be set to -1.

@cmd forceanim {animation}
{animation} The animation to force the victim into. Use openborconstant.

You will see that I'm also using @cmd toss001 3 2 0. That is actually a script that DC shared and explained elsewhere (although it is slightly modified).There are none scripted equivalents of that , though.

There , it wasn't so hard , was it?
« Last Edit: May 12, 2008, 03:53:51 pm by Orochi_X »


* Orochi_X says : " Sore ga doushita? " :looney:

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Scripted slam/throw
« Reply #1 on: May 12, 2008, 04:30:52 pm »
Since we use the same principal, here is another video; this one shows two different throws, and how the exact same animations on the defender's part are used to make multiple moves.

http://www.caskeys.com/arc/games/images/ryovid0001.avi

Notice too the amount of control that good binding will give you: Ryo steps complete around behind Omote and back again to set him up for the Tani Otoshi. This is something you can't even do at all using the reactive animation method alone.

So let's see here; generic binding method vs. reactive animation method:

Less memory.
More versatility.
Looks smoother.
Easier to use.
Forward compatable.

The choice is clear: Friends don't let friends use reactive animation throws!  :cheers!:

DC
« Last Edit: May 12, 2008, 04:51:44 pm by Damon Caskey »
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Re: Scripted slam/throw
« Reply #2 on: May 12, 2008, 05:11:19 pm »
All this should go in the Wiki  :).

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Scripted slam/throw
« Reply #3 on: May 16, 2008, 11:42:27 am »
 Well now we have 3 modders with same technique! Yes, me included, I have used same bind trick since it's introduced.
 The only difference of my technique with Orochi's is I combined binding and animation change in one function:

Code: [Select]
void slamstart()
{ // Slam Starter
// Use finish after using this
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
   }
}

void position(int Frame, float dx, float dy, float dz, int face)
{ // Modify grabbed entity's position relative to grabber
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     updateframe(target, Frame);
     bindentity(target, self, dx, dz, dy, face, 0);
   }
}

Slamstart starts the slam but it's also used for throw. Position changes position relative to slammer and also change slammed animation sprite.

 The frame reference is listed below:

0 = 1st fall
1 = 2nd fall
2 = 3rd fall/lying
3 = 1st fall Upsidedown
4 = 2nd fall Upsidedown
5 = 3rd fall Upsidedown
6 = Pain Upsidedown
7 = Pain 2 - Foot
8 = Extra fall
9 = Pain 2 - Chest

 I release grabbed opponent with this:

Code: [Select]
void depost(int Gr)
{// Release grabbed entity
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     bindentity(target, NULL());

     if(Gr == 1)
     {
       int x = getentityproperty(target, "x");
       int z = getentityproperty(target, "z");
       changeentityproperty(target, "position", x, z, 0);
     }
   }
}

 At same time or same frame the slam is finished with either 2 of functions below:

Code: [Select]
void finish(int Damage, int Type, int x, int y, int z, int Face)
{ // Damage as slam or throw finisher
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int SDir = getentityproperty(target,"direction");
   int MDir;

   if(Face==0){ // Same facing?
       MDir = SDir;
   }

   if(Face==1){ // Opposite facing?

     if(SDir==0){ // Facing left?
       MDir = 1;
     } else { MDir = 0;}
   }

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     int dir = getentityproperty(target,"direction"); //Get opponent's facing direction
     if(dir==0){ // Facing left?
       x = -x;
     }

     if(Type==1)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL")); // 1st Finisher
     }

     if(Type==2)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL9")); // 2nd Finisher
     }

     if(Type==3)
     {
       damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL8")); // 3rd Finisher + Bbox
     }

     tossentity(target, y, x, z); // Toss opponent ;)
     changeentityproperty(target, "direction", MDir);
   }
}

void throw(int Damage, int Type, int x, int y, int z, int Face)
{ // Damage as throw finisher
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int SDir = getentityproperty(target,"direction");
   int MDir;

   if(Face==0){ // Same facing?
       MDir = SDir;
   }

   if(Face==1){ // Opposite facing?

     if(SDir==0){ // Facing left?
       MDir = 1;
     } else { MDir = 0;}
   }

   if(target==NULL())
   {
     target = getentityproperty(self, "grabbing");
     setlocalvar("Target" + self, target);
   }
   if(target!=NULL())
   {
     int dir = getentityproperty(target,"direction"); //Get opponent's facing direction
     if(dir==0){ // Facing left?
       x = -x;
     }

     if(Type==1)
     {
       damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL")); // 1st throw type
     }

     if(Type==2)
     {
       damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL9")); // 2nd throw type
     }

     if(Type==3)
     {
       damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL2")); // 3rd throw type
     }

     changeentityproperty(target, "attacking", 1);
     changeentityproperty(target, "damage_on_landing", Damage);
     changeentityproperty(target, "projectile", 1);
     changeentityproperty(target, "direction", MDir);
     tossentity(target, y, x, z); // Toss opponent ;)
   }
}

 Finish is for slam finisher while throw is for well throw finisher.

 Example from Athena's Psychic Throw:
Quote
anim grabforward
   delay   5
        offset   39 118
        @cmd    anti
        attackone 0
   frame   data/chars/athena/pthrow01.gif
   delay   6
        @cmd    slamstart
        @cmd    position 5 40 110 1 -1
        attack4 -17 -9 114 99 15 1 1
   frame   data/chars/athena/pthrow01.gif
        @cmd    antiwall -35 20 1
        @cmd    position 0 -35 5 1 -1
   frame   data/chars/athena/pthrow02.gif
        @cmd    antiwall -35 20 1
        @cmd    position 1 -20 35 1 -1
   frame   data/chars/athena/pthrow03.gif
        attack  0
        @cmd    position 2 -5 100 1 -1
   frame   data/chars/athena/pthrow04.gif
        @cmd    position 3 50 145 1 -1
   frame   data/chars/athena/pthrow05.gif
        attack4 -17 -9 114 99 15 1 1
        @cmd    position 4 35 120 1 -1
   frame   data/chars/athena/pthrow06.gif
        @cmd    position 5 10 105 1 -1
   frame   data/chars/athena/pthrow07.gif
   delay   15
        @cmd    position 0 -35 10 1 -1
   frame   data/chars/athena/pthrow08.gif
        offset   39 103
   delay   5
        attack  0
        @cmd    anti
   frame   data/chars/athena/push01.gif
        delay   8
        @cmd    depost 0
        @cmd    throw 45 1 -4 3 0 0
   frame   data/chars/athena/push02.gif
   frame   data/chars/athena/push03.gif
        delay   10
   frame   data/chars/athena/push04.gif

 This animation has optional stabilizers and cosmetics in it but I won't explain them now unless someone asks.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

J-Rock

  • Guest
Re: Scripted slam/throw
« Reply #4 on: May 21, 2008, 09:20:09 am »
Forgive a newb for speaking up, but...

Is it then feasibly possible to implement 'CPS-style' throwing into a mod, i.e. using the directional keys to finish a standard attack combo with a forced throw, as seen in Capcom beat-em-ups like Final Fight, The Punisher etc? Also what about throwing in both directions from a grab position? Both are invaluble crowd control techniques in these sort of games and are sorely missed in otherwise brilliant mods on this site that I've downloaded.

I would assume that a combination of the animation branching script detailed in the scripts page, and the script above would do the trick?

EDIT: Grammar
« Last Edit: May 21, 2008, 09:42:13 am by J-Rock »

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Scripted slam/throw
« Reply #5 on: May 21, 2008, 09:30:53 am »
The short answer is: Yes. With proper application of script, animations, and binding there is absolutely no throw or slam you can't replicate. Even mutipart throws like those often seen in 3D games are possible.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Scripted slam/throw
« Reply #6 on: May 23, 2008, 12:21:30 pm »
Is it then feasibly possible to implement 'CPS-style' throwing into a mod, i.e. using the directional keys to finish a standard attack combo with a forced throw, as seen in Capcom beat-em-ups like Final Fight, The Punisher etc?

Of course. Original BoR has already allow that and all we need to do is modify the animations.

Quote
Also what about throwing in both directions from a grab position? Both are invaluble crowd control techniques in these sort of games and are sorely missed in otherwise brilliant mods on this site that I've downloaded.

 I know what you are thinking but BoR is based on SoR. In that game, I think SEGA doesn't like mirroring backthrow for frontthrow so they didn't make it. Capcom on the other hand doesn't care so it's possible in Capcom brawler games. Not saying any is bad.

Quote
I would assume that a combination of the animation branching script detailed in the scripts page, and the script above would do the trick?

 Of course, if you know BoR game mechanics, what you asked is possible.
 Even better, slams and throws are also doable outside grabs. It's quite complex due to stability but doable.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

J-Rock

  • Guest
Re: Scripted slam/throw
« Reply #7 on: May 24, 2008, 08:46:24 am »
Quote
Also what about throwing in both directions from a grab position? Both are invaluble crowd control techniques in these sort of games and are sorely missed in otherwise brilliant mods on this site that I've downloaded.

 I know what you are thinking but BoR is based on SoR. In that game, I think SEGA doesn't like mirroring backthrow for frontthrow so they didn't make it. Capcom on the other hand doesn't care so it's possible in Capcom brawler games. Not saying any is bad.

I know what you mean but on the other hand, SoR's grabs allowed for you to flip over and throw from behind, plus the grab attacks (like Axl's knees) were effective against other enemies that wandered into range as well as the recipient. Also, SoR had a more spacious playfield and smaller sprites, giving the player more room to manouvere. Trying to play a KOF based game with full size sprites without easily being able to throw enemies into each other feels like a handicap. That's just my personal opinion on it. It doesn't really have to be a mirrored animation of the back throw, but the ability to do some kind of throw forward is useful.

I think you may have misunderstood what I meant by CPS throwing, because original BoR hasn't got it implemented as far as I can tell. I meant that in Final Fight for example, you could throw two jabs and a body blow with Cody, then if you pressed back, up or down + attack at that point, Cody would throw the opponent behind him without having to move in for a grab:
Quote
Even better, slams and throws are also doable outside grabs
Although that did answer my question, thanks.  :cheers!:

Offline baritonomarchetto77

  • Hero Member
  • *****
  • Posts: 1144
Re: Scripted slam/throw
« Reply #8 on: May 26, 2008, 04:12:23 am »
Guys, you are very skilled on producing effective scripts! In my hope there's the possibility to perform something like that by my own. Congratulations !

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Scripted slam/throw
« Reply #9 on: May 27, 2008, 11:49:52 am »
I know what you mean but on the other hand, SoR's grabs allowed for you to flip over and throw from behind,

 Well, there is vault but it's buggy currently so we can only rely on scripts to make that vault effect.

Quote
plus the grab attacks (like Axl's knees) were effective against other enemies that wandered into range as well as the recipient.

 BoR allows that too but in latest engine, it's disabled as default. We change it of course.
 TBH, this effect is quite cheap IMO.

Quote
Trying to play a KOF based game with full size sprites without easily being able to throw enemies into each other feels like a handicap. That's just my personal opinion on it.

 Well, change your strategy then. Due to enemy's AI, throwing enemies is not always necessary.

Quote
I meant that in Final Fight for example, you could throw two jabs and a body blow with Cody, then if you pressed back, up or down + attack at that point, Cody would throw the opponent behind him without having to move in for a grab:

 Strange, I always thought that as bug. I mean that only happens if Cody is close to enemy.
 Anyways, it's doable and Golden Axe Remake by Utunnels has that feature.

Quote
In my hope there's the possibility to perform something like that by my own.

 You don't need help?
 Good luck anyways!
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Scripted slam/throw
« Reply #10 on: May 27, 2008, 01:37:01 pm »

 Strange, I always thought that as bug. I mean that only happens if Cody is close to enemy.
 Anyways, it's doable and Golden Axe Remake by Utunnels has that feature.


Not a bug. In fact the arcade machine has it on the instruction card. Little known feature, and very handy if you use it right.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Scripted slam/throw
« Reply #11 on: May 31, 2008, 11:36:14 am »
Ah you're right! I just tested it and it works just as mentioned above.

Quote
In fact the arcade machine has it on the instruction card.

 Sigh, :(, most arcade machines I saw 13 years ago are generic type who doesn't have any instruction card anywhere on the machine. No wonder I miss that info.
 That's excluding 3D games though.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Scripted slam/throw
« Reply #12 on: June 05, 2008, 08:58:27 am »
Don't sweat it. Most arcades here didn't have them either, I just happened to have seen a dedicated Final Fight cabinet. Even then games always have undocumented features.

One I liked was "jump" to get up faster. Random jagging may seem to get you up a bit quicker, but that's only because you are hitting the jump button. Try just tapping Jump instead, and you'll recover almost instantly. When knocked down by Andore, I found this let me get up quickly enough to move out of the range of his body splash followup and jump kick him out of it without needing to waste life on a deathblow attack.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Scripted slam/throw
« Reply #13 on: June 08, 2008, 01:09:08 pm »
Don't sweat it. Most arcades here didn't have them either, I just happened to have seen a dedicated Final Fight cabinet. Even then games always have undocumented features.

Oh, no wonder.

Quote
One I liked was "jump" to get up faster. Random jagging may seem to get you up a bit quicker, but that's only because you are hitting the jump button. Try just tapping Jump instead, and you'll recover almost instantly.

Ah thanks for the info! These games have so many unknown infos (at least to me). I discovered that Captain Commando (and his team) perform different combo if forward is held while pressing attack button months ago.
 But OTOH I haven't figured out proper way to make Punisher throw grenades to front of him. I know how to perform the jump version though and also know how to perform critical Izuna Drop.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

kobra k

  • Guest
Re: Scripted slam/throw
« Reply #14 on: September 08, 2008, 08:42:03 am »
Small but awesome trick.

Im going to use this for my AoF mod. ;D

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal