Solved Slamstart script grabs another player

Question that is answered or resolved.

Toranks

Active member
I will put in situation: Attack6, if hits, initiates a grab with slamstart2. Sometimes, when the enemy attacks player 2 with attack6, the enemy starts the slamstart with player 1 no matter how far away he is, teleporting him, and I can't understand why. Can anyone find the error among the entire code chain involved?
anim attack6
range 5 90
rangez 5 80
loop 0
delay 14
offset 108 190
bbox 84 98 47 90
followanim 1
followcond 3
hitfx data/sounds/grab.wav
frame data/chars/3jack/grab01.gif
delay 4
move 5
movez 5
attack 90 100 75 55 0 0 1 1 8 20
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
frame data/chars/3jack/grab02.gif
attack 0 0 0 0
move 0
movez 0
delay 15
frame data/chars/3jack/grab03.gif
frame data/chars/3jack/grab01.gif

anim follow1
range 15 84
loop 0
delay 35
offset 108 190
bbox 0 0 0 0
quakeframe 22 4 4
@cmd slamstart2
@cmd position 7 35 10 -1 1
frame data/chars/3jack/grab02.gif
delay 12
@cmd spawngrab "grab1" 200 200 450 65 2 8
@cmd position 24 35 35 -1 1
frame data/chars/3jack/grab04.gif
@cmd position 1 10 20 -1 1
frame data/chars/3jack/grab05.gif
@cmd position 2 -5 70 -1 1
frame data/chars/3jack/grab06.gif
@cmd position 14 -15 60 -1 1
frame data/chars/3jack/grab07.gif
@cmd position 19 -30 35 -1 -1
frame data/chars/3jack/grab08.gif
@cmd position 6 -30 5 -1 1
frame data/chars/3jack/grab09.gif
@cmd spawn01 "dust" -30 1 1
sound data/sounds/fall.wav
@cmd position 3 -50 10 -1 1
frame data/chars/3jack/grab09.gif
delay 15
@cmd hurt 15
@cmd position 20 -30 7 -1 -1
frame data/chars/3jack/grab10.gif
@cmd position 10 -30 10 -1 1
frame data/chars/3jack/grab11.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab11.gif
delay 6
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab12.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab30.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab31.gif
delay 9
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab13.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab14.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab15.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab16.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab17.gif
delay 4
attack 55 125 90 40 30 1 0 1 5 20
dropv 4 4
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab25.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab26.gif
@cmd killgun 8 0
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab27.gif
@cmd position 9 -30 10 -1 1
frame data/chars/3jack/grab28.gif
delay 12
@cmd spawn01 "flashscreen1" -30 1 1
@cmd position 10 -30 5 -1 1
frame data/chars/3jack/grab29.gif
@cmd depost 0
@cmd finish 40 1 -2 5.5 0 1
delay 95
@cmd leaper -0.5 4 0
frame data/chars/3jack/grab18.gif
delay 12
frame data/chars/3jack/grab19.gif
attack 0 0 0 0
frame data/chars/3jack/grab20.gif
@cmd clearL
frame data/chars/3jack/grab21.gif
frame data/chars/3jack/grab22.gif
bbox 84 98 47 90
frame data/chars/3jack/grab23.gif
frame data/chars/3jack/grab24.gif
sound data/sounds/mhmh.wav
frame data/chars/3jack/grab23.gif
frame data/chars/3jack/grab24.gif
frame data/chars/3jack/grab23.gif
frame data/chars/3jack/grab24.gif
frame data/chars/3jack/grab23.gif
frame data/chars/3jack/grab24.gif
frame data/chars/3jack/grab23.gif
frame data/chars/3jack/grab24.gif
frame data/chars/3jack/grab22.gif


void slamstart2()
{ // Slam Starter for nongrab slams
// Use finish or throw after using this
void self = getlocalvar("self");
void target = getlocalvar("Target" + self);

if(target==NULL())
{
target = getentityproperty(self, "opponent");
if(target == NULL() || getentityproperty(target, "dead") == 1){
setidle(self);
}else{
setlocalvar("Target" + self, target);
}
}
if(target!=NULL())
{
damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
}
}
 
Last edited:
Since using "grabbing" (instead of "opponent"), I almost don't find any more errors
Code:
target = getentityproperty(self, "grabbing");

