Complex animation workarounds

There are a couple of things I would like to try and do with animations that don't seem to be possible with the standard commands. I was hoping someone might be able to give some advice on how these might be accomplished.

Is it possible to have part of the player sprite (like an arm or leg) be displayed in front of an enemy and the rest of the player behind the enemy? An example might be doing a knee after a grab (the knee should appear over the enemy but the player will be partially blocked by the enemy's body) or a groin punch (where one of the enemy's legs would be in front of the player's arm).

Is there any way to set multiple bounding boxes on an enemy so that they can react differently depending on where attacks hit them? I thought maybe you could overlay multiple versions of the same enemy and have them all track the original's movements, but then I wouldn't know how to hide all the copies and only have the animation of the 'hit' one play.

I'm not concerned with memory optimization, just possible methods. Thank you very much for any suggestions.
 
Is it possible to have part of the player sprite (like an arm or leg) be displayed in front of an enemy and the rest of the player behind the enemy?

There are two ways to do it
1. Spawn another entity which shows the arm or leg right at the frame
2. Same as #1 but the entity is immediately bound after spawning

#1 is good for invincible moves in which player can't be interrupted. Usually in slam/throws or super moves. Can't be used in other moves as the arm or leg might be 'left behind' while player is knocked away
#2 is better solution and can be used in all moves

Is there any way to set multiple bounding boxes on an enemy so that they can react differently depending on where attacks hit them?

You know, even if we had multiple bboxes, probably entities would react the same if any of those bboxes were hit
I think what's needed here is detection on where was the last attack landed then change reaction animation based on that location
 
Thanks for those suggestions. Could you give me a real simple example of how you would spawn an arm or leg and bind it like in your #2 idea? Do I need to set every such arm and leg as a 'know' item, are they spawn type: none or subtype: follow?, etc.


I think what's needed here is detection on where was the last attack landed then change reaction animation based on that location

Yeah now that you say that, that's how I got around the problem in a Construct project a while back. I set three 'zones' based on the Y coordinates of a large enemy. If an attack landed in the 300 to 0 Y area, one animation would play, if it landed between 0 and -100, another animation would play, etc.  Can something like that be done here in OpenBOR?
 
Joy said:
Yeah now that you say that, that's how I got around the problem in a Construct project a while back. I set three 'zones' based on the Y coordinates of a large enemy. If an attack landed in the 300 to 0 Y area, one animation would play, if it landed between 0 and -100, another animation would play, etc.  Can something like that be done here in OpenBOR?

This is possible by checking  openborvariant "lasthity" in ondoattackscript event, basically.
 
Bloodbane: I did get the first method to work by putting summonframe in the enemy's anim pain1 section, thank you for the tip. Was hoping you could give me some advice on two other small issues this brought up though.

- You mentioned binding the new spawn, could you tell me how that's done? I haven't been able to find anything searching the manual.

- The summonframe is basing the x/y/a spawn coordinates based on the idle animation's dimensions and not on those of the pain1 animation. Can this be fixed?


Piccolo: That sounds like it could work, thank you. I know nothing about scripting though, so that will have to wait for another day (or some good examples to learn from). BTW I tried Bruiser Brigade, you've done an amazing job on it.
 
About the first one, I'm referring to using this script function:

void spawnBind(void Name, float dx, float dy, float dz, int Dir, int Flag)
{ // Spawn entity and bind it
  void self = getlocalvar("self");
  void Spawn;

  Spawn = spawn01(Name, dx, dy, dz);
  bindentity(Spawn, self, dx, dz, dy, Dir, Flag);
}

void spawn01(void vName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fY: Y location adjustment.
      //fZ: Z location adjustment.

void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int  iDirection = getentityproperty(self, "direction");

clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

if (iDirection == 0){ //Is entity facing left?                 
          fX = -fX; //Reverse X direction to match facing.
}

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.

vSpawn = spawn(); //Spawn in entity.

changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
   
return vSpawn; //Return spawn.
}

Example:

@cmd spawnBind "Arm" 100 100 1 1 4

This function will spawn entity by name of Arm and bind it at 100 pixels to the right and 100 pixels above offset point. Then it also sets special flag (last parameter) which requires Arm entity to have same animation as the animation in which it's spawned
Say if player spawns Arm with that function in GRABATTACK animation, Arm will also play GRABATTACK animation. If Arm doesn't have that animation, it will remove itself
Just reminder that Arm and any entity spawned will remain until they are removed. Usually this Arm entity is given GRABATTACK animation but not other animations, so when player returns to GRAB animation after GRABATTACK, Arm entity will remove itself. Same goes if player is attacked and play either PAIN or FALL animation

- The summonframe is basing the x/y/a spawn coordinates based on the idle animation's dimensions and not on those of the pain1 animation. Can this be fixed?

Wait, how exactly you use summonframe?
 
Thank you for that script example. I will save it for later, but I really do not understand any of it at the moment. So that script is saved in the /scripts folder and is called upon with the @cmd spawnBind command?


Here is how I'm using summonframe at the moment. It's working exactly as expected except for being in the wrong location. I've tried all sorts of combinations of x and z values, but I can't get it exactly right. I wonder if the best solution might be to make all animation frames the same size (rather than cropping empty areas).


anim pain

summonframe 0 0 0 0 0
subentity chest
unsummonframe 1

loop 0
offset  75  308
bbox  33  14  139  88
delay  40
frame Data/CHARS/enemy/pain01.png
delay  60
frame Data/CHARS/enemy/pain02.png

 
Joy said:
Piccolo: That sounds like it could work, thank you. I know nothing about scripting though, so that will have to wait for another day (or some good examples to learn from).

I could give you an example when you'll tackle this then.

BTW I tried Bruiser Brigade, you've done an amazing job on it.

Thanks  ;)
 
