Juggle system fix

msmalik681

OpenBOR Developer
Staff member
here is a fix for a bug where you can still hit the enemy if your juggle cost is above their juggle points and the first hit wont take the juggle cost away from juggle points.


Code:
void main()
{//juggle system fix by msmalik681
    void self = getlocalvar("self"); //get caller
    void other = getlocalvar("other"); // get the enemy you are attacking
    int jugglecost = getlocalvar("jugglecost"); //get jugglecost of current attack
    int jugglepoints = getentityproperty(other,"jugglepoints"); //get juggle points of enemy
    int maxjugglepoints = getentityproperty(other,"maxjugglepoints"); //get max juggle points of enemy




if(jugglecost!=NULL() && jugglepoints!=NULL() && maxjugglepoints) //if both juggle points and cost present and max juggle points are not zero
	{
		if(jugglecost>jugglepoints)
		{
		changeopenborvariant("lasthitc",0); //cancel last hit if juggle points higher then juggle cost
		}else if(jugglepoints==maxjugglepoints) //if juggle points are max
			{
			changeentityproperty(other,"jugglepoints", jugglepoints-jugglecost); //take the juggle cost away from juggle points
			}
	}}


Save the above code as "ondoattack.c" then declare it with each of your players scripts like this "ondoattackscript data/scripts/ondoattack.c".


Wish I had the ability to fix this directly in the engine on a developer level but hopefully one day I will get there.


for now Happy juggling lol
 
No your scripts.c file handels your animation scripts this can be imported to a seperate file though.
 
Very nice. Thanks for the trick.
It will fix an issue I am having for now, but this is something which should be fixed in the engine itself later. Let's hope the devs find time to fix it.

Thanks.
 
very small update as entity's with no jugglepoints like objects could not be hit with any moves that had jugglecost.
 
@Ilu
I have reviewed the juggle system and I think I understand why the developer made it the way it was.  So if a player character has juggle cost on all their attacks then they will take away from enemies juggle points on every hit.  To limit this they said only connect juggle hits if enemy is falling (hitting someone after they are airborne is a juggle) so if you look at it like this the current system works the way it should.  However I found a bug if you wait for enemy to bounce on the ground you can hit them again causing the juggle points to go into the minus so to fix this I added to the juggle case to hit or miss not only if the enemy is falling but also if they are in the air it has resolved the bug of going into the minus numbers for juggle points.

In the case of my mod I use juggle cost for attacks that either launch the enemy or bounce them so I always want it to subtract from the juggle points so the above script works best for me.

please test this private build and let me know if it resolves any issues.

Download
 
Back
Top Bottom