I usually combine this with the attack1 function
Code:
anim    attack6
    loop    0
    offset    89 176
    bbox    70 87 40 89
    delay    10
    @cmd    attack1 -90 100 25 "ANI_GRAB"
    frame    data/chars/enemy/wk3.gif


may I see your spawngrab? I've never seen it before. What is its use?
Code:
@cmd    spawngrab
 
Hmmm I use a different slamstart script with target = getentityproperty(self, "grabbing") if the movement start with a previous grab, for example grabbackwards, grabup, etc...
target = getentityproperty(self, "opponent") is used for movements not start with a grab, as this attack6>follow1
Is there a way to make sure that the grabbed player is the one closest to the enemy?

Spawngrab is a function to spawn a "virtual" HP bar that you have to fill by mashing buttons, to free yourself from the grab. I don't think this is related with the problem because the grab occurs a instant before, which is when the teleportation of player 1 occurs:

Captura.JPG

void spawngrab(void vName, float fX, float fY, float fZ,int HPgv, int Num2, int Num)
{ //Spawns.a.grab---set.it.as.child--with.HP.MAX--opponent.plays.follow
//opponent.follow.Num=1jumpback
// Num=2dashlow
//HPgv = amount/time/health -> button press to incress once max is reach grabEscape

void self = getlocalvar("self");
void vSpawn;
vSpawn = spawn02(vName, fX, fY, fZ);

setentityvar(vSpawn, "grabgo", Num2);
setentityvar(self, Num, vSpawn);
changeentityproperty(vSpawn, "maxhealth", HPgv);
changeentityproperty(vSpawn, "parent", self); //Set caller as parent.
return vSpawn; //Return spawn.
}
 
Hmm scripted grabs are tricky to use if you don't know. I tried with slamstart and I also got an error, now I use the grabin of the attack function which is simpler

I've added grabin to attack6 and the grab works ok all the time, apparently. This need more test, but at the moment it seems to work, thanks. I will also review it in the other characters in which it have the same issue.

anim attack6
range 5 90
rangez 5 80
loop 0
delay 14
offset 108 190
bbox 84 98 47 90
followanim 1
followcond 3
hitfx data/sounds/grab.wav
frame data/chars/3jack/grab01.gif
delay 4
move 5
movez 5
grabin 1 10
attack 90 100 75 55 0 0 1 1 8 20
[etc...]
 
Last edited:
I've been thinking about this glitch :unsure: but the best possible reason is the enemy (Jackson from Return of Double Dragon, I believe) hasn't cleared his local variable yet. However, there's clearL function declared in Jackson's FOLLOW1 :oops:.

My other guess is that Jackson's opponent status isn't updated when he started his grab causing the last opponent be grabbed instead of newest one.
ATM I can only suggest 2 ways to fix this:
1. Add script to clear last opponent in Jackson's attack6:
Code:
anim attack6
@script
    if(frame==0){
      void self = getlocalvar("self");
      void Opp = getentityproperty(self,"opponent");

      changeentityproperty(self,"opponent", NULL());
    }
@end_script
range 5 90
rangez 5 80
loop 0
delay 14
offset 108 190
bbox 84 98 47 90
followanim 1
followcond 3
hitfx data/sounds/grab.wav
frame data/chars/3jack/grab01.gif
...

2. Modify slamstart2 to directly acquire last opponent as grabbed target:
Code:
void slamstart2()
{ // Slam Starter for nongrab slams
// Use finish or throw after using this
  void self = getlocalvar("self");
  void target = getentityproperty(self, "opponent");

  if(target == NULL() || getentityproperty(target, "dead") == 1){
    setidle(self);
  } else{
    setlocalvar("Target" + self, target);
  }

  if(target!=NULL()){
    damageentity(target, self, 0, 1, openborconstant("ATK_NORMAL7")); // Slam Starter
  }
}

Try these and tell me the result :)
 
I've tried method 2, wich is more simple, we've played several full stages with multiple enemies doing that kind of grab, and no problem. In the next few days we will continue playing, but for the moment perfect. Thanks! 😻
 
We have played a lot more and we have not observed the error again even with battles composed of 2 players and 5 simultaneous bosses, all of them capable of making grabs that use the slamstart script. I consider the issue resolved, thank you very much @Bloodbane !
 
Back
Top Bottom