mersox
Active member
Hi guys. I've been working on this issue for 2 days and I just can't figure out what's wrong. I really need your help at this point. The issue may be linked with bindentity, or with keyint.
I'll try to explain.
I'm trying to include a custom grab + grabwalk feature in my game. The reason it's custom is because I want the grab action to be triggered by a button press (in this case a4).
The grab, grabwalk, and throw are working well, the issue is what happens right after that. Basically, after throwing the enemy, my character reverts back to idle (which is good), but basically freezes in its idle animation - and the thrown entity also stops moving after landing. I'm unable to regain control of the character until I:
- Press a4 again (the grab button)
- Press all keys at random and eventually I'll be able to walk or attack and regain control of the character as normal. Which button works seems to be completely random. If I press jump, my char jumps upward but when landing it's stuck in idle again.
The enemy starts moving again as soon as I get "unstuck", and not before. It's not a time related issue, because if I press no buttons, both my character and the enemy won't move at all, ever.
Check out the following video:
Chars get stuck at 0:10, and resume activity when I press Grab again at 0:15.
I'll now share my scripts. First, pressing a4 triggers the animation freespecial6, which is linked to this didhitscript:
All the grab animations of the player's entity are the following: (excuse the mess)
There's a bunch of keyint's there. I'll now paste the section of the animation script it's referring to:
And finally the relevant animations of the thrown enemy:
PLEASE please help me make sense of this issue!
I'll try to explain.
I'm trying to include a custom grab + grabwalk feature in my game. The reason it's custom is because I want the grab action to be triggered by a button press (in this case a4).
The grab, grabwalk, and throw are working well, the issue is what happens right after that. Basically, after throwing the enemy, my character reverts back to idle (which is good), but basically freezes in its idle animation - and the thrown entity also stops moving after landing. I'm unable to regain control of the character until I:
- Press a4 again (the grab button)
- Press all keys at random and eventually I'll be able to walk or attack and regain control of the character as normal. Which button works seems to be completely random. If I press jump, my char jumps upward but when landing it's stuck in idle again.
The enemy starts moving again as soon as I get "unstuck", and not before. It's not a time related issue, because if I press no buttons, both my character and the enemy won't move at all, ever.
Check out the following video:
Chars get stuck at 0:10, and resume activity when I press Grab again at 0:15.
I'll now share my scripts. First, pressing a4 triggers the animation freespecial6, which is linked to this didhitscript:
Code:
void main()
{
void self = getlocalvar("self");
void opponent = getlocalvar("damagetaker");
void atype = getlocalvar("attacktype");
int antigrab = getentityproperty(opponent, "antigrab");
if ((atype == openborconstant("ATK_NORMAL2")) && (antigrab == 0))
{
performattack(self, openborconstant("ANI_freespecial7"));
}
}
All the grab animations of the player's entity are the following: (excuse the mess)
Code:
anim freespecial6 **grab attempt with didhitscript
loop 0
offset 37 69
bbox 30 13 16 57
delay 6
attackone 1
grabin 1 20
hitfx data/sounds/silence.wav
attack2 46 24 32 29 0 0 0 1 1
frame data/chars/bloody/grab01.png
anim freespecial7 **grab
@script
void self = getlocalvar("self");
void opp = getentityproperty(self,"opponent");
if (frame == 0)
{
bindentity(opp, self, 20, 0, 0, -1, 0, -1);
setentityvar(self, "bound", opp);
}
else if (frame == 1)
{
bindentity(opp, self, 18, 0, 6, -1, 0, -1);
}
else if (frame == 2)
{
bindentity(opp, self, 0, 0, 59, -1, 0, 1);
}
@end_script
loop 1 3
offset 37 69
bbox 30 13 16 57
delay 6
attackone 1
grabin 1 20
hitfx data/sounds/silence.wav
attack2 46 24 32 29 0 0 0 1 15
frame data/chars/bloody/grab01.png
frame data/chars/bloody/grab02.png
@cmd keyint "ANI_FREESPECIAL9" 0 "F" 0 0.5
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grab03.png
@cmd keyint "ANI_FREESPECIAL9" 0 "F" 0 0.5
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grab03.png
anim freespecial8 **grab idle
@script
void self = getlocalvar("self");
void opp = getentityproperty(self,"opponent");
void bound = getentityvar(self, "bound");
if (frame == 0)
{
bindentity(bound, self, 0, 0, 59, -1, 0, 1);
}
@end_script
loop 1
offset 37 69
bbox 30 13 16 57
delay 6
@cmd keyint "ANI_FREESPECIAL9" 0 "F" 0 0.5
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grab03.png
@cmd keyint "ANI_FREESPECIAL9" 0 "F" 0 0.5
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grab03.png
anim freespecial9 **grabwalk
@script
void self = getlocalvar("self");
void bound = getentityvar(self, "bound");
if (frame == 0)
{
bindentity(bound, self, 0, 0, 60, -1, 0, 1);
}
else if (frame == 1)
{
bindentity(bound, self, 0, 0, 59, -1, 0, 1);
}
else if (frame == 2)
{
bindentity(bound, self, 0, 0, 60, -1, 0, 1);
}
else if (frame == 3)
{
bindentity(bound, self, 0, 0, 59, -1, 0, 1);
}
@end_script
loop 1
offset 37 69
bbox 30 13 16 57
delay 16
@cmd keyint "ANI_FREESPECIAL8" 0 "F" 1 0
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grabwalk01.png
@cmd keyint "ANI_FREESPECIAL8" 0 "F" 1 0
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grabwalk02.png
@cmd keyint "ANI_FREESPECIAL8" 0 "F" 1 0
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grabwalk01.png
@cmd keyint "ANI_FREESPECIAL8" 0 "F" 1 0
@cmd keyint "ANI_FREESPECIAL10" 0 "A" 0 0
@cmd keyflip
frame data/chars/bloody/grab03.png
anim freespecial10 **throw
@script
void self = getlocalvar("self");
void bound = getentityvar(self, "bound");
void opp = getentityproperty(self,"opponent");
int Direction = getentityproperty(self, "direction");
if ((frame ==0) && (Direction == 0)){ //Is entity facing left?
tossentity(bound, 1, -4, 0);
performattack(bound, openborconstant("ANI_follow2"));
}
else if ((frame ==0) && (Direction == 1)){ //Is entity facing right?
tossentity(bound, 1, 4, 0);
performattack(bound, openborconstant("ANI_follow2"));
}
else if (frame ==1) {
bindentity(bound, NULL());
bindentity(self, NULL());
setentityvar(self, "bound", NULL());
clearlocalvar();
}
@end_script
loop 0
delay 5
offset 37 69
bbox 30 13 16 57
delay 5
sound data/sounds/fwoosh_C.wav
frame data/chars/bloody/throw.png
delay 40
frame data/chars/bloody/throw.png
There's a bunch of keyint's there. I'll now paste the section of the animation script it's referring to:
Code:
void keyint(void Ani, int Frame, void Key, int Hflag, int Vx)
{// Change current animation if proper key is pressed or released
// Animation is changed to attack mode
void self = getlocalvar("self");
int Dir = getentityproperty(self, "direction");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
void iRKey;
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=="J"){ //Jump Required?
iRKey = playerkeys(iPIndex, 0, "jump"); // "Jump"
} else if (Key=="A"){ //Attack Required?
iRKey = playerkeys(iPIndex, 0, "attack"); // "Attack"
} else if (Key=="S"){ //Special Required?
iRKey = playerkeys(iPIndex, 0, "special"); // "Special"
}
if (Hflag==1){ //Not holding the button case?
iRKey = !iRKey; //Take the opposite condition
}
if (iRKey){
dasher( Vx, 0, 0, 1 ); //Move!
if (Ani=="ANI_IDLE"){ // Going idle?
setidle(self, openborconstant("ANI_IDLE")); //Be idle!
} else {
performattack(self, openborconstant(Ani)); //Change the animation
}
// updateframe(self, Frame); //Change frame
changeentityproperty(self, "animpos", Frame); //Change frame
}
}
And finally the relevant animations of the thrown enemy:
Code:
anim pain2
loop 1 2
offset 37 69
delay 6
frame data/chars/invi/pain01.png
frame data/chars/invi/pain01.png
delay 12
offset 34 69
frame data/chars/invi/grabbed01.png
frame data/chars/invi/grabbed02.png
anim follow2 **thrown
@script
void self = getlocalvar("self");
int Health = getentityproperty(self, "health");
if (frame == 0){
changeentityproperty(self, "candamage", openborconstant("TYPE_ENEMY"));
}
if ((frame == 3) && (Health > 1)) {
changeentityproperty(self, "candamage", openborconstant("TYPE_PLAYER"));
changeentityproperty(self, "health", Health-1);
performattack(self, openborconstant("ANI_RISE"));
}
else if ((frame == 3) && (Health == 1)){
changeentityproperty(self, "candamage", openborconstant("TYPE_PLAYER"));
performattack(self, openborconstant("ANI_DIE"));
}
@end_script
dropframe 1
landframe 2
loop 0
delay 100
offset 23 67
attack 13 13 17 55 1 1 0 0 17
frame data/chars/invi/pain01.png
frame data/chars/invi/death01.png
sound data/sounds/beat_B.wav
attack 0 0 0 0
frame data/chars/invi/death02.png
delay 2
frame data/chars/invi/death02.png
anim rise
loop 0
delay 7
offset 23 67
frame data/chars/invi/death02.png
frame data/chars/invi/death01.png
frame data/chars/invi/idle.png
anim death
loop 0
delay 20
offset 23 67
frame data/chars/invi/death02.png
sound data/sounds/explosion_mix.wav
@cmd spawn01 "og_smoke" 0 10 0
frame data/chars/misc/empty.gif
@cmd killentity getlocalvar("self")
frame data/chars/misc/empty.gif
PLEASE please help me make sense of this issue!