Piccolo: Thank you very much for offering to help. I think you already understand what I want to do, but I attached an example picture. This is just a test, so the actual coordinates are not important. I'd like this large enemy to play different pain animations when hit in different locations, so I assume commands like lasthitx and lasthitz would be used?

I am not familiar with using scripting at all though, so I apologize in advance if I'm not able to immediately understand your explanation.  :)  Thanks again.

https://drive.google.com/file/d/0B9CXpXnuWnz5VjVuckVWYlAybUE/view?usp=sharing


(btw, tried to attach this file, it said the folder was full. might want to let Damon or someone else know)
 
I'll look into attachments folder in the morning. As for hit levels, using lasthity, I've already done this for both hit and block reaction. It's really simple actually. Will not to look through my module archive to find it - it's in my old Fatal Fury project.

DC
 
Damon: Thanks for clearing the attachments folder. Also, when you said "Will not to look through my module archive to find it - it's in my old Fatal Fury project.", did you mean "will have to look" or "will not look"? Piccolo gave me a good example already, but I was just wondering what you meant.


Piccolo: Thank you very much for that example. As I don't know anything about script, it's fairly confusing but some of it does make sense. I don't quite understand why the last two (the pain2 and pain) don't have two sets of coordinates like the first two though.

One thing I noticed is that once this enemy is thrown, this script no longer seems to work. Does this enemy have to remain stationary or is more scripting required to remain compatible with throws?

I still can't get Bloodbane's solution above to work, so I guess I need to read utunnels' script manual (if it's still current)  :)  Thank you again for taking the time thus far to help!
 
Joy said:
I don't quite understand why the last two (the pain2 and pain) don't have two sets of coordinates like the first two though.

The bbox height is divided into three parts. If you define two parts (here the lower and middle parts) the last one (here the upper) does not need to be defined : it's just the rest (hence the "else").
 
OK, I see what you mean, just not seeing exactly how it works in the script. I'm probably never going to really understand scripting well; I'm an artist and have never had any luck with programming.  :)

I need to solve a few other silly problems for now (like why a 960x540 background image isn't exactly filling a 960x540 resolution screen and that binding issue above), but that was a very helpful example and it showed that what I want to do can indeed be done. Thank you again for your help and time!
 
Joy said:
Damon: Thanks for clearing the attachments folder. Also, when you said "Will not to look through my module archive to find it - it's in my old Fatal Fury project.", did you mean "will have to look" or "will not look"? Piccolo gave me a good example already, but I was just wondering what you meant.

Sorry, the "not" was a typo. But since Piccolo beat me to it, not much point now. Mine is very old and his is probably better.

DC
 
Joy said:
I still can't get Bloodbane's solution above to work, so I guess I need to read utunnels' script manual (if it's still current)  :)  Thank you again for taking the time thus far to help!

Have you created a .c file to store that function? That function (those functions actually) I stored in spawn.h file and this library is included in other .c files
For your, just create spawn.c file and save those functions there and declare it with:

animationscript data/scripts/spawn.c

Then you can use it like this:

@cmd spawnBind "Arm" 100 100 1 1 4
 
Thanks for replying. I haven't had any luck getting scripts to be called properly so far, so let me go over what I've done and you can point out what I obviously did wrong.  :)

* I copied your script data into a Wordpad file and saved it as spawn.c
* I put that file in data/scripts (alongside a file called 'aniScp.c')
?  I'm actually not sure where I'm supposed to insert "animationscript data/scripts/spawn.c" at the moment.
* I put @cmd spawnBind "entity_name" coords, etc in the pain animation data of the enemy that is supposed to spawn the new body part.
 
Thanks, I got it to spawn and appear in the correct location. Haven't tried getting rid of it yet or having the enemy move with the new spawn bound, but it's good progress and I better understand how to call scripts now. Much appreciated!  However, the spawn is appearing behind the enemy, which kind of negates the whole point of this.  ;)  I don't see any sort of flags to force it to the front, is there something else I'm missing?

edit: Oh, and if you wouldn't mind, could you also explain in a little more detail why your "Arm" example uses "4" at the end to require the same animation as the original? I don't see anything in the script that indicates that or why 4 would be used. Thanks!
 
Back
Top Bottom