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 ==
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
• facingpain_actual.c
2- Call it in your entity header
3- Final step - Add this line force the entity to go back to the IDLE
See it in action here at 0:17
== 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: