Warcraft-Source

General Content => Bug reports => Other bugs => Topic started by: Drellannor on December 09, 2018, 04:45:09 PM

Title: [Fixed]xmath without number ?
Post by: Drellannor on December 09, 2018, 04:45:09 PM
Hello here,

I'm trying to make a lifesteal % based on the player dmg done, growing with levels but it seems letters aren't allowed in the calculation.
For example :

es_set wcs_dmg event_var(dmg_health)
es_xmath wcs_dmg float
es_xmath wcs_dmg / 100
es_xmath wcs_dmg / server_var(wcs_lifesteal)
es wcs_decimal wcs_dmg server_var(wcs_dmg)

If the wcs_lifesteal is 20, the value should be 20% of the damage done to the victim, but the number in game is always 1.
I firstly tought my wcs_lifesteal were bugged, but with few test it seems i can't use a server_var in the xmath.
If you try to xmath something by a thing write in letter and not number, the script seems to basically ignore it or put default value to 1.
I think it was used few times in the old warcraft-source 0.77 but don't seems to work in the 0.78 version.

i'm actually using a different way to make the script working but it have to be wrote for each specific race using this lifesteal, a bit boring way to make it work atm.

Any tips ?
Title: Re: xmath without number ?
Post by: Ayuto on December 09, 2018, 05:37:24 PM
Use es_math. Then servrr_var() will also work.
Title: Re: [Fixed]xmath without number ?
Post by: Drellannor on December 09, 2018, 06:07:43 PM
Thank you for your answer Ayuto, this script is now working.
What's the difference between es_math and es_xmath ? Why 2functions were created ? Just a curious question :D
Title: Re: [Fixed]xmath without number ?
Post by: Ayuto on December 09, 2018, 06:30:41 PM
All commands starting with an x don't expand server_var and event_var. It's a matter of performance tweaking.