maxman
Well-known member
I tried mixing both animation scripts from attack1 (range script) and keyint, and named it keyRange. It does work as I expected. However, when I tried to do the back throw while facing right and holding left key, I cannot have it change to a different animation (freespecial41). It only works when I'm facing left in holding right key and pressing strong punch. I still have no problem with forward and strong punch to throw opponents, and that's a plus.
Here's my script.
Here's what I'm talking about.
Code:
anim freespecial2 #Heavy Punch
delay 2
offset 337 291
cancel 0 0 0 a a2 freespecial30
cancel 0 0 0 a2 a freespecial30
cancel 0 0 0 a freespecial30
cancel 0 0 0 a2 freespecial30
@cmd keyRange 30 75 0 "ANI_FREESPECIAL40" 0 "FA3" 0 0 0 #keyRange {xmin} {xmax} {zmin} {anim} {frame} {key} {flag} {limit}
@cmd keyRange 30 75 0 "ANI_FREESPECIAL41" 0 "BA3" 0 0 0
frame data/chars/zangief/idle01.png
delay 6
bbox 323 178 54 114
frame Data/CHARS/Zangief/CVS2_Zangief_228.png
bbox 324 181 57 111
frame Data/CHARS/Zangief/CVS2_Zangief_229.png
bbox 324 188 66 104
sound data/sounds/common/punch2.wav
frame Data/CHARS/Zangief/CVS2_Zangief_230.png
move 5
bbox 351 187 53 105
hitfx data/sounds/common/beat3.wav
attack3 400 194 69 30 11 0 0 0 0 0
frame Data/CHARS/Zangief/CVS2_Zangief_231.png
move 0
frame Data/CHARS/Zangief/CVS2_Zangief_232.png
bbox 333 186 51 105
frame Data/CHARS/Zangief/CVS2_Zangief_233.png
bbox 321 188 64 103
frame Data/CHARS/Zangief/CVS2_Zangief_234.png
Code:
anim freespecial40 #forward punch grab
offset 337 291
delay 6
followanim 40 #Switch to forward punch throw
followcond 2
fastattack 1
hitfx data/sounds/empty.wav
attack1 300 175 99 41 0 0 1 1 0 0
frame data/CHARS/Zangief/CVS2_Zangief_114.png
attack 0
frame data/CHARS/Zangief/CVS2_Zangief_115.png
frame data/CHARS/Zangief/CVS2_Zangief_118.png
frame data/CHARS/Zangief/CVS2_Zangief_119.png
frame data/CHARS/Zangief/CVS2_Zangief_120.png
Code:
anim follow40 #forward punch throw
offset 337 291
delay 6
jumpframe 5 1 1.6 0
landframe 6
@cmd slamstart2
@cmd position 15 60 15 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_116.png # 0
delay 14
@cmd position 15 54 15 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_117.png # 1
delay 9
@cmd position 1 63 15 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_306.png # 2
@cmd position 5 83 17 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_307.png # 3
@cmd position 6 108 40 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_308.png # 4
@cmd position 16 60 72 0 -1
delay 1000
frame data/CHARS/Zangief/CVS2_Zangief_309.png # 5
sound data/sounds/fall.wav
@cmd position 3 58 12 0 1
delay 13
frame data/CHARS/Zangief/CVS2_Zangief_313.png
@cmd position 3 58 12 0 1
frame data/CHARS/Zangief/CVS2_Zangief_314.png
@cmd depost
@cmd finish 8 1 1 1 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_315.png
@cmd anichange "ani_follow29"
frame data/CHARS/Zangief/CVS2_Zangief_315.png
Code:
anim freespecial41 #back punch grab
offset 337 291
delay 6
followanim 41 #Switch to back punch throw
followcond 2
fastattack 1
hitfx data/sounds/empty.wav
attack1 300 175 99 41 0 0 1 1 0 0
frame data/CHARS/Zangief/CVS2_Zangief_114.png
attack 0
frame data/CHARS/Zangief/CVS2_Zangief_115.png
frame data/CHARS/Zangief/CVS2_Zangief_118.png
frame data/CHARS/Zangief/CVS2_Zangief_119.png
frame data/CHARS/Zangief/CVS2_Zangief_120.png
Code:
anim follow41 #back punch throw
offset 337 291
delay 6
@cmd slamstart2
@cmd position 15 60 15 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_116.png
@cmd flip
frame data/CHARS/Zangief/CVS2_Zangief_116.png
delay 9
@cmd position 15 54 15 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_117.png
@cmd position 1 15 16 0 1
frame data/CHARS/Zangief/CVS2_Zangief_396.png
@cmd position 1 -37 19 0 1
frame data/CHARS/Zangief/CVS2_Zangief_397.png
@cmd position 5 -39 21 0 1
frame data/CHARS/Zangief/CVS2_Zangief_398.png
@cmd position 5 -39 21 0 1
frame data/CHARS/Zangief/CVS2_Zangief_399.png
@cmd position 12 -23 53 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_400.png
@cmd position 4 86 87 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_401.png
delay 19
@cmd position 3 137 5 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_402.png
@cmd depost 0
@cmd finish 10 2 2 1.8 0 -1
frame data/CHARS/Zangief/CVS2_Zangief_403.png
delay 9
frame data/CHARS/Zangief/CVS2_Zangief_404.png
frame data/CHARS/Zangief/CVS2_Zangief_405.png
frame data/CHARS/Zangief/CVS2_Zangief_406.png
frame data/CHARS/Zangief/CVS2_Zangief_407.png
delay 6
frame Data/CHARS/Zangief/TURN01.png
frame Data/CHARS/Zangief/TURN02.png
frame Data/CHARS/Zangief/TURN03.png
frame Data/CHARS/Zangief/TURN04.png
frame Data/CHARS/Zangief/TURN05.png
Here's my script.
C:
void keyRange(int RxMin, int RxMax, int Rz, void Ani, int Frame, void Key, int Hflag, int Limit){
void self = getlocalvar("self");
void target = findtarget(self);
int Health = getentityproperty(self, "health");
int Dir = getentityproperty(self, "direction");
int iPIndex = getentityproperty(self, "playerindex");
int iRKey;
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
if(target != NULL() ){
float Tx = getentityproperty(target, "x");
float Tz = getentityproperty(target, "z");
float Disx = Tx - x;
float Disz = Tz - z;
if(Disz < 0){
Disz = -Disz;
}
if (Key=="U"){ //Up Required?
iRKey = playerkeys(iPIndex, 0, "moveup"); // "Up"
} else if (Key=="D"){ //Down Required?
iRKey = playerkeys(iPIndex, 0, "movedown"); // "Down"
} else if (Key=="L"){ //Left Required?
iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
} else if (Key=="R"){ //Right Required?
iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
} else if (Key=="F"){ //Forward Required?
if (Dir == 0){ // Facing Left?
iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
} else { // Facing Right
iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
}
} else if (Key=="B"){ //Backward Required?
if (Dir == 1){ // Facing Right?
iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
} else { // Facing Left
iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
}
} else if (Key=="A"){ //Attack Required?
iRKey = playerkeys(iPIndex, 0, "attack"); // "Attack"
}
if (Key== "FA3"){ //Forward and Attack3 Required?
if(Dir == 1){
iRKey = playerkeys(iPIndex, 0, "moveright", "attack3"); // "Right" + "Attack3"
}else{
iRKey = playerkeys(iPIndex, 0, "moveleft", "attack3"); // "Left" + "Attack3"
}
}
if (Key== "BA3"){ //Back and Attack3 Required?
if(Dir == 1){ // Face left
iRKey = playerkeys(iPIndex, 0, "moveleft", "attack3"); // "Left" + "Attack3"
}else{
iRKey = playerkeys(iPIndex, 0, "moveright", "attack3"); // "Right" + "Attack3"
}
}
if (Key== "FA4"){ //Forward and Attack4 Required?
if(Dir == 1){ // Face right
iRKey = playerkeys(iPIndex, 0, "moveright", "attack4"); // "Right" + "Attack4"
}else{
iRKey = playerkeys(iPIndex, 0, "moveleft", "attack4"); // "Left" + "Attack4"
}
}
if (Key== "BA4"){ //Back and Attack4 Required?
if(Dir == 0){
iRKey = playerkeys(iPIndex, 0, "moveright", "attack4"); // "Right" + "Attack4"
}else{
iRKey = playerkeys(iPIndex, 0, "moveleft", "attack4"); // "Left" + "Attack4"
}
}
if (Hflag==1){ //Not holding the button case?
iRKey = !iRKey; //Take the opposite condition
}
//if( Disx >= RxMin && Disx <= RxMax && Disz <= Rz && Dir == 1) // Target within range on right facing?
//{
// performattack(self, openborconstant(Ani)); //Change the animation
//} else if( Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz && Dir == 0) // Target within range on left facing?
//{
//performattack(self, openborconstant(Ani)); //Change the animation
//}
if(
( Disx >= RxMin && Disx <= RxMax && Disz <= Rz && Dir == 1)
|| ( Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz && Dir == 0)
&& (Health > Limit)
&& iRKey
)
{
if (Ani=="ANI_IDLE"){ // Going idle?
setidle(self, openborconstant("ANI_IDLE")); //Be idle!
} else {
//changeentityproperty(self, "animation", openborconstant(Ani),2);
performattack(self, openborconstant(Ani));
}
changeentityproperty(self, "animpos", Frame); //Change frame
}
}
}
Here's what I'm talking about.
Last edited: