ScenEdit_RefuelUnit works but getting error
Posted: Tue Apr 20, 2021 11:08 am
I'm trying to make a script that will make all the air units in a mission go and refuel at a specific refuel mission. The problem I'm having is that when ever I try the ScenEdit_RefuelUnit function, I get a "ERROR: Object reference not set to an instance of an object.". The weird things is that even though it is popping an error the unit being told to refuel is still getting the order the refuel. The problem for me is that if I'm trying to tell multiple aircraft to refuel it will error out of the script on the first aircraft and only tell the first aircraft to refuel. An example of something similar to what I'm using would be like this:
for a,b in pairs(ScenEdit_GetMission('YourSide', 'YourStrikeMission').unitlist) do
ScenEdit_RefuelUnit({side = 'YourSide', guid = b, missions = {'YourRefuelmission'}})
end
In this case, it will give the first unit it loops through the order to refuel but it will error on the first loop and stop before it can give the order to all the units in the mission unitlist. Am I using an improper format for the ScenEdit_RefuelUnit?
for a,b in pairs(ScenEdit_GetMission('YourSide', 'YourStrikeMission').unitlist) do
ScenEdit_RefuelUnit({side = 'YourSide', guid = b, missions = {'YourRefuelmission'}})
end
In this case, it will give the first unit it loops through the order to refuel but it will error on the first loop and stop before it can give the order to all the units in the mission unitlist. Am I using an improper format for the ScenEdit_RefuelUnit?