Simulate jump from obstacle/enemy

NED

Well-known member
I want to simulate jump from obstacle/enemy using attack box.
I create a new thread to gather ideas about how can this mechanic can be implemented in Openbor mods.

-You can see obstacle jump in Final Fight 1 (Guy uses it)
-In his AOF mod JonSilva make Ryo using it. jump from enemies (Alien Vs Predator style)
Ryo make it with command "UP + attack"

Actually I did some try myself.
-The idea is to have a cancel attack from regular jump. (the imput is "J")
-This attack is a clone of jump anim (from mid air anim part)
But it have an attackbox sending player to the actual jump in opposite direction. (some follow anim)

The system seems OK to me.
But because the command is "J" it sometimes cancels with no reason just by jumping
I would like to keep this commant to make it consistent with wall and edge jump too.

Any idea how to make it working better?
Thanks

If this feature finally works, it can be added to several mods with wall jump system.
 
You should use a keyscript based solution then. This way the jump cancel will trigger only if there is a new jump key press, which is not guaranteed with the cancel command.
 
Thanks.
I tried this way, but the problem seems the same.

script:
Code:
void keyint(void Ani, int Frame, void Key, int Hflag, int Limit)
{// Change current animation if proper key is pressed or released provided HP is more than limit (J'ai ajouté A3 et A4 dispo)
    void self = getlocalvar("self");
    void Health = getentityproperty(self,"health");    
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

      if (Key=="U"){ //Up Required?
       iRKey = playerkeys(iPIndex, 0, "moveup"); // "Up"
	}

      if (Key=="D"){ //Down Required?
        iRKey = playerkeys(iPIndex, 0, "movedown"); // "Down"
	}

      if (Key=="J"){ //Jump Required?
        iRKey = playerkeys(iPIndex, 0, "jump"); // "Jump"
	}

      if (Key=="A"){ //Attack Required?
        iRKey = playerkeys(iPIndex, 0, "attack"); // "Attack"
	}

      if (Key=="S"){ //Special Required?
        iRKey = playerkeys(iPIndex, 0, "special"); // "Special"
	}

      if (Key=="A2"){ //Attack2 Required?
        iRKey = playerkeys(iPIndex, 0, "attack2"); // "Attack2"
	}

      if (Key=="A3"){ //Attack3 Required?
        iRKey = playerkeys(iPIndex, 0, "attack3"); // "Attack3"
	}

      if (Key=="A4"){ //Attack4 Required?
        iRKey = playerkeys(iPIndex, 0, "attack4"); // "Attack4"
	}

      if (Key=="UJ"){ //Up and Jump Required?
        iRKey = playerkeys(iPIndex, 0, "moveup", "jump"); // "Up" + "Jump"
	}

      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
	}

      if ((Health > Limit)&&iRKey){
        changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
        changeentityproperty(self, "animpos", Frame);

        if (Key=="UJ"){ 
          // This is copy of dethrown
          changeentityproperty(self, "attacking", 0);
          changeentityproperty(self, "damage_on_landing", 0);
          changeentityproperty(self, "projectile", 0);
        }
      }
}

in the anim:
Code:
@cmd    keyint "ANI_FOLLOW51" 0 "J" 1 0#{animation} {frame} {key} {hold0/release1} {minhealth}

With this methos, it seems to work but.
As soon as I did this move 1 time by pressing J during the jump.
It triggers on every next jump I do even without doing the imput again. :/
 
This function is an animationscript event function not a keyscript event function. Plus it checks if key is held, not if there is a new key press (which is impossible to do in a reliable way just using animationscript).

What you need is make use of either keyscript, key# {1,2,3,4} or keyall script event.

You can create your own setup (if name, if animation, if newKey, then jump cancel) or use the cancel system I developped for example ( http://www.chronocrash.com/forum/index.php?topic=2466 ).
 
Thanks again!
I really like your cancel system, but this is far too much for me to handle.

Is there a simple exemple of keyall script or key script I could use to do make my version?
 
iRKey = playerkeys(iPIndex, 1, "jump"); // "Jump"

give that a try in your keyscript the number you had "0" means holding "1" means pressed and "2" means released if 1 is not working for you try 2 !
 
I tried something like that in animation script :

Code:
void keyint2(void Ani, int Frame, void Key, int Hflag, int Limit)
{// Change current animation if proper key is pressed or released provided HP is more than limit (J'ai ajouté A3 et A4 dispo) PRESSED-----
    void self = getlocalvar("self");
    void Health = getentityproperty(self,"health");    
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

      if (Key=="U"){ //Up Required?
       iRKey = playerkeys(iPIndex, 1, "moveup"); // "Up"
	}

      if (Key=="D"){ //Down Required?
        iRKey = playerkeys(iPIndex, 1, "movedown"); // "Down"
	}

      if (Key=="J"){ //Jump Required?
        iRKey = playerkeys(iPIndex, 1, "jump"); // "Jump"
	}

      if (Key=="A"){ //Attack Required?
        iRKey = playerkeys(iPIndex, 1, "attack"); // "Attack"
	}

      if (Key=="S"){ //Special Required?
        iRKey = playerkeys(iPIndex, 1, "special"); // "Special"
	}

      if (Key=="A2"){ //Attack2 Required?
        iRKey = playerkeys(iPIndex, 1, "attack2"); // "Attack2"
	}

      if (Key=="A3"){ //Attack3 Required?
        iRKey = playerkeys(iPIndex, 1, "attack3"); // "Attack3"
	}

      if (Key=="A4"){ //Attack4 Required?
        iRKey = playerkeys(iPIndex, 1, "attack4"); // "Attack4"
	}

      if (Key=="UJ"){ //Up and Jump Required?
        iRKey = playerkeys(iPIndex, 1, "moveup", "jump"); // "Up" + "Jump"
	}

      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
	}

      if ((Health > Limit)&&iRKey){
        changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
        changeentityproperty(self, "animpos", Frame);

        if (Key=="UJ"){ 
          // This is copy of dethrown
          changeentityproperty(self, "attacking", 0);
          changeentityproperty(self, "damage_on_landing", 0);
          changeentityproperty(self, "projectile", 0);
        }
      }
}

