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
Changing the damage calculation
Author Message
AmpereJoule
Journeyman
*

Posts: 59
Likes Given: 7
Likes Received: 0 in 0 posts
Joined: Dec 2012
Reputation: 0



Post: #1
Changing the damage calculation
Hello,


I need the damage equation to be:

"damage_received = enemy_damage - player_armor"
or
"damage_dealt = player_damage - enemy_armor"

and

"magic_damage_received = enemy_magic_damage + player_armor"
or
"magic_damage_dealt = player_magic_damage + enemy_armor"


Where do I change it? How?


ps: Is "armor" a value or is it percentage?


Thank you.
(This post was last modified: 09-12-2013 12:28 PM by AmpereJoule.)
09-12-2013 12:19 PM
Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #2
RE: Changing the damage calculation
Armor is a bastard and isn't percentage but just a value. I hate the HC calculation too Smile I guess you'll have to rescript it in player and npc triggers(gethit, hit..)? But I'm not sure, it's pretty complicated that way. Actually the calculation already works as you say... received damage = rand<damage dealt - enemies armor> (told me darksun once Tongue). But the magic damage should go through the triggers again and then you must block the damage, calculate the one you want(reduced by armor) and damage the enemy with that.

But there must be better way. I hope somebody knows it and tell us.
(This post was last modified: 09-12-2013 06:16 PM by Alaric.)
09-12-2013 06:06 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: Changing the damage calculation
it was newdamage = rand(damage-AR ,damage) , if newdamage <=0 no dfamage at all Shock

I actually like the formula Shock
09-12-2013 08:28 PM
Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #4
RE: Changing the damage calculation
(09-12-2013 08:28 PM)darksun84 Wrote:  it was newdamage = rand(damage-AR ,damage) , if newdamage <=0 no dfamage at all Shock

I actually like the formula Shock
Ye, that's it. sry Smile
09-12-2013 09:39 PM
Find all posts by this user Like Post Quote this message in a reply
AmpereJoule
Journeyman
*

Posts: 59
Likes Given: 7
Likes Received: 0 in 0 posts
Joined: Dec 2012
Reputation: 0



Post: #5
RE: Changing the damage calculation
(09-12-2013 06:06 PM)Alaric Wrote:  Armor is a bastard and isn't percentage but just a value. I hate the HC calculation too Smile I guess you'll have to rescript it in player and npc triggers(gethit, hit..)? But I'm not sure, it's pretty complicated that way. Actually the calculation already works as you say... received damage = rand<damage dealt - enemies armor> (told me darksun once Tongue). But the magic damage should go through the triggers again and then you must block the damage, calculate the one you want(reduced by armor) and damage the enemy with that.

But there must be better way. I hope somebody knows it and tell us.


yeah, i hope someone tell me which line and .scp to change.

But I am using "notepad++" and looking for these you said \o\.

(09-12-2013 08:28 PM)darksun84 Wrote:  it was newdamage = rand(damage-AR ,damage) , if newdamage <=0 no dfamage at all Shock

I actually like the formula Shock


Is that the damage calculation?

I am looking for it right now!

darksun,


I searched "rand(" and it find lots of it, but none as "newdamage = rand(damage-AR ,damage)".

I also searched "newdamage" and it find nothing in my scripts.

Can you tell me where is it?

****EDIT****
Does it count "ARMOR" or "TAG.ResPhysical"? (i prefer ARMOR, and my sphere.ini don't have any events in "events to all players" or "events to all NPCs" (it means that there is not elemental damage, right?))
ANSWER: It does count "TAG.ResPhysical". (So, I put "//" after the "ARMOR=300" line in my script)
****END EDIT****
(This post was last modified: 09-12-2013 10:10 PM by AmpereJoule.)
09-12-2013 09:51 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: Changing the damage calculation
Well it's not an "official " formula , i just figured it by doing a lot of tests Tongue
09-12-2013 10:47 PM
Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #7
RE: Changing the damage calculation
Ampere, you have to script the events and give players and npcs the triggers. Forever.
(This post was last modified: 09-12-2013 10:52 PM by Alaric.)
09-12-2013 10:52 PM
Find all posts by this user Like Post Quote this message in a reply
AmpereJoule
Journeyman
*

Posts: 59
Likes Given: 7
Likes Received: 0 in 0 posts
Joined: Dec 2012
Reputation: 0



Post: #8
RE: Changing the damage calculation
(09-12-2013 10:52 PM)Alaric Wrote:  Ampere, you have to script the events and give players and npcs the triggers. Forever.

Why? I don't want the Elemental damage.

I only want as I said.

Magic_damage = Magic + Armor

Physical_damage = Damage - Armor


Isn't the events only for elemental damages?
09-12-2013 11:06 PM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #9
RE: Changing the damage calculation
Go to sphere.ini and set on EventsPlayer=E_COMBAT
PHP Code:
[EVENTS E_COMBAT]
ON=@SPELLEFFECT
IF <SERV.SPELL.<ARGN1>.FLAGS> & SPELLFLAG_DAMAGE
 TAG
.HITBYSPELL 1
ENDIF

ON=@GETHIT
IF <dTAG.HITBYSPELL>
 
ARGN1 += <ARMOR>
 
TAG.HITBYSPELL
ELSE
 
ARGN1 -= <ARMOR>
ENDIF
IF <
dARGN1> <= 0
 ARGN1 0
ENDIF
ARGN2 01 

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
(This post was last modified: 09-13-2013 02:57 AM by Extreme.)
09-13-2013 02:37 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #10
RE: Changing the damage calculation
There are problems with that code example that Extreme posted:

Player A casts clumsy (which has spellflag_harm but not spellflag damage) on player B
Player B gets TAG.HITBYSPELL=1 but because no damage was dealt, @GetHit is not triggered
Player C walks over and hits Player B with a sword
Player B still has TAG.HITBYSPELL=1 so the sword hit results in the "magic damage calculation" instead of "physical damage"
09-13-2013 02:53 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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