OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Katrician on 21 Jul 2010, 16:44:27

Title: Positioning AI on balcony with setPosATL? OA
Post by: Katrician on 21 Jul 2010, 16:44:27
Hello I have hard time positioning an AI at the balcony position, I tried first setPos and height with no luck; then I thought of the setPosATL but I needed an array of positions; so I used the exec.camera.sqs to get those numbers, I got myself to the balcony position and started camera, then copy/pasted the cam pos numbers to add them to the setPosATL line with no luck.

My question is what is the way to get those numbers/arrays used by setPosATL?, what would be the proper syntax for the setPosATL in the init box of the AI?

Title: Re: Positioning AI on balcony with setPosATL? OA
Post by: Igor Drukov on 22 Jul 2010, 00:05:19
Hey


So I guess the code:

Code: [Select]
this setPos [getpos this select 0, getpos this select 1, HeightToAdjust]
isn't working, then. If it's an enterable building, you could use:

Code: [Select]
this setpos (NearestBuilding BuildingPos IndexToFind) where IndexToFind is a number corresponding to one of the hard-coded pre-set building positions. It starts from 0 and can go up to 20+ depending on the type of building. Once you've retrieved the index, you can fine-tune the position since BuildingPos returns a 3D position.

If it's not an enterable building, then we'll have to enquire seriously why setPos isn't working.

Hope I got that right and it actually helps,
Igor.
Title: Re: Positioning AI on balcony with setPosATL? OA
Post by: Katrician on 23 Jul 2010, 14:10:22
Thanks Igor I did not understood your post yesterday, so today I came back and enabled my brain others cores  :P . If I understand correctly the Code would do that :

Code: [Select]
this setpos (NearestBuilding BuildingPos 10)

10 for position ten, so I just have to order an AI into a building position, that's when the choice pop up and a position label show up; that I choose which position suits me best. I will try it and report.


Later....

Ok Igor your code did not work....so I persisted with setPosASL and found what was wrong, the camera.sqs retrieve the two axis but give not the correct height, so I took the height from a BIS placed unit and put it in my unit and it worked fine.

So I think it is possible to have a script to automate things a bit, it could be based on camera.sqs as adding height in ASL (AS Sea Level), then to copy/past it to clipboard.


The advantage is not guessing AI height while positioning it in building neither others axis in 3D, as I tried the "getpos" method AI kept falling on ground, or was limited to house predetermined house position. You position yourself where exactly you expect AI to stand etc...

So if coders could make this tool this would be great, as I don't got knowledge  :whistle:
Title: Re: Positioning AI on balcony with setPosATL? OA
Post by: Pirin on 25 Jul 2010, 10:56:19
Igor was just missing some ()  This works:

Code: [Select]
this setPos ((nearestBuilding this) buildingPos 10)
You can use the Virtual House Position Module (http://www.armaholic.com/page.php?id=11288) to easily check where each position in a building is.