May 22, 2019, 07:48:02 AM

Author Topic: [Fixed]xmath without number ?  (Read 481 times)

Offline Drellannor

  • Level 1 Trained Beginner
  • *
  • Posts: 24
  • Country: fr
[Fixed]xmath without number ?
« 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 ?
« Last Edit: December 09, 2018, 06:06:43 PM by Drellannor »

Offline Ayuto

  • Level 2 Apprentice
  • **
  • Posts: 42
  • Country: de
    • Source.Python
Re: xmath without number ?
« Reply #1 on: December 09, 2018, 05:37:24 PM »
Use es_math. Then servrr_var() will also work.

Offline Drellannor

  • Level 1 Trained Beginner
  • *
  • Posts: 24
  • Country: fr
Re: [Fixed]xmath without number ?
« Reply #2 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

Offline Ayuto

  • Level 2 Apprentice
  • **
  • Posts: 42
  • Country: de
    • Source.Python
Re: [Fixed]xmath without number ?
« Reply #3 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.