Ok, I started playing around with these with a few radio triggers so I could see how the commands behaved before I tried to implement them.
They're weird. Ok, here's what I set up
markers: "here" & "here2", someplace visible (I used intro island)
Player, init:
plygroup = group thisSoldier, init:
newgroup = group thisTrigger: R. Alpha, repeating "Create unit in my group"
xxxu = "SoldierWPilot" createUnit [getmarkerpos "here", plygroup]Trigger: R. Bravo, repeating "Create unit in that group"
xxxu = "SoldierWPilot" createUnit [getmarkerpos "here", newgroup]Trigger: R. Charlie, repeating "Create unit in new group"
xxxu = "SoldierWPilot" createUnit [getmarkerpos "here", addagroup, "addagroup = group this", 0.5, "PRIVATE"]Trigger: R. Delta, repeating "Create Vehicle"
xxxv = "M1Abrams" createVehicle getMarkerPos "here2"Trigger: R. Echo, repeating "Delete Vehicle and Unit"
deleteVehicle xxxv; deleteVehicle xxxuSo: Alpha creates a unit and adds it to the player's group. Bravo creates a unit and adds it to another soldier's group. Charlie creates a unit and (in theory) adds it to a new group. Delta creates a tank, and Echo deletes the created tank and unit. Pretty simple stuff & I wasn't really anticipating any problems.
WHAT HAPPENED:Radio Alpha created a soldier in my group, at the marker position. Fine, except Radio Echo would NOT delete the unit, alive or dead. Repeat calls on Alpha did create additional units, whether the pilot was alive or dead. Much as expected, apart from not being able to delete any of them.
Radio Bravo created a soldier and added it to another group, and worked fine, regardless of whether that group contained any living units. (So, therefore, an empty group can exist - since you can't reference dead units from their group?) Radio Echo still did nothing.
Radio Charlie did nothing at all. It would appear that the group will need to exist before you can add someone to it.
Radio Delta created a tank. Then, hitting it again created a new tank.. and again, a new tank.. Nicely placed near each other. Radio Echo deleted only the most recently created vehicle.
For radio Charlie, I also tried the soldier's creation line as:
addagroup = []; xxxu = "SoldierWPilot" createUnit [getmarkerpos "here", addagroup]but it spat the dummy at me. So I tried
addagroup = group null; xxxu = "SoldierWPilot" createUnit [getmarkerpos "here", addagroup]and it didn't mind at all - but still no unit.
Has anyone tried this before? Have an explanation for what's goin down with deleting created units? The comref specifically states that
deleteVehicle object Operand types: object: Object
Type of returned value: None
Compatibility: Version 1.34 required.
Description: Delete any unit or vehicle. Only vehicles inserted in editor or created during mission can be deleted. Player unit cannot be deleted.
Example: deleteVehicle tank (er, there's another kind of unit that's not inserted in editor or created during mission? :-\ Must mean map objects / buildings etc)
But to solve my *specific* problem, can someone tell me how to create a group mid-mission, either by splitting a group or by creating an empty group, or by creating a unit that is the first unit in a new group.
Sorry this was so long, but I was trying to be as precise and informative as possible about this one - it's... strange...
EDIT: Did further testing using a trigger
uxxx doFire player. Nothing happened. Didn't even look at me. So, it appears that createUnit does NOT assign the created unit to the variable!
?(this == True): sucks_ass = sucks_ass + [this]