OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Abe on 17 Sep 2005, 20:37:03

Title: Units inside buildings.
Post by: Abe on 17 Sep 2005, 20:37:03
On the missionmaker, is it possible to choose what floor the units are placed on?
In some buildings all the units are on the top floor but in others they stay o the bottom floor.  Is there a way to choose what floor they are on?
Title: Re:Units inside buildings.
Post by: Manz on 17 Sep 2005, 21:01:14
im not a specialist but use this in conditon field-  this setpos [(getpos this select 0),(this select 1),7]; that number called "seven (7)" there you can but whatever number you want and the number stands for the height... ;) hope i helped you .. bye
Title: Re:Units inside buildings.
Post by: THobson on 17 Sep 2005, 21:16:53
I suggest you look at the command buildingPos here:
http://www.ofpec.com/editors/comref.php?letter=B#buildingPos

Most buildings have them set, they are specific locations inside each building.  For example I place a unit with the following instruction:

this setpos [7038.8,7147, ( ((nearestbuilding this) buildingPos 4) select 2) + 0.5]  

in her init field.  In the mission editor I put her on the building I want and the instruction puts here where I want her to be in the building.  What I am doing here is moving her to a specific x,y location on the map and setting her height compatible with that of one of the buildingPos locations in that building.


You need to investigate where the buildingPos locations are for example by putting:

this setpos  ((nearestbuilding this) buildingPos N)

where N is a number

In the init field of the player and seeing where you end up for different values of N


Title: Re:Units inside buildings.
Post by: Abe on 17 Sep 2005, 22:55:39
Great, thanx.
Does the set height work for all units or is it just soldiers?
I was trying to get an M2 Machinegun in 2nd floor window, but it would always stay onj the ground floor (although soldiers would be on top floor).
Title: Re:Units inside buildings.
Post by: THobson on 18 Sep 2005, 07:28:00
It works for all objects, though some objects are subject to the laws of gravity and some are not.  You need to experiment.

For your M2 try buildingPos  They are mostly located behind windows