Jump to content

[MOOSE] - Randomize start unit inside random zone


fiveohmike

Recommended Posts

Hey guys, a few days in on MOOSE documentation. I am just exploring and setting up a more advanced training mission in NTTR

 

So what I want to do is this. I want 8 zones in the map, with 4 units (late activated) in each zone that I want as template spawns inside the zone. Each of the 4 units represents a significant difference in waypoints. Each unit has a set of roughly 5 going in different directions to different cities. I have a total of 8 templates that I can randomly spawn as well.

 

So with that, the problem I have is that I have 32 spawn units and each one is a separate SPAWN:New() so all 32 initially spawn and get tracked with my :InitLimits and scheduledSpawns

 

What I want to do is only have 1 unit spawn in a random zone, but randomly pick from the 4 units in that zone (so it gets its waypoints) and use a random template. Not spawn all 4 at once. Once that unit is dead, have it respawn again from a random zone, and a random unit in that zone.

 

Here are my unit lists

 

ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ), 
 ZONE:New( "Zone4" ), ZONE:New( "Zone5" ), ZONE:New( "Zone6" ), 
 ZONE:New( "Zone7" ), ZONE:New( "Zone8" ) }
 
Ground_Force_Template_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" }

Ground_Units = { "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9", "G10", "G11", "G12", "G13", "G14", "G15",
               "G16","G17","G18","G19","G20","G21","G22","G23","G24","G25","G26","G27","G28","G29","G30","G31", "G32" }

 

Each individual spawn looks like this:

 

Spawn_Vehicle_1 = SPAWN:New( "G1" ):
 :InitRandomizeTemplate( Ground_Force_Template_1 ) 
 :InitLimit( 8, 2 )
 :InitRandomizeZones( ZoneTable )
 :SpawnScheduled( 60, .8 )

 

Can I use the scheduler or some functions some how to achieve this randomization ?

 

I was thinking maybe:

 


 function()
   do
     local UnitName = GroundUnits[ math.random( 1, 32 ) ]
    Spawn_Unit = SPAWN:New( UnitName ):
      :InitRandomizeTemplate( Ground_Force_Template_1 ) 
      :InitRandomizeZones( ZoneTable  )
      :InitLimit( 8, 2 )
   end

 

But is A) even possible, and B if it is can I trigger the function to run on the death of that unit?

 

Thanks,

A-10C Noob - Watch out, I may happen to fly my hog into your car!

 

Win 7x64 - Core-i7 4770k, 16GB Ram, Titan X, Obutto Cockpit with 3x 27" screens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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