maxman
Well-known member
Even though I succeeded in pushing back the attacker (player) after hitting the opponent (player/dummy) at screen edge in one of the previous builds, it doesn't work with another build I'm using anymore. Recently, I succeeded in implementing the pushback system using animation script and it's based on the attack1 range function which I replaced animation with velocity property. Depending on the opponent's bbox and the attacker's reach of attackbox as well as the newly made pushback script (for distance between fighters), the attacker is able to be pushed back after hitting the opponent at the edge of the screen.
Example:
However, there's one problem so it's not enough for the attacker's attacking reach. Because the attacker can be pushed back on air before/without hitting the opponent at its corner, I start to think that ondoattackscript is a better option to use for accommodating with animationscript.
P.S.: I did create a new ondoattackscript function for pushing the attacker backwards if s/he attacks the opponent as their attackbox reaches. Not only did I add an entityvar in ondoattackscript but animationscript too. However, the result stopped working and it's not functioning the push of the attacker backwards after I added entityvar in animation script.
This is my new ondoattackscript which I'm having trouble pushing the attacker at the nearest corner.
How can I give a push to the attacker everytime an attackbox reaches to the opponent's bbox?
C:
void antiscreen(int RxMin, int RxMax, int Move){
void self = getlocalvar("self");
int dir = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
int height = getentityproperty(self, "height");
void target = findtarget(self);
float H; float tH; float Hz; float THz;
if(target!=NULL()){
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
float Ty = getentityproperty(target, "a");
int Theight = getentityproperty(target, "height");
float Disx = Tx - x;
float Dish = Ty - y;
int xpos = openborvariant("xpos");
int hres = openborvariant("hresolution");
if( Disx >= RxMin && Disx <= RxMax && dir == 1 && Tx >= xpos+hres-10) // Target within range on right facing?
//if( Disx >= RxMin && Disx <= RxMax && dir == 1 && Tx >= xpos+hres-10 && Dish >= 0 && Dish <= Theight)
{
changeentityproperty(self, "velocity", -Move);
} else if( Disx >= -RxMax-1 && Disx <= -RxMin && dir == 0 && Tx == xpos+10) // Target within range on left facing?
//} else if( Disx >= -RxMax-1 && Disx <= -RxMin && dir == 0 && Tx == xpos+10 && Dish >= 0 && Dish <= Theight)
{
changeentityproperty(self, "velocity", Move);
}
}
}
Example:
Code:
anim attack #STAND LP
offset 97 177
delay 2
bbox 84 79 39 98
sound data/sounds/common/punch.wav
@cmd attack1 0 50 0 "ANI_ATTACK4"
@cmd randSoundSF "Ryu" "SND_PL00_4.wav" "SND_PL00_5.wav" NULL()
frame data/CHARS/ARyu/idlelp01.png
attack 101 84 68 23 0 0 0 0 23 0 # 7 - damage
@cmd antiscreen 0 97 3
frame data/CHARS/ARyu/idlelp02.png
frame data/CHARS/ARyu/idlelp03.png
attack 0
frame data/CHARS/ARyu/idlelp04.png
bbox 81 80 37 97
#@cmd stop
frame data/CHARS/ARyu/idlelp05.png
Code:
anim attack4 #Close LP
offset 97 177
delay 4
bbox 81 81 56 97
sound data/sounds/common/punch.wav
frame data/CHARS/ARyu/closelp01.png
attack 116 78 28 35 0 0 0 0 0 0 # 5
@cmd antiscreen 0 60 1.5
frame data/CHARS/ARyu/closelp02.png
attack 0
frame data/CHARS/ARyu/closelp03.png
bbox 78 81 55 97
frame data/CHARS/ARyu/closelp04.png
bbox 75 79 50 99
#@cmd stop
frame data/CHARS/ARyu/closelp05.png
Code:
anim attack10 #Jump LP
offset 97 177
delay 4
bbox 84 75 42 53
landframe 7
frame data/CHARS/ARyu/jumplp01.png
sound data/sounds/common/punch.wav
attack 101 86 45 43 7 0 0 0 0 0
@cmd antiscreen 0 74 2
frame data/CHARS/ARyu/jumplp02.png
frame data/CHARS/ARyu/jumplp03.png
frame data/CHARS/ARyu/jumplp04.png
attack 0
@cmd looper 2 3
frame data/CHARS/ARyu/jumplp05.png
frame data/CHARS/ARyu/jump08.png
delay 250
frame data/CHARS/ARyu/jump09.png
delay 4
@cmd jumpLand
frame data/CHARS/ARyu/jump09.png
However, there's one problem so it's not enough for the attacker's attacking reach. Because the attacker can be pushed back on air before/without hitting the opponent at its corner, I start to think that ondoattackscript is a better option to use for accommodating with animationscript.
P.S.: I did create a new ondoattackscript function for pushing the attacker backwards if s/he attacks the opponent as their attackbox reaches. Not only did I add an entityvar in ondoattackscript but animationscript too. However, the result stopped working and it's not functioning the push of the attacker backwards after I added entityvar in animation script.
C:
void antiscreen(int RxMin, int RxMax, int Move){
void self = getlocalvar("self");
int dir = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
int height = getentityproperty(self, "height");
void target = findtarget(self);
int Move = getentityvar(self, "Move");
float H; float tH; float Hz; float THz;
if(target!=NULL()){
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
float Ty = getentityproperty(target, "a");
int Theight = getentityproperty(target, "height");
float Disx = Tx - x;
float Dish = Ty - y;
int xpos = openborvariant("xpos");
int hres = openborvariant("hresolution");
if( Disx >= RxMin && Disx <= RxMax && dir == 1 && Tx >= xpos+hres-10) // Target within range on right facing?
//if( Disx >= RxMin && Disx <= RxMax && dir == 1 && Tx >= xpos+hres-10 && Dish >= 0 && Dish <= Theight)
{
changeentityproperty(self, "velocity", -Move);
setentityvar(self, "Move", -Move);
} else if( Disx >= -RxMax-1 && Disx <= -RxMin && dir == 0 && Tx == xpos+10) // Target within range on left facing?
//} else if( Disx >= -RxMax-1 && Disx <= -RxMin && dir == 0 && Tx == xpos+10 && Dish >= 0 && Dish <= Theight)
{
changeentityproperty(self, "velocity", Move);
setentityvar(self, "Move", Move);
}
}
}
This is my new ondoattackscript which I'm having trouble pushing the attacker at the nearest corner.
C:
void attackOpponentToScreen(){
void self = getlocalvar("self");
void target = findtarget(self);
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "y");
int z = getentityproperty(self, "z");
int lastHitX = openborvariant("lasthitx");
int lastHitY = openborvariant("lasthity");
int lastHitC = openborvariant("lasthitc");
void Push = getentityvar(self, "Push");
void TPush = getentityvar(target, "TPush");
int Move = getentityvar(self, "Move");
if(target != NULL()){
int Tx = getentityproperty(target, "x");
int Ty = getentityproperty(target, "y");
int Tz = getentityproperty(target, "z");
int Disx = Tx-x;
if(lastHitC == 1){
setentityvar(self, "Move", Move);
}
}
}
How can I give a push to the attacker everytime an attackbox reaches to the opponent's bbox?