![]() |
Problem with damages - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Problem with damages (/Thread-Problem-with-damages) Pages: 1 2 |
Problem with damages - Snaigel - 12-19-2019 04:00 PM Hi, I have a weapon with this trigger (because in my server all the weapons damage will work like this) Quote:ON=@Damage 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 ![]() RE: Problem with damages - Snaigel - 12-20-2019 09:14 AM 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> 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?? RE: Problem with damages - Coruja - 12-20-2019 10:42 AM 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] RE: Problem with damages - Snaigel - 12-20-2019 08:03 PM 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 ![]() I honestly think that dividing by SRC.ARMOR in this kind of trigger is just not working in sphere, because the formula is correct RE: Problem with damages - Coruja - 12-22-2019 05:01 AM Debugging is always the best solution to find whats wrong on the code The formula ~seems~ to be correct, but it's returning wrong result, so its wrong. And a simple debug can easily find whats wrong Code: ON=@Hit I just replaced ARGN1 with SAY and removed the "eval", of corse the formula will not work using this, but this will make it print the formula using SAY and will reveal what value is wrong RE: Problem with damages - Snaigel - 12-22-2019 06:43 AM Okay will test it, thanks https://imgur.com/FVYEHXu yeap dividing by zero!! src.armor is wrong? https://imgur.com/FVYEHXu yeap dividing by zero!! src.armor is wrong? RE: Problem with damages - Snaigel - 12-24-2019 02:05 PM Any ideas? ![]() RE: Problem with damages - Coruja - 12-24-2019 04:48 PM That's weird, try use ".xshow armor" and click on the char to check if the value is really 0 Also note that if you have COMBATF_ELEMENTAL_ENGINE combat flag enabled on sphere.ini this will make all chars always have ARMOR=0 and use only RES* properties, so in this case you will have to update the formula to use all 5 <RES*> properties instead <ARMOR> RE: Problem with damages - Snaigel - 12-24-2019 05:33 PM 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) 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 RE: Problem with damages - Coruja - 12-25-2019 04:16 AM RESPHYSICAL is only used when COMBATF_ELEMENTAL_ENGINE is enabled, so maybe it doesn't help because this value is not used on combat (unless you use it manually, like on your custom formula) Anyway, try using <AR> instead <ARMOR> |