The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parrying new formula
Author Message
Snaigel
Journeyman
*

Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0



Post: #1
Parrying new formula
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
12-26-2019 07:06 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #2
RE: Parrying new formula
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
(This post was last modified: 12-27-2019 12:54 PM by Coruja.)
12-27-2019 12:50 PM
Find all posts by this user Like Post Quote this message in a reply
Snaigel
Journeyman
*

Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0



Post: #3
RE: Parrying new formula
Awesome, thank you very much
12-27-2019 02:49 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)