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

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
musurca
Posts: 168
Joined: Wed Jul 15, 2020 10:06 pm
Contact:

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

Post 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!
Attachments
Lua exhaustion test.zip
(5.63 KiB) Downloaded 11 times
User avatar
michaelm75au
Posts: 12467
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

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

Post by michaelm75au »

Will fix Docs.
Michael
Post Reply

Return to “Tech Support”