Home   Help Search Login Register  

Author Topic: unitcreate  (Read 619 times)

0 Members and 1 Guest are viewing this topic.

mARV

  • Guest
unitcreate
« on: 12 Jan 2004, 21:49:51 »

can anyone explain the UnitCreate command?   I can get it to work if i insert a soldier in the editor and have them join the group he is in.  ummm, like this:

_bobsgroup = group bob

"SoldierWMG" createunit [getmarkerpos "barracks",_bobsgroup]

but if i tried it without a soldier in the editor it doesn't work.   like this:

"SoldierWMG" createunit [getmarkerpos "barracks", groupalpha]

which is the example in the comref manual..

Is there a way to assign an empty group that (such as groupalpha) that I can createunit units to?



Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:unitcreate
« Reply #1 on: 12 Jan 2004, 22:21:59 »
grpnull?

:beat: *Gets Shot* :beat:

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:unitcreate
« Reply #2 on: 12 Jan 2004, 22:41:46 »
You need to have a readymade group in editor.. at least that's what I think.

Whenever (a lot) I use createunit I place a single unit in editor to some remote location and then in a script setpos him to where I want the group to be when I start creating more units to it.

For example

Code: [Select]
#Stsedlo

?_Stsedlo == 1: goto "Okrouhlo"
?(leader maingroup) distance Stsedloman > 900: goto "Okrouhlo"
_Stsedlo = 1

   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWCrew" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWMortar" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
   ?(local server): "SoldierWMortar" createunit [getmarkerpos "Stsedlo", Stsedlogroup, "",_skill]
Not all is lost.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:unitcreate
« Reply #3 on: 13 Jan 2004, 00:01:31 »
Artak is right, the group must exist already for createUnit to work.

In practical terms, I don't know precisely what this means. terms.  For example, it may be enough to create a gamelogic in the Editor, give it a group name then deletevehicle it.     Try some experiments.
Plenty of reviewed ArmA missions for you to play

mARV

  • Guest
Re:unitcreate
« Reply #4 on: 13 Jan 2004, 16:05:31 »
I was hoping there was a real easy way to create an open group array, maybe like

groupalpha = []

setting up a empty array in the init.sqs file. i tried this and it doesn't work. the only way i can get it to work is if i have groups already set up in the editor.   I was just trying to get away from having a large number of soldiers running around giving me lag before i needed to even use them

deaddog

  • Guest
Re:unitcreate
« Reply #5 on: 13 Jan 2004, 16:14:47 »
You do need a group name before using the createunit command.  The easiest way is to place a unit in the editor, name it  and delete it:  (groupname=group this;deletevehicle this)

Now you have a valid, empty group.

"soldierwb" createunit [position, groupname]


Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:unitcreate
« Reply #6 on: 13 Jan 2004, 17:31:24 »
You only need a preexisting group for spawning the 1st soldier, who will be groupleader of your new group.

"SoldierWMG" createunit [getmarkerpos "barracks",_bobsgroup];
_newleader = _bobsgroup select 1;
[_newleader] join grpNull;

That will give you a new group from scratch, with _newleader as the group leader. After that, you can fill up the new group with another 11 units, like this:

"SoldierWB" createunit [(getpos _newleader),(group _newleader)];
"SoldierWG" createunit [(getpos _newleader),(group _newleader)];
etc ...

This is how my SpawnManager2 does it: http://www.ofpec.com/editors/resource_view.php?id=585