Jump to content

Need Help getting menus to show if a target is active/inactive


Recommended Posts

Posted

I am trying to get the F10 menu to show whether or not a target is active. I want it in the F10 menu becuase this is for a mission that basically runs on our server 24/7 so i want people to be able to look in the menu and see what targets are active.

 

In my test scenario I have a truck and a ship. I want to go into the f10 menu push F1 for my "Mission/Task Menu" and then push F1 for truck activity and a F2 for ship activity. That all works fine except for the activitiy part. For example, the truck is spawned in i push f10---->F1 for truck activity and it says truck active. I destroy the truck. I push F10----->F1 to check activity and instead of it being blank it still shows truck active. 

 

Here are just some of the scripting I have tried. One is mist and the other is mist combined with flags:

 

env.info( '*** Menu INCLUDE START *** ' )

 

 

--main menu init
OPSmenu = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "MISSION/TASK MENU")
OPStruck = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Truck Status", OPSmenu)
OPSship = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Ship Status", OPSmenu)

 

--flight tasking/coordinates
local function main()

 

if Group.getByName('truck') then
     OPStruckactive = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Truck Active", OPStruck)
else 
     removeItem('Truck Active')
end

 

if Group.getByName('ship') then
     OPSshipactive = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Ship Active", OPSship)
else 
     removeItem('Ship Active')
end

 

end
main()
env.info( '*** Menu INCLUDE END *** ' )

 

 

-----------------------------------------------------------------------------------------------------

Here is another one I tried:

 

env.info( '*** Menu INCLUDE START *** ' )


--main menu init
OPSmenu = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "MISSION/TASK MENU")
OPStruck = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Truck Status", OPSmenu)
OPSship = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Ship Status", OPSmenu)

 

--flight tasking/coordinates
local function main()
timer.scheduleFunction(main, {}, timer.getTime() + 1) 

 

if trigger.misc.getUserFlag('1000') == 1 then
OPStruckactive = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Truck Active", OPStruck)
trigger.action.setUserFlag('1000', false)
end

 

if trigger.misc.getUserFlag('1002') == 1 then
OPSshipactive = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Ship Active", OPStruck)
trigger.action.setUserFlag('1002', false)
end

 

end
main()
env.info( '*** Menu INCLUDE END *** ' )

 

 

 

 

Posted

I don't know for sure, but I'd try to replace "if Group.getByName('truck') then" by :

"if Group.getByName('truck') and Group.getByName('truck'):isExist() == true and #Group.getByName('truck'):getUnits() > 0 then"

Posted

Thanks for the suggestion but no dice. The truck constantly says active whether it is active or destroyed. I have spent 2 days working on this crap. Starting to think it is damn near impossible to do.

 

  • Recently Browsing   0 members

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