Scifer Posted May 8, 2018 Share Posted May 8, 2018 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 Link to comment Share on other sites More sharing options...
Grimes Posted May 8, 2018 Share Posted May 8, 2018 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 Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Recommended Posts