Jump to content

Recommended Posts

Posted

I am in ME and have an AI tanker that I would like to manipulate. I have a couple ways about doing this: 1 scripts which I know little about and 2 triggers without scripts (just use drop down selection items in conditions and actions)

 

I want to spawn a tanker and fly a racetrack (easy). I want the tanker to RTB upon bingo fuel (easy). What I am having a hard time doing is getting a second tanker to spawn and get in the track to relieve the first tanker once the first tanker reaches just above bingo fuel. I want no delay between available tankers.

 

I tried the:

 

"if Unit.getByName('tanker1'):getFuel = 0.7 then trigger.action.setUserFlag(1, 1)"

 

But in this case the equals sign kept causing issues. I was able to get the script working entirely when I substituted '= 0.7' for '(0.7)' but then it seemed to work every time regardless of the getFuel value and no matter the getfuel level I always got the flag 1 to set. I know this because I had the flag 1 condition cause a message to coalition. I got the message every time. Then I found out that maybe the getFuel exports data to a fuel table? I was lost at that point.

 

Then I came across the condition in ME UNIT'S ARGUMENT IN RANGE and I am hoping there is a LUA file that I can pull the KC-135 MPRS fuel info (argument) from to make an argument like in the clickable.lua parameters.

 

Anyhow, does anyone know an easy way to get the second tanker to activate on ground then take off to fly to the first tankers track to relieve them? My goal is to have zero down time and also not have tankers spawn and disappear at random. I want to build simulation.

Posted

if you use == then the value defined must be exact at the momment the function is tested. With Fuel test I use <= to a value and I test the fuel value every 30 seconds and it works. Here a copy past of one of the functions I use :

 

function SuppFuel2()

 

local unitObject = Unit.getByName('Wingman')

local flightFuel = Unit.getFuel(unitObject)*100

if flightFuel <= 20 then

MA_out('Support wingman is Bingo Fuel (' .. mist.utils.round(flightFuel, 0) .. ' % of fuel left).', 15)

trigger.action.setUserFlag("228", true)

endheliSupport()

else

SuppFuel2ID = mist.scheduleFunction(SuppFuel2,{},timer.getTime()+30)

end

 

end

Posted

Thank you very much, toutenglisse. I will try this tonight. I should be able to remove the Heli support and modify my own flag values just fine, I presume?

 

//

 

local unitObject = Unit.getByName('tanker1')

local flightFuel = Unit.getFuel(unitObject)*100

if flightFuel <= 10 then

MA_out('tanker1 is Bingo Fuel (' .. mist.utils.round(flightFuel, 0) .. ' % of fuel left).', 15)

trigger.action.setUserFlag("4", true)

end

 

//

 

Make this a continuous trigger and it will always look for tanker1 to be at or less than 10% fuel. If at or less than 10% fuel then flag 4 causes a parking hot spawn of tanker2 to depart and take over just before tanker 1 hits the AI triggered bingo. I can adjust the flightFuel value as needed. Should work, no? Unless I deleted something you coded.

 

Thank you again for your time.

Best regards

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...