Jump to content
Sign in to follow this  
JohnKalo

AI on buildings

Recommended Posts

Well my question is kind of simple. How can I place AI on buildings?

I have tried to just place them but nothing seems to happen. They just don't appear. I believe that there is some kind of script in order to achieve such a thing but I am not sure which.

Has it got something to do with the "altitude" of the AI?

And should I apply different initialization for different buildings?

Share this post


Link to post
Share on other sites

This can be achieved in several ways. Many, but not all buildings have specific addressable points defined where one can place AI with a command or give the AI a move waypoint towards the building and selecting a position, followed by a statement to fix the unit in place and / or stance. The init line provides more predictable results, especially concerning the direction the AI will be looking.

For example, if I wish to place a unit at the ninth building position (when using this method the number correspons to the numbered position indicated by a move waypoint subtracted by one), fixed in his viewing direction and unable to kneel down or lie down, I would put in his init line:

this setPos (nearestBuilding this buildingPos 8); this disableAI "Move"; this setunitpos "Up";

This would be most useful when the unit must keep watch in a particular direction and looks out of a window or over a parapet that has a certain height. Alternatively if one wishes for the unit to maintain the ability to revolve around and assume lower stances, one would use instead of a disableAI statement a forceSpeed command:

this setPos (nearestBuilding this buildingPos 8); this forcespeed 0;

Some buildings will lack the numbered predefined positions, or sometimes one would like to place them at different locations than the defined positions allow. In such cases one would specify the desired height (matter of trial and error to find the correct value) and optionally add statements to fix the AI in place or stance, for example using in the initline:

this setpos [getpos this select 0, getpos this select 1,((getpos this select 2) +3.5)]; this disableAI "Move"; this setunitpos "Middle";

Regards,

Sander

Share this post


Link to post
Share on other sites

Thanks a lot Sander.

Now could you be a bit more specific on which buildings positions exist?

I am currently editing on the South Asia map that comes with Take on Helicopters and more specifically in the Shapur area. So some intel would be greatly appreciated.

Share this post


Link to post
Share on other sites

As I don't have Take On Helicopters, which has its own editing section, I am not familiar with the map. In Arma2 one can determine whether a building had enterable positions and where they are by doing a preview in the editor in Regular mode (no indicators are provided on Veteran mode) with you and a second AI grouped to you as commander. This will allow you to command the AI to particular buildings and positions. Perhaps TOH offers the same possibility.

Regards,

Sander

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×