Page 1 of 1

[1307.2] unit.currentExhaustion/maxExhaustion not mutable in Lua

Posted: Mon Feb 06, 2023 6:16 am
by musurca
Right now, the Unit fields currentExhaustion and maxExhaustion can only be viewed, but not changed from Lua. Obviously there are many situations in scenario creation in which one would want to reset or change these values.

You can verify this by loading up the attached scenario file, and running the following code in the Lua Script Editor:

Code: Select all

local unit = ScenEdit_GetUnit({guid='FV72FT-0HMO80RCBK6FP'})
print("current exhaustion (before): "..unit.currentExhaustion)

print("attempting to set current exhaustion = 0...")

ScenEdit_SetUnit({guid='FV72FT-0HMO80RCBK6FP', currentExhaustion=0})
print("current exhaustion (after): "..unit.currentExhaustion)

assert(unit.currentExhaustion == 0)
Additionally, both fields are in the wrong place in the Command Lua Docs. They are listed under the Side wrapper, when they should be listed under Unit.

Thank you!

Re: [1307.2] unit.currentExhaustion/maxExhaustion not mutable in Lua

Posted: Mon Feb 06, 2023 9:18 am
by michaelm75au
Will fix Docs.