Solved How to make player turn during combo?

Question that is answered or resolved.

mulambo

Member
As title says... in Final Fight (MAME or Snes/GBA, etc..) the player can turn during combo, so he can hit the enemy who's on the opposite side during the execution of a combo. In simple words, I just want the player to turn during any attack of a combo by pressing backward (well, if for example I want player to hit attack1 on the right, by pressing backward before doing attack2 he has to turn to the other side and hit attack2 on the left.. and viceversa)
 
"Flipframe" flips entity in designated frame, perhaps you can set a "cancel" (with the back key) in your combo attack sets, which will then go to a freespecial that has flipframe in first frame before attack frames.

Then in that freespecial have more cancels that lead to other freepecials which are copies of the consecutive remaining attack sets of combo, this will enable you to continue a combo like system.

You can set multiple "cancel" in an anim, so for each different movement in your combo you can cancel to a specific attack (that has flipframe in your case).
 
isn't there a simpler code I can put into each attack ? I don't know how to cancel a move to a freespecial, and I wonder if that freespecial is so necessary (sounds too complex), I'd just want him to flip on the other side when the back button is pressed
 
For this purpose, you'd need script
If you're not familiar with animationscript, try adding this script in attack animations like this:
Code:
anim	attack1
@script
    void self = getlocalvar("self");
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index

    if(playerkeys(iPIndex, 0, "moveleft")){ // Left is pressed?
      changeentityproperty(self, "direction", 0); //Face left
    } else if (playerkeys(iPIndex, 0, "moveright")){ // Right is pressed?
      changeentityproperty(self, "direction", 1); //Face right
    }
@end_script
...

I don't include the rest of ATTACK1 animation cause it doesn't matter
This script simply turns player left if left is pressed or right if right is pressed
 
There are no significant difference between scripts used in text file like above than ones called from animation script
The one I posted above was actually from this function:
Code:
void keyflip(int Inv)
{// Change hero's facing direction if left or right is pressed
    void self = getlocalvar("self");
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index

    if (Inv == 0){
      if (playerkeys(iPIndex, 0, "moveleft")){ // Left is pressed?
        changeentityproperty(self, "direction", 0); //Face left
      } else if (playerkeys(iPIndex, 0, "moveright")){ // Right is pressed?
        changeentityproperty(self, "direction", 1); //Face right
      }
    } else if (Inv == 1){
      if (playerkeys(iPIndex, 0, "moveleft")){ // Left is pressed?
        changeentityproperty(self, "direction", 1); //Face right
      } else if (playerkeys(iPIndex, 0, "moveright")){ // Right is pressed?
        changeentityproperty(self, "direction", 0); //Face left
      }
    }
}

I simplified it and adjusted it to work on animation
 
Bloodbane said:
There are no significant difference between scripts used in text file like above than ones called from animation script

Noted well @BB, I just feel it easier to have the scripts in the animations, but you make sense. It would be easier to call scripts from external, I will have to learn how to add different logic loops into one file without messing it up..

mulambo said:
done as said, returned this error on log:
Code:
line 19: Invalid function call or expression 'anim' (in production 'postfix_expr2')

Bloodbane will know best what went wrong @Mulambo, sorry for going off topic in your post, I am also learning much about openbor, lol especially scripting...
 
Glitch said:
Bloodbane said:
There are no significant difference between scripts used in text file like above than ones called from animation script

Noted well @BB, I just feel it easier to have the scripts in the animations, but you make sense. It would be easier to call scripts from external, I will have to learn how to add different logic loops into one file without messing it up..

mulambo said:
done as said, returned this error on log:
Code:
line 19: Invalid function call or expression 'anim' (in production 'postfix_expr2')

Bloodbane will know best what went wrong @Mulambo, sorry for going off topic in your post, I am also learning much about openbor, lol especially scripting...
No problem, I just hope there's a way to achieve that without scripting since it's a more complex way, too much for a beginner
 
How did you encounter with that problem? Did you copy the one from @script all the way down to @end_script? If you didn't copy all from @script to end_script, then that means you have some error. Could you show your code on what or how you did?
 
maxman said:
How did you encounter with that problem? Did you copy the one from @script all the way down to @end_script? If you didn't copy all from @script to end_script, then that means you have some error. Could you show your code on what or how you did?
I've actually removed it now, but yes I had placed it where "here" appears below:

Code:
anim attack1 
	loop	0
	delay	5
	bbox	44 36 18 77
	offset	48 111
	frame	data/chars/guy/a1011.gif
        delay   6
        attack  61 19 50 50 8
	frame	data/chars/guy/a102.gif
HERE
        attack  0 0 0 0 0  
	frame	data/chars/guy/a101.gif


anim attack2
	loop	0
	delay	8
	bbox	47 46 24 66
	offset	48 111
	frame	data/chars/guy/a201.gif
        attack  54 37 58 40 10
        delay   19
	frame	data/chars/guy/a202.gif
        delay   4
        attack  0 0 0 0 0  
HERE
	frame	data/chars/guy/a2021.gif
        delay   4
	frame	data/chars/guy/a201.gif

As you see I thought that the script "ran" when the attack was 0 (so the player can't just use back/forward to flip in awkward way, but only after the attack has actually it). I actually ready to not use it as I thought that it could be a pro, but if it can be achieved without scripts, it's better (because it's not the first time scripts seem to make the game crash, maybe too early for my stage of development). thanks anyway
 
??? Why removed it? You should've shown what you had before you removed it. I'm not angry or pissed. I just don't understand why you removed it. However, I can see that you're afraid of putting scripts because you thought it would cause a crash (and of the look of it). I had that thought before and I was afraid of it like you (even though I always wanted to learn scripts). Don't worry. You can learn scripts later, but for now, you can copy this one.

Code:
anim attack2
@script
    void self = getlocalvar("self");
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index

    if(playerkeys(iPIndex, 0, "moveleft")){ // Left is pressed?
      changeentityproperty(self, "direction", 0); //Face left
    } else if (playerkeys(iPIndex, 0, "moveright")){ // Right is pressed?
      changeentityproperty(self, "direction", 1); //Face right
    }
@end_script
	loop	0
	delay	8
	bbox	47 46 24 66
	offset	48 111
	frame	data/chars/guy/a201.gif
        attack  54 37 58 40 10
        delay   19
	frame	data/chars/guy/a202.gif
        delay   4
        attack  0 0 0 0 0 
	frame	data/chars/guy/a2021.gif
        delay   4
	frame	data/chars/guy/a201.gif

I don't know how you want when your player turns around during combo. But I put that script in anim attack2 because I thought of Cody doing the second combo attack as he turns to a different direction by pressing left or right, depending on where he's facing. In that code above, you can turn to an opposite side by pressing left or right during the second combo attack (anim attack2).

Scripts never cause crashes in the engine unless you make errors on scripts. (It's not the engine's fault, it's a human error.) If they're the right ones, they don't crash at all. Try not to be afraid of scripts. We're here to help. We can point out what's right and what's wrong.
 
Back
Top Bottom