OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: vaff on 11 Feb 2007, 15:52:20

Title: Start in a tower
Post by: vaff on 11 Feb 2007, 15:52:20
How do you get a unit to start in a tower????
Title: Re: Start in a tower
Post by: hoz on 11 Feb 2007, 16:05:59
I noticed in ArmA that you can place the unit over the tower in just the right position and indeed he would be placed in the tower. This differs from OFP where you had set the height of the unit. I'll try and take a screen shot of a good placement and post it here.

See attached Image
Title: Re: Start in a tower
Post by: Terox on 11 Feb 2007, 19:20:05


you could specifically position a unit in a building by placing the unit in the building and then using sepos to adjust the height

eg Place the following code in the unit's INIT field
this setpos [getpos this select 0, getpos this select 1, Z]

where Z is the height, which can be a negative number or a positive number

alternatively, check the following wiki entry

http://community.bistudio.com/wiki/buildingPos

Title: Re: Start in a tower
Post by: johnnyboy on 12 Feb 2007, 17:50:10
As the previous gentleman stated, building pos will work for you.  Look up the building ID in the editor, and the following line of code will work"

Code: [Select]
this setpos  ((position this nearestobject 12345) buildingpos 4);
Substitute 12345 with your tower's building ID.  You also have to determine the correct building position.  In-game, building positions are shown as 1 through X.  But in code, they are 0 to X-1, so adjust your desired buinding pos accordingly.

When using this to put units on top of buildings where there are no guard rails, you might want to use "unit disableAI "TARGET"" command which which prevents him from wanting to engage targets and run off the roof to his death.  The unit will still shoot enemies, but he won't run off to ENGAGE.  If you want him to not move at all then do this also:  "unit disableAI "MOVE"".
Title: Re: Start in a tower
Post by: hoz on 12 Feb 2007, 18:22:45
Why use the building pos and set unit height command when you can just drop the unit in the tower? Also placing units directly on top of buildings works the same way. I can see using the buildingpos command for placing a unit on a particular floor of a building. What am I missing?
Title: Re: Start in a tower
Post by: Jimboob on 13 Feb 2007, 10:42:06
I noticed in ArmA that you can place the unit over the tower in just the right position and indeed he would be placed in the tower.

You could do the same in OFP, although it was always easier to do using the setPos and setting the height