SphereCommunity

Full Version: Parrying new formula
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Bye So I want to change the parrying chance to block attacks with my own formula. I'm doing it with the ON=@UseQuick trigger in sphere_skills.scp

And in summary would be:

With shield: 1,5% chance to block an attack for each 10.0 points of parrying, or 0,15% for each 1.0 for a more optimal formula (15% at 100.0 parrying)
Without shield: 0,75% chance to block an attack for each 10.0 points of parrying, (7,5% at 100.0 parrying)

But I don't know how to full make it, this is the only things I think I know how to code:

Quote:IF (rand(100) < 7.5 or 7,5) //chance at 100.0 parrying without shield
<ARGN3> //Parry succesful if rand 7.5%, when you use return 2 you need to use ARGN3 as I readed in the wiki
RETURN 2 //return with skill gain

Let's see if some scripters want to contribute with their grain of sand so I can figure out the rest of the script Rolleyes
Usually you just need a simple formula and return 0 (fail) or 1 (success), but @UseQuick is a bit tricky because using return 0/1 will skip skillgain, so you have to use return 2 to proceed with default internal action (skillgain) and deal with ARGN2 (action difficulty) / ARGN3 (force success/fail)

Code:
ON=@UseQuick
IF (<FLAGS> & statf_hasshield)
  ARGN2 = <eval (<PARRYING> * 150) / 1000>
ELSE
  ARGN2 = <eval (<PARRYING> * 75) / 1000>
ENDIF

IF (<ARGN2> > <R1000>)
  ARGN3=1   //tell internal functions that the action has succeed
ELSE
  ARGN3=-1  //tell internal functions that the action has failed
ENDIF
return 2
Awesome, thank you very much
Reference URL's