• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Pain for obstacles + facing

O Ilusionista

Captain 80K
This is a code to force obstacles to execute different custom animations when taking hit plus based on which side the hit comes from.

== ANIMATIONS ==
  • IDLE
  • FOLLOW1 (for facing right)
  • FOLLOW2 (for facing left)

For memory sake, we need to use two files - one is just to import the second, to avoid the code to be compiled again each time you add on a new entity.

1 - Save both files under your scripts folder as:

facingpain.c
Code:
#import "data/scripts/facingpain_actual.c"

void main()
{
    actual_main();
}

• facingpain_actual.c
Code:
// Force obstacles to execute a different custom animations when taking hit plus based on which side the hit comes from.
// Douglas Baldan / O Ilusionista - 2018.07.28
// www.brazilmugenteam.com
void actual_main()
{
void self = getlocalvar("self"); // Get the caller
if(getentityproperty(self,"animationid")==openborconstant("ANI_IDLE")) // Is the caller in IDLE animation?
   {
      void opp = getentityproperty(self,"opponent"); // Gets who is attacking it
      int direction = getentityproperty(opp,"direction"); // Gets opponent facing
      if(direction == 1)performattack(self,openborconstant("ANI_FOLLOW1")); //Is entity facing right? 
      if(direction == 0)performattack(self,openborconstant("ANI_FOLLOW2")); //Is entity facing left? 
   }
}

2- Call it in your entity header
takedamagescript data/scripts/facingpain.c

3- Final step - Add this line force the entity to go back to the IDLE
Code:
@cmd    setidle getlocalvar("self") openborconstant("ANI_IDLE") 1

See it in action here at 0:17
 
Last edited:
Thanks for this script! Here is what I've done with it:
https://www.youtube.com/watch?v=Do5ubdmapug
I will use this vibration effect for other destructible elements :)

I'm wondering if there is a reason why obstacles don't have a hardcoded anim pain?
 
kimono each type has different internal routines. Some have less flags and animations (like obstacles and none), some have more (players, enemies).
For example, the "subject_to" set of flags.

This was done to optmize the resource consuption - at lot of this inside OpenBOR is very optmized. Roel was (still is) a beast :)
 
@O Ilusionista
I'm having something strange in using your facing pain script
bbox on idle animation seems to turn into something like wall and player cannot get through it.
When bbox is 0 0 0 0 (removed) then there will be no problems

bbox on:

bbox off:
 
It's because obstacles have platform setting by default. I think its size might be affected by bbox size :rolleyes:
But to be sure, you can declare platform yourself to control platform size or even disable it (by setting platform 1 1 1 1 1 1 1 1)
 
It's because obstacles have platform setting by default. I think its size might be affected by bbox size :rolleyes:
But to be sure, you can declare platform yourself to control platform size or even disable it (by setting platform 1 1 1 1 1 1 1 1)
Thank you Bloodbane!!
I only realized this now after all these years 😌
no its not affected by bbox size
 
3- Final step - Add this line force the entity to go back to the IDLE
Code:
@cmd setidle getlocalvar("self") openborconstant("ANI_IDLE") 1

Where should I put this line?

Also, is there any way for obstacles to negate the hitsound from the attack that hits them? for example, in FFight games, you never hear the hitsound of the attack that hits the obstacles, you just hear the object sounds that gets hit.
 
Where should I put this line?

Also, is there any way for obstacles to negate the hitsound from the attack that hits them? for example, in FFight games, you never hear the hitsound of the attack that hits the obstacles, you just hear the object sounds that gets hit.

I give this tip out a lot - stop using hitfx. It's a leftover legacy functionality best ignored. Put your hit sounds into the flash models instead. This will instantly solve all of your issues controlling sounds based on hit type, target, etc.

DC
 
it might be, yes, but I have more than 20 different hitfx sounds!

Same here, but putting them in the flash still works better. Even if the flash is visibly identical. I just think of them as a form of sound control. Since my flash uses script to play the sound, it's how my effects are able to pan around the screen in stereo based on their location. But even if you use native sound command in the flash, it's so much more effective in the longer run than fighting with hitfx.

DC
 
IS ther a way to fix this way of giving obstacles pain? the dealbreaker for me is that sometimes pain does not trigger if the attack is too fast from combo and it looks strange.
Previously i had obstacle changing type to enemy to give it pain and backpain, but this also made him count into the group, is there a way to exclude entity from current group ? This would fix this and id prefere to go back to previous method .

So i gues my question is - how to exclude enemy from group so hes not reqwuired to be killed to move on.
 
IS ther a way to fix this way of giving obstacles pain? the dealbreaker for me is that sometimes pain does not trigger if the attack is too fast from combo and it looks strange.
That is nothing related with the script, but with the attack itself.
If the attack is too fast, with no "attackbox none" in the end, some combo strings will fail. Most of time, I counter this by using "fastattack 1", adding a "attack none" on the last frame and, on very specific cases, I add "ignoreattackid 1" on the attack animation
 
Back
Top Bottom