Home   Help Search Login Register  

Author Topic: CreateUnit  (Read 917 times)

0 Members and 1 Guest are viewing this topic.

Offline David

  • Members
  • *
CreateUnit
« on: 30 May 2006, 10:45:25 »
I'm trying to create a script that will spawn Ai in a given area, but failing.

Heres what i have so far.

I created a marker and called it Flag1Spawn, this is where I want the AI created, I then have the script called, ["Flag1Spawn"] exec "ai_respawn.sqs"

The contents of the ai_respawn.sqs as below

Code: [Select]
_FlagSpawn = _this Select 0

"SoldierWB" createUnit [getmarkerPos "_FlagSpawn",groupAlpha]

No AI is spawned in the area I want them to be, anyone got any ideas?

Pim

  • Guest
Re: CreateUnit
« Reply #1 on: 30 May 2006, 10:55:11 »
Hello David,

I assume here that _flagspawn is a marker name. In this case the

Code: [Select]
getMarkerPos "_flagspawn"
should be

Quote
getMarkerPos _flagspawn

since the marker name is already a string, implying that you have added a "" too much.

Also make sure that the "groupAlpha" variable points to a group on the map. I mean, it seems you have copied this value from the command reference, but this variable actually determines to what group the new unit is added. When a new unit is joined to the group of the player, for instance, "groupalpha"
could be replaced by "group player" (without the "" 's).

Hope this is of any help, Pim
« Last Edit: 30 May 2006, 11:01:38 by Pim »

Offline Pilot

  • Contributing Member
  • **
Re: CreateUnit
« Reply #2 on: 30 May 2006, 13:25:17 »
Make sure that groupAlpha already exists before you try to create a unit into that group.  You can do this by creating a unit of the same side and typing this in the init field:
groupAlpha = group this; deletevehicle this;

This will create the group, groupAlpha, but will also delete that unit so it is no longer on the map.

-Pilot