but it don't seem to work either.
 
Sorry friend, I didn't get to work on it more when I got home due to setting up my new laptop. I'm off to bed, but it's very close. Should be able to finish up in the morning.

DC
 
nedflandeurse said:
I tried something like that in animation script :
...
but it don't seem to work either.

That's because in order for it to work, player must be pressing the key EXACTLY at same time when the function is run. The chance for this to occur is very very very low thus unreliable. That's why keyscript is preferred when it comes to pressing and releasing key events
 
just read back and noted your using animation script so try to copy the below text to your scripts folder as keyall.c (no need to declare it in players header it applies to all players).  in the example I am presuming your head stomp animation is "FREESPECIAL5" you can change as needed.


void main()//keyscripts
{
    int iPlIndex = getlocalvar("player"); //Get calling player
    void vSelf = getplayerproperty(iPlIndex , "entity"); //Get calling entity
    void vAniID = getentityproperty(vSelf,"animationID"); //Get current animation ID
    void vAniPos = getentityproperty(vSelf, "animpos"); //Get current animation frame
    int iDir = getentityproperty(vSelf, "direction");  //Get current facing direction
    int x = getentityproperty(vSelf, "x");
    int y = getentityproperty(vSelf, "a");
    int z = getentityproperty(vSelf, "z");

    void iUp = playerkeys(iPlIndex, 1, "moveup"); // New key status of "Up"
    void iDown = playerkeys(iPlIndex, 1, "movedown"); // New key status of "Down"
    void iLeft = playerkeys(iPlIndex, 1, "moveleft"); // New key status of "Left"
    void iRight = playerkeys(iPlIndex, 1, "moveright"); // New key status of "Right"
    void iJump = playerkeys(iPlIndex, 1, "jump"); //New key status of "Jump"
    void iJumpR = playerkeys(iPlIndex, 2, "jump"); //New key status of "Jump"
    void iSpecial = playerkeys(iPlIndex, 1, "Special"); //New key status of "Special"
    void iAttack = playerkeys(iPlIndex, 1, "attack"); //New key status of "Attack"
    void iAttack2 = playerkeys(iPlIndex, 1, "attack2"); // New key of "Attack 2"
    void iAttack3 = playerkeys(iPlIndex, 1, "attack3"); // New key of "Attack 3"

    if(vAniID == openborconstant("ANI_FORWARDJUMP") || vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_RUNJUMP")){
    if(iJump){ // if this is not working try (iJumpR)
changeentityproperty(vSelf, "animation", openborconstant("ANI_FREESPECIAL5"),0);
      }
    }
}


I am sure DC will come up with a better solution but this worked for me.
 
Thanks guys, I really appreciate your support, I think I'll wait for DC script.
There is certainly and effective way to do it.

Damon Caskey said:
Sorry friend, I didn't get to work on it more when I got home due to setting up my new laptop. I'm off to bed, but it's very close. Should be able to finish up in the morning.

DC

No problem DC,
Just do it when you're OK.
 
nedflandeurse said:
Thanks guys, I really appreciate your support, I think I'll wait for DC script.
There is certainly and effective way to do it.

Damon Caskey said:
Sorry friend, I didn't get to work on it more when I got home due to setting up my new laptop. I'm off to bed, but it's very close. Should be able to finish up in the morning.

DC

No problem DC,
Just do it when you're OK.

Argh, I was gone all weekend and now I'm run over again. I'll get it done for you though, sorry for the wait. It's not a matter of making it work - I've had a wall jump script for years. It's making it self contained and not dependent upon a bunch of other scripts so that you can just plug it into your module.

DC
 
It's OK friend.
I can understand it.

I imagined aswell how I could export code elements and scripts to future other mods I have in my mind.

Anyway, thanks for taking the time to give it a try.

 
I have a little more time for 3 days, so I tried to update the jump on obstacle jump on enemy system.

I resolved the imput problem (my major problem) Imput "J" during jump.
I resolved it by making the cancel possible later on jump anim.

It works perfectly!

Only one thing to have it 100% working.
I need to send player to existing jump anim and desired velocity.

Something like that:
-JUMP
-jump attack (stomp attempt)
-on move hit go to followanim (anim of clinch player) (no velocity)
-turn an return to jump anim

I need help for this green part.
And also red part

I could easily recreate a clone of jump anim, but it's a waste of anims and it can cause compatibility problems later. So I really would like to cancel to actual jump anim.

Thanks

EDIT : the move is fully fonctionnal for jump forward. I will implement it to regular jump and run jump.

Only one thing to fix.
How can I stop any gravity velocity for first frame of an anim? :-\
With that, the system will be completed
 
After testing again.
Charcter still seems to slide down a little during the first frame of alimation.

Please, how can I stabilize it to have all kind of velocity stopped for 1st frame only?
 
That won't work - there are too many stability issues. That's why it takes a complete system. Please let me get mine uploaded.

DC
 
Back
Top Bottom