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
Damage based on objetive AR
Author Message
Snaigel
Journeyman
*

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



Post: #1
Damage based on objetive AR
So I need help with this thing I want to do:

Quote:ON=@Hit
If (Armor of the objetive is 40 to 50)
SRC.DAMAGE <R33,45>,dam_fixed,<UID>
If (Armor of the objetive is 51 to 60)
SRC.DAMAGE <R30,42>,dam_fixed,<UID>


So the damage changes depending on the objetive's armor. But I don't know how should I code it
02-16-2017 07:55 AM
Find all posts by this user Like Post Quote this message in a reply
Artyk
Journeyman
*

Posts: 75
Likes Given: 43
Likes Received: 9 in 9 posts
Joined: Sep 2014
Reputation: 0



Post: #2
RE: Damage based on objetive AR
I cannot test this at the moment, but it should work
Code:
ON=@Hit
local.armor = <src.armor> + <src.modar>
if ((<dlocal.armor> >= 40) && (<dlocal.armor> <= 50))
SRC.DAMAGE <R33,45>,dam_fixed,<UID>
elseif ((<dlocal.armor> >= 51) && (<dlocal.armor> <= 60))
SRC.DAMAGE <R30,42>,dam_fixed,<UID>
endif
02-16-2017 08:52 PM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #3
RE: Damage based on objetive AR
SRC.ARMOR includes MODAR already, so

local.armor = <src.ar>
should be enough
02-16-2017 11:21 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: #4
RE: Damage based on objetive AR
honestly I think it will be better use a single formula to all damage x armor values instead split the values into IF "ranges"

eg: the weapon damage is always 50 but this value will be lowered by target armor (which could be any value)
Code:
SRC.DAMAGE <eval 50*<SRC.ARMOR>/100> dam_fixed

result:
if weapon damage is 50 and target armor is 65, the final damage will be 50*65/100 = 32
02-17-2017 04:11 AM
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: #5
RE: Damage based on objetive AR
But what if I want it with a random damage value?, should it be like this?:

Quote:SRC.DAMAGE <eval R50,58*<SRC.ARMOR>/100> dam_fixed
02-17-2017 07:58 AM
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: #6
RE: Damage based on objetive AR
rand <Rx,y> must be always used with <> brackets
Code:
SRC.DAMAGE <eval <R50,58>*<SRC.ARMOR>/100> dam_fixed
02-18-2017 01:47 AM
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: #7
RE: Damage based on objetive AR
I tested the formula now and it does more damage as more armor you have, because it multiplies Damage*AR .

Maybe if I try like this?: SRC.DAMAGE <eval <R50,58>/<SRC.ARMOR>*50> dam_fixed


So if the damage is 50 and their armor is 65, it does 38 damage, for example
(This post was last modified: 02-18-2017 04:51 AM by Snaigel.)
02-18-2017 04:44 AM
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: #8
RE: Damage based on objetive AR
I just created this simple (and untested) formula as example, probably it need to be improved

if you want reproduce exactly the same armor calculation used internally on sphere source, it's better just use "SRC.DAMAGE <R50,58>" and let sphere use its default armor calculation. Otherwise if you want a custom formula, there's no right/wrong way to create it. It's pure math, you just need to keep changing the numbers until you find something that fit your needs
02-18-2017 05:47 AM
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: #9
RE: Damage based on objetive AR
Anyway my formula doesn't work either, here <R50,58>/<SRC.ARMOR> , the "/" seems to don't work.

PS: The reason why I'm doing my own formulas is because the armor system on sphere is a F... sh..t , sorry for that bad words. But it calculates like... sometimes you do 0 damage, sometimes you do 6, sometimes you do 30... and I want my special weapons to be more fiable, I don't want them to do always the same damage but at least more regular than that crap of random numbers.
(This post was last modified: 02-18-2017 07:08 AM by Snaigel.)
02-18-2017 06:28 AM
Find all posts by this user Like Post Quote this message in a reply
Catalan_mistral
Journeyman
*

Posts: 54
Likes Given: 2
Likes Received: 6 in 5 posts
Joined: Jan 2017
Reputation: 0



Post: #10
RE: Damage based on objetive AR
Think the trouble is you are going into decimals, believe you need to use floatval

Code:
SRC.DAMAGE <Floatval (<R50,58>) * ((100-<SRC.ARMOR>)/100)> dam_fixed

with the little test I did though only problem there is if the src.armor is over 100 you get negative numbers, give it a try and see if that works, don't know how it will react to a decimal point number. Smile

The One and Only......
(This post was last modified: 02-18-2017 09:00 AM by Catalan_mistral.)
02-18-2017 08:58 AM
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)