I've modified a script from Johan Gustafsson's tutorial, and it works, but it has side-effects. My logic for the fix seems OK, but I can't figure the proper syntax. I'm not much of a scripter.
NOGAS SCRIPT: The script sets fuel to 0 in whatever vehicle the player gets in. I use a trigger to set a variable, so that the player drives along for a short bit, hits the trigger, and bang the script executes. Works fine. But the player can then get into 2 other vehicles, and I don't want those to run out of fuel too (that would be too frustrating). Trouble is, once the script executes, any vehicle the player touches is instantly set to 0 fuel.
ORIG SCRIPT: (in 3 vehicle inits)
---------------------------------------
_Unit = aP
_Vehicle = _this select 1
; Main loop
#Update
; Check if the unit is in the vehicle
? _Unit in _Vehicle AND nofuel: goto "nogas" ["nofuel" is trigger variable]
~1
goto "Update"
#nogas
_Vehicle setfuel 0
exit
-------------------------------------------
My fix logic would be to put in a "tripped" switch, so that once the script fires for one vehicle, it won't fire again:
-------------------------------------------
; Check if the unit is in the vehicle
? _Unit in _Vehicle AND nofuel AND NOT tripped: goto "nogas"
~1
goto "Update"
#nogas
_Vehicle setfuel 0
tripped=true
exit
---------------------------------------------
But this isn't working. If the logic is good, how can I write it? If the logic is bad, any fix suggestions?
Thanx