Jump to content

Recommended Posts

Posted

I made a shooting practice mission with MOOSE Framework where targets are respawned each time I takeoff (RTB). Now I want to spawn water, aerial or ground targets depending on the weapons loaded after the aircraft is serviced.

 

player_group = GROUP:FindByName( 'Player Group' )
player_unit = UNIT:FindByName( 'Player Unit' )
spawn_target_group = SPAWN:New( 'Target Group' )

player_unit:HandleEvent( EVENTS.Takeoff )

function player_unit:OnEventTakeoff( EventData )

if target_group then target_group:Destroy() end
target_group = spawn_target_group:Spawn()

end

 

;) I found that UNIT:GetAmmo() returns nested tables with ammo data.

 

What is the simplest way to evaluate loaded weapons so the result can be put in a switch structure to spawn those target types?

 

Thank you

Posted
Unit.getAmmo() and then iterating through to evaluate each weapon types capabilities. Specifically the attributes. So perhaps count the number of A2A missiles on the aircraft to spawn air threats accordingly.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

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