using com {input1} {input2} ... {input15} freespecial{#} question

PS_VITA

Active member
Hi guys - for whatever reason I cant get the following com to work

Code:
com	a + a2 D freespecial54
  I'm trying to make it where if the player presses attack 1 and 2 (at the same time) and presses down ( at the same time)
he performs freespecial54.

Now if the above is not possible for whatever reason I can always opt to edit the .c key file  - but I'm unsure of how to properly code it -
so if I could get your help with that also.

Code:
void main()
{
    int  plIndex = getlocalvar("player");
    void vEnt = getplayerproperty(plIndex, "entity");
    void vAniID = getentityproperty(vEnt,"animationID"); //Get current animation ID
    int animpos = getentityproperty(vEnt,"animpos");

    int attack = playerkeys(plIndex, 1, "attack");
    int attackH = playerkeys(plIndex, 0, "attack");	
    int attack2 = playerkeys(plIndex, 1, "attack2");
    int attack2H = playerkeys(plIndex, 0, "attack2");
    int attack3 = playerkeys(plIndex, 1, "attack3");
    int attack3H = playerkeys(plIndex, 0, "attack3");
    int special = playerkeys(plIndex, 1, "special");
    int specialH = playerkeys(plIndex, 0, "special");
    int jump = playerkeys(plIndex, 0, "jump");
    int jumpH = playerkeys(plIndex, 1, "jump");
    int right = playerkeys(plIndex, 1, "moveright");
    int rightH = playerkeys(plIndex, 0, "moveright");
    int left = playerkeys(plIndex, 1, "moveleft");
    int leftH = playerkeys(plIndex, 0, "moveleft");
    int down = playerkeys(plIndex, 0, "movedown");

Than...

Code:
    

if(((attack) || (attack2)) && ((down ))){
      if (vAniID == openborconstant("ANI_WALK")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial54"));
      }
    }

I'm getting a few errors here and there , but I know it's possible - I just keep hitting a wall here.
 
I can see redundant brackets there. But anyways, I'm afraid the script will take different input
Code:
if( (attack || attack2) && down ){

This code means if either Attack1 or Attack2 key is pressed while Down key is pressed the script inside if will be run. That's different than A + A2 D command.

Also it won't work since getting 2 key press event at the same time is impossible. It's best to acquire held event instead with this:
Code:
if( attackH && attack2H && downH ){

with this line too:
Code:
    int downH = playerkeys(plIndex, 1, "movedown");

I am not sure what you mean by errors. I can't pinpoint the cause either since the script is only partially shown.
 
Okay I will try your suggestions - and what is the H for at the end of down - example downH?

And the errors I had where on the scriptlog for openbor - just unknown errors probably due to the extra brackets in my code.

Thank you again , I will test this later.

EDIT: Oh and from the manual -- what did you mean by it's impossible

This is from the manual I found - does this not mean that both attack1 & 2 can be pressed at the same time

    {input1} now accepts "+" to add mutiple commands. Examples:

a + a2
u + f a
u + f -> a
"->" symbol useful just for better reading

Hence I was trying A + A2 D command - Does this command not translate to - if the player presses attack1 & 2 ( at the same time) and presses down, then freespecial# will happen?
 
If I'm not mistaken, OpenBoR can only acquire one key press event at a time. Therefore when there are 2 or more key press events, OpenBoR acquires the first one, then next one and so on. So acquiring multiple events is impossible.

That's why when coding dual key press like this, it's best to do it like this: store the 1st key press event in global variable then when second event occurs, previous key press is acquired from that variable instead.
Alternatively, you can acquire held state instead which lasts longer, which is what I've suggested above.
 
Bloodbane & PS VITA

It's a bit more complex than that. The engine can simultaneously read 32 inputs at once per player, more than twice the actual number of inputs available (15). The only real limit is your hardware. Most game controllers are designed to read all their inputs at once, but keyboards may have limits to how many concurrent key inputs they can physically detect.

The real trick is events - one key press causes one script event, so it's impossible to detect the initial press of two keys at the same time with a script. But this is true in pretty much every language. Which works out fine since even if you could perfectly detect a simultaneous press with one event, it would never work because it's not possible for humans to perfectly press two or more keys at once.

They way coders handle this is they double up their checks. Example: In games like Final Fight, when Attack is pressed, the state of Jump is checked and if it's on, you do a Special - but they ALSO check the other way. When a Jump press is pressed, Attack state is verified and if it's on, you do the special. Additionally, they can and often do add timers to keep you honest. One variable holds the time of Key A's initial detection, and when Key B event fires, Key A's time is compared. If the time falls outside a specified limit (usually 0.5 seconds), the multi-press action doesn't activate. Timers are also how series commands like OpenBOR freespecial commands, Street Fighter special moves, and codes (Konami Code) work.

Fortunately, OpenBOR Script can do all these things. So to sum it up, if you want your multi-key presses to be reliable, you just need write a more robust detection routine like the pros do.

I might also add that some professional games do not have a double check, but as a player and not a creator you just never really thought about it. Ever notice how unreliable the Back Attack is in SOR2? That's because it's only coded in one direction. Initial press of the Jump button checks state of Attack, but not the other way. You can see this in action by holding Attack, then pressing Jump at your leisure. There's no limiting timer either, so you can just hold Attack and keep tapping Jump to do as many Back Attacks as you like. If you have fast enough fingers, it's possible to experiment and see how other games handle their multi-press inputs. Ex: IIRC, Final Fight is coded in both directions with a 0.5 second timer.

DC
 
Wow, that was a great read... If I recall I remember watching a zelda lttp speed run where a snes modded controller was able to press up and down at the same time allowing link to glitch and go through solid walls when going up the stairs.

Thanks again
 
Hi guys,

I'm using COM F D F A2 freespecial30
and it works great, however how can I make it so that the first F can be held down and it would work also perform freespecial30? Because if I'm holding forward as I'm walking forward and try to do down forward A2 it wont work I have to let go of F and than do it exactly like F D F.



 
Back
Top Bottom