OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Crowey on 31 May 2008, 21:35:28

Title: Placing enemy in building and choosing which floor they are on??
Post by: Crowey on 31 May 2008, 21:35:28
Hi guys as you read from the topic im in need of help???? Basically i need to place a enemy officer in the 2nd floor of a building as he is the target for the good guys to kill so I want him to be out of sight so its not just a case of sniping him from miles away.... also i wanna put his body guards on the ground floor for a bit of close quarters action..... only thing is when i place him he always is on ground floor???
PS, may need a script to make him stay in situ....
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: trooper543 on 31 May 2008, 23:00:15
Hi Crowley

Mate i can understand your fraustration

1. The best thing to do mate is have a look at Mr Murrays Editing Guide as this helps out loads and also gives you a better understanding

2. As for answering your question mate, i think if you give the bloke a waypoint that moves him into the building you will notice that within the waypoint it will ask you what postion in the building you want to place the enemy officer

i hope i have explained this okay

Mate i know where you coming from but also try Mr Murrays Editing Guide this is really a big help

Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: Ironman on 31 May 2008, 23:23:43
Guess and check with setpos is what I normally do to get him right where I want him.
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: Rommel92 on 01 Jun 2008, 03:03:14
Use my positions recorder (check Submissions forum). Record all the positions you want them to be at, in the editor set their direction to what you want. Then with those positions just put them in a big setPos script moving them all to those positions. Done!  :good:
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: Crowey on 02 Jun 2008, 09:41:20
Hmmm cant find that and when I try the way point, no matter what position i choose the unit just stands outside the door and wont enter?
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: Cheetah on 02 Jun 2008, 21:35:00
The buildingPos (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=b#34) command might help to setPos a unit.
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: Rommel92 on 02 Jun 2008, 21:37:25
ROMM_RecordPos:
http://www.ofpec.com/ed_depot/index.php?action=details&id=548&page=1&cat=xyz

Waypoint Q: Is the unit in a group? Groups tend to have trouble moving into buildings, as they retain their formation. If this isn't the case however, is there anything stopping him from entering? Is it a custom building or a BIS one (ie the Hotel?)

The buildingPos as suggested by Cheetah helps a lot aswell, and you can tell units via a "doMove" to move to these found building positions, however, if it he won't go in by default, you may have some trouble with this.
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: johnnyboy on 03 Jun 2008, 17:52:31
You can look up object IDs for the buildings using the editor. Then give the unit a TALK waypoint, and put this code in it:

Code: [Select]
this domove ((position this nearestobject 259904) buildingpos 10);
The unit should then move to the position in the building (including second floor positions).  Note there a re a few buildings where AI get stuck (like the tall apartment buildings in Bagango).  The AI cannot access the upper floors of those buildings for some reason.  Also note that when using code, the building positions are start with zero, but when you are playing and ordering units into buildings (so the building position # is shown to you while playing) the position #s start with one.  So if while play testing you see position 11 is the position you want, then you make the line of code above 10.

The other technique already mentioned is a simple SETPOS command, where you set the height (the z coordiante to the exact height above ground that you want to place the unit).  You can put a unit anywhere using this command.  This is how El Cojon stood on top of a Lamp Post (right before he lost his left jewel...poor guy...check out my Last Tango in Bagango mission if you don't know what I'm talking about).   ;)

Code: [Select]
unit1 setpos [x, y, z];
Rommel's tool for capturing coordinates is very handy.  You should download it and use it.  Saves hand writing coordinates.  You can copy coordinates from his tool, and then paste them into an editor, and then paste them into your mission code later.

If this is all still a bit overwhelming, I can make a small example mission for you using the move to buildingPos technique, the setpos technique, or both.  Just tell me exactly which building in which town.

You can zoom in the map and put a marker on the building then take a screenshot and post it here (and state which town its in).

Finally, you want these units to stay put, so the player has to hunt them, so you may want the following commands to keep them in their places:

Code: [Select]
doStop Unit1;
unit1 disableAI "MOVE";
unit1 setUnitPos "UP';   <-- use this if you don't want unit to go prone when they sense danger.

And most importantly, have fun!
Title: Re: Placing enemy in building and choosing which floor they are on??
Post by: schuler on 04 Jun 2008, 13:42:19
hey you all are right ,,, but this works too! i think! or help others out  ;)
note set behavior and setpos must be right ,,, and direction if you need.
cheers schuler,,,, might not have answered this question but might help others!!!!!