Jump to content

Recommended Posts

Posted

So I'm working on a testing some stuff and getting better at LUA. Since I design maps used for training for the squad I"m in, Im always looking for ways to respawn units. So I took the tanker respawn script and modified it to work as a function that I can respawn either airplanes, heli's, or ground units. This way anyone who's training can get additional support as needed for the range they are going to. In the future I'll use this on the training map so people can call CAS, SEAD, or even air to air support.

 

So here's the function so far:

function SpawnONator(groupname, type,Counter)

local group = mist.getGroupData(groupname)
group.route = { points = mist.getGroupRoute(groupname, true) }
group.groupname = groupname  .. Counter
for planes = 1, #group.units do
 group.units[planes].unitId = nil
group.units[planes].unitName =groupname .. Counter .. planes
end
group.category = type
mist.dynAdd(group)
end 

 

The group name is of a group that is already on the map, but not activated. Each group I have their own counter that counts up, to ensure that the group name is always different so I could spawn the units more then once. For instance if I need a lot of A-10C support I can call the same group name again and by having the counter go up, it's all good. Each unit also gets a different name so no repeats.

 

The function works great for planes and helicopters. I was able to have about 50 aircraft in the air with no problem. The counter technique worked great and with no issue.

 

The problem arises with the ground unit. So I have 6 T-90's in a group called TSTRange. I set the type to GROUND and give it the counter. It loads up the first group ok. They start moving based on waypoints and all is good. But when I activate it again to spawn another group - it removes the first group and respawns the second group. I would like it to work like the planes and helicopters that I can spawn as many as needed. I've triple checked that the group name is different and that each unit name is unique. So I'm stuck....hoping you guys can chime in.

Coder - Oculus Rift Guy - Court Jester

Posted

Maybe the new group has the same "groupId" as the previous one. You don't seem to touch this field. Don't know why helos and planses work differently

  • Recently Browsing   0 members

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