Home   Help Search Login Register  

Author Topic: createUnit Help Required  (Read 630 times)

0 Members and 1 Guest are viewing this topic.

Offline Bazooka_Boy

  • Members
  • *
  • Proud to be a llama!
    • The Home of DJ Klimax
createUnit Help Required
« on: 17 Nov 2003, 12:08:21 »
Hi

I've made a german WWII bunker addon.
It has 5 building positions

When placed in the mission editor I use a init line to call a script.
This script creates an machine gun and positions it relative to the location and direction of the bunker.

Using units added in the mission editor, with their formation set to 'none', I can get a unit to go to a certain position in the building and stay there using the following init line

"this setPos ((nearestBuilding this) buildingPos 1); CommandStop this; this setBehaviour AWARE; this setCombatMode YELLOW; this SetUnitPos UP"

I'm trying to achive the same thing via a script so that a mission editor can just place my bunker and call my script from the init line to have it fully crewed and with an MG.

However it just isn't working.  I'm using the following code to create the unit, assign its group and move it into position.

"EC_MP40Sol" createUnit [getpos _Object, BunkerGuard, "e2 = this; this setPos ((nearestBuilding this) buildingPos 2); this SetUnitPos UP", 1, "SERGEANT"]

This seems to work except for the fact as no formation is specified the unit goes into a position for the default formation (wedge I think).

The command reference doesn't show a valid value for 'no formation' and I've tried including

e2 setFormation "NONE"

but this doesn't seem to have any affect.

Can anyone tell me what I'm doing wrong?

Bazooka_Boy
Bazooka_Boy

If your happy and you know it then your wierd!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:createUnit Help Required
« Reply #1 on: 17 Nov 2003, 13:48:16 »
"None" is only applicable when the unit is first inserted ... units placed with this will receive a "return to formation" order as soon as the mission starts.     The default formation is indeed wedge.  

What happens if you put all that stuff from the working init line in the createUnit init line?   I suspect its the commandStop bit that is making it work.   You don't need setbehaviour aware, that's the default (I think).

Plenty of reviewed ArmA missions for you to play