Page 1 of 1

LUA to refuel aircraft after remains in area trigger

Posted: Sat Feb 15, 2025 9:55 pm
by orca
I have a unit remains in area trigger for any Red side aircraft that remains in a "refueling zone" for 30 minutes. I want to create an event in which this trigger results in an action to refuel the aircraft that resulted in the trigger.

I'm using this script to refuel aircraft:

u = ScenEdit_GetUnit({side='Red',"AIRCRAFT_NAME'})
if u ~= nil then
local newfuel = u.fuel
newfuel[2001].current = newfuel[2001].max
u.fuel = newfuel
end

But how can I always make the local unit u to be the aircraft that that triggered the unit remains in area event trigger?