Snaigel
Journeyman
Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0
|
Problem with damages
Hi, I have a weapon with this trigger (because in my server all the weapons damage will work like this)
Quote:ON=@Damage
SRC.DAMAGE <eval <R250,310>/<SRC.ARMOR>*10>
So it should calculate the damage with that formula: 250,310 divided by armor, for example 100, and then multiplied by 10: like this the final damage would be: 25 to 31 to a player or npc with 100 armor.
It seems to work as I want but with a problem: I still get some random numbers like 7, 9 etc, just sometimes, like some skill or something is interfering.. maybe parrying or tactics or even the armor?
Is there something I can write in the trigger so it ignores ANYTHING else?
Thanks in advance
|
|
12-19-2019 04:00 PM |
|
|
Snaigel
Journeyman
Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0
|
RE: Problem with damages
Nevermind, I changed it to ON=@Hit trigger and put it on an event, because otherwise it doesn't work, But only works if I simply put:
Quote:SRC.DAMAGE <R250,310>
//succesfully does 250 to 310 damage
but when I write formulas like
Quote:<eval <R250,310>/<SRC.ARMOR>*10>
or
<floatval <R250,310>/<SRC.ARMOR>*10>
any of this works, it never divides, I tried a lot of combinations and only multiplies (killing the npc im testing with, because I do tons of damage)
So annoying, I just cant make this ultra mega simple formula work....
EDIT: After a lot of tests I'm pretty sure I am writing the formula in a wrong way, symbols not in right place etc or not the right symbols. Can someone help??
(This post was last modified: 12-20-2019 09:53 AM by Snaigel.)
|
|
12-20-2019 09:14 AM |
|
|
Coruja
Sphere Developer
Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7
Dimension Shard
|
RE: Problem with damages
Usually all percentage formulas are calculated using "muldiv" order (multiply -> divide) and not divide -> multiply. Both formulas should work, as 250/50*10=50 is the same of 250*10/50=50, but using proper order will return more precise results
Also note that @Damage on weapon is called when the weapon got damaged (receive damage) and not when it cause damage. It was also called at the hit moment because when you hit someone with the weapon, this will also make the weapon get damaged (lose durability). But to deal with ~hit~ damages you must use char trigger @Hit and not the item trigger @Damage
And after use combat formula calculate the damage, sphere will also calculate the resist. So you're using a custom damage formula that already apply the resist, but later sphere will also apply the internal resist formula again. To avoid this 2nd resist formula you must set the flag dam_fixed on @Hit, this will make sphere skip next formulas like bonus damage, resist calculation, etc
So to get the best result, you should probably use something like this
Code:
[EVENT e_char_trigger]
ON=@Hit
ARGN1 = <eval (<R250,310>*10)/<SRC.ARMOR>> // damage value
ARGN2 |= dam_fixed // damage flags
|
|
12-20-2019 10:42 AM |
|
|
Snaigel
Journeyman
Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0
|
RE: Problem with damages
Thanks for the answer. I tried it and it is still not dividing by the armor of the NPC that I'm trying with, only multiplying. I tried with your formula and also the ones I tried before but using mul and then div.
I know it's not dividing because I kill the test NPC in a single blow, which shouldn't happen with that formula because the NPC has 500hitpoints and 100 armor and that formula should do 25 to 31 dmg to a NPC with 100 armor. I checked the NPC stats and it's correct . Idk what is happening
I honestly think that dividing by SRC.ARMOR in this kind of trigger is just not working in sphere, because the formula is correct
(This post was last modified: 12-20-2019 08:16 PM by Snaigel.)
|
|
12-20-2019 08:03 PM |
|
|
Snaigel
Journeyman
Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0
|
RE: Problem with damages
(This post was last modified: 12-22-2019 06:53 AM by Snaigel.)
|
|
12-22-2019 06:43 AM |
|
|
Snaigel
Journeyman
Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0
|
RE: Problem with damages
Yes!! when I use "xshow armor" it says the objetive has "0" armor.
I think I don't have COMBATF_ELEMENTAL_ENGINE enabled in sphere.ini
Quote: // Extra combat flags to control the fight (default:0, 0.55i compatible)
// COMBATF_NODIRCHANGE 00001 // Not rotate player when fighting (like was in 0.51a)
// COMBATF_FACECOMBAT 00002 // Allow faced combat only (recommended)
// COMBATF_PREHIT 00004 // Allow prehit for close combat. first hit is instant (delay 0.1sec)
// COMBATF_ELEMENTAL_ENGINE 00008 // Use DAM*/RES* to split damage/resist into Physical/Fire/Cold/Poison/Energy (AOS) instead use old AR (pre-AOS)
// COMBATF_MAXITEMDURABILITY 00010 // Make damageable items get destroyed when lose max durability instead current durability
// COMBATF_DCLICKSELF_UNMOUNTS 00020 // Unmount horse when dclicking self while in warmode
// COMBATF_ALLOWHITFROMSHIP 00040 // Allow attacking opponents from ships
// COMBATF_NOPETDESERT 00080 // Allow pet owner attack own pet without make it desert its owner
// COMBATF_ARCHERYCANMOVE 00100 // Allow firing bow while moving
// COMBATF_STAYINRANGE 00200 // Abort attack swing when out of range instead of waiting to come back in range
// COMBATF_ATTACKONNOTICE 00400 // Make target instantly attack back when notice someone trying to attack it
// COMBATF_NPC_NOATTACKMSG 00800 // Disable *is attacking* message on NPCs
// COMBATF_STACKARMOR 01000 // If a region is covered by more than one armor part, all AR will count
// COMBATF_NOPOISONHIT 02000 // Disables old (55i like) poisoning style (0~100% chance based on Poisoning skill for monsters, or 50% chance for poisoned weapons)
//CombatFlags=02|020|080|0400|02000
Tried with RESPHYSICAL, and now it works and does the maths properly!!. This works for me as an alternative if I can't fix the ARMOR problem, so you helped a lot
|
|
12-24-2019 05:33 PM |
|
|