Lua doesn't set speed
Posted: Wed Apr 03, 2019 3:01 pm
(1009.27.6) Seems that "ScenEdit_SetUnit(table)" Lua function couldn't set speed correctly.
In the attached savefile, open Lua Console and run the following script individually (sorry if there's typo or any error)
Throttle setting window (F2) is useful for check.
[font="Courier New"]ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', speed=15})
ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', throttle=2})
ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', manualSpeed=2})[/font]
If they works, submarine (Phoenix) alters its current or desied speed to 15kts.
Instead however, if you set current speed by knots, submarine always set its speed to 0kts.
For throttle, submarine certainly changes throttle once, but immidiately returns the original throttle.
Also, Can I set desired speed by kts, rather than throttle using Lua? (Looks like "manualSpeed" is by throttle)
Yeah it is meaningless setting fighter speed to 515kt or 535kt, but recently I noticed that reduing sub's speed to 1 knot does works
for reducing passive sonar detection range.
P.S. Do not approach Romeo. It's a trap. (patrol mission always get fooled)
In the attached savefile, open Lua Console and run the following script individually (sorry if there's typo or any error)
Throttle setting window (F2) is useful for check.
[font="Courier New"]ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', speed=15})
ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', throttle=2})
ScenEdit_SetUnit({guid='9ae1b22f-8178-4ec8-a178-b1e54b5bac7c', manualSpeed=2})[/font]
If they works, submarine (Phoenix) alters its current or desied speed to 15kts.
Instead however, if you set current speed by knots, submarine always set its speed to 0kts.
For throttle, submarine certainly changes throttle once, but immidiately returns the original throttle.
Also, Can I set desired speed by kts, rather than throttle using Lua? (Looks like "manualSpeed" is by throttle)
Yeah it is meaningless setting fighter speed to 515kt or 535kt, but recently I noticed that reduing sub's speed to 1 knot does works
for reducing passive sonar detection range.
P.S. Do not approach Romeo. It's a trap. (patrol mission always get fooled)