Home   Help Search Login Register  

Author Topic: Creating Units  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

Offline Gcfungus

  • Members
  • *
Creating Units
« on: 21 Apr 2008, 20:18:04 »
I want to make a mission where groups can be created at a certain position and assault a town (marker "town1").
So, as a tester to see if this was possible, I made this:

Code: [Select]
_player = _this select 0
_pos = getpos _player
_x = _pos select 0 +5
_y = _pos select 1 +5
_pos1 = [_x,_y,0]

L1 = "OfficerW" createunit [_pos1,group _player]
[L1] join grpnull
_group = group L1
"SoldierWB" createunit [_pos1,_group]
"SoldierWB" createunit [_pos1,_group]
~5
_group domove getmarkerpos "town1"
exit

with: [this] exec "test.sqs" in the players init.

However, I get this message: '"SoldierWB" createunit [_pos1,_group]|# |': Error genetic error in expression

What can I do to fix this, or can't it be done?
Thx, -=GC=-Fungus1999
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Creating Units
« Reply #1 on: 22 Apr 2008, 01:36:57 »
Code: [Select]
"OfficerW" createunit [_pos1,group _player, "L1 = this"]

Offline Gcfungus

  • Members
  • *
Re: Creating Units
« Reply #2 on: 22 Apr 2008, 08:38:20 »
Thx, Mandoble, the error message went, but still nothing happens.  :dunno: ???
Is there anything else I have missed?
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Creating Units
« Reply #3 on: 22 Apr 2008, 16:31:37 »
try
Code: [Select]
_pos1 = [(getPos player select 0)+5,(getPos player select 1)+5,0]

Offline Gcfungus

  • Members
  • *
Re: Creating Units
« Reply #4 on: 22 Apr 2008, 17:57:13 »
Having updated the original to:

Code: [Select]
_player = _this select 0
_pos1 = [(getPos _player select 0)+5,(getPos _player select 1)+5,0]
"OfficerW" createunit [_pos1,group _player,"L1 = this"]
[L1] join grpnull
_group = group L1
"SoldierWB" createunit [_pos1,_group]
"SoldierWB" createunit [_pos1,_group]
~5
_group domove getmarkerpos "town1"
exit

Still nothing.  >:(
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline Mostly

  • Members
  • *
Re: Creating Units
« Reply #5 on: 23 Apr 2008, 16:01:30 »
Try this. It works for me.
You need a game logic named "Base" (this will be the location of the spawned units), and a dead unit with this in the init field "DummyGroup = Group this". Then select whatever trigger you want to use and insert this into the Act field "[Base] exec SCRIPTNAME"
Code: [Select]
_base = _this select 0

#fillgroup

#spawnleader
"SoldierWB" createUnit [getPos _base, dummygroup]

;assign to other group
_member = (units dummygroup) select 1
[_member] join grpNull
_grp = group _member

#spawnrest
"SoldierWB" createUnit [getPos (_base), _grp]

?(count units _grp == 5):goto "groupfull"
goto "spawnrest"

#groupfull
; register new group in groupsarray for later use
?(count allgroups == 0):allgroups = [_grp]
?(!(_grp in allgroups)):allgroups = allgroups + [_grp]

EXIT
This should create a full group of men.
 :yes:
They mostly come out at night. Mostly!