Jump to content
Sign in to follow this  
rejenorst

Script to check buildingpos num + Building classname

Recommended Posts

A very basic script to check the nearest building's classname and number of building positions:

Add this to the player's init:

comm1 = this addaction [""Building Check"",""build.sqs"",[],7,false,false,"""",""true""];

Copy this into a text file and save it into your mission directory as build.sqs:

_building = nearestBuilding player

_className = typeOf _building

_bupos = []

_xt = 1

#bc

_house = _building

_nop = _house buildingPos _xt

?((_nop select 0) == 0) && ((_nop select 1) == 0): goto "bnumber"

_xt = _xt + 1

goto "bc"

#bnumber

hint format["CLASSNAME: %1 BUPOS: %2",(_classname),(_xt)]

exit

This will tell you the closest building's classname and the number of building positions available (BUPOS).

Remember that whatever number it gives you, you will have to -1 when telling units to enter the building. So if a building has 10 positions then position 1 is ( unit domove (house buildingpos 0)) whereas position 10 would be: ( unit domove (house buildingpos 9)).

Hope this helps for quick reference to find out what a building class name is along with whether or not it has available building positions for AI to use.

Edited by Rejenorst

Share this post


Link to post
Share on other sites

most recommend people using sqf instead of sqs.

paste this into a radio trigger or so...

house = nearestBuilding player;
m=0;
while { format ["%1", (house) buildingPos m] != "[0,0,0]" } do {m=m+1}; 
m=m-1; 
hint format["%1 \nlast idx: %2", typeof house, m];

Share this post


Link to post
Share on other sites
most recommend people using sqf instead of sqs.

paste this into a radio trigger or so...

house = nearestBuilding player;
m=0;
while { format ["%1", (house) buildingPos m] != "[0,0,0]" } do {m=m+1}; 
m=m-1; 
hint format["%1 \nlast idx: %2", typeof house, m];

Cheers man, my script wasn't really intended for release or anything, it was just something I needed to make for a urban patrol script mission.

This script is also not intended for use in missions but just for location scouting etc so SQS is fine unless you really want to make a mission with it.

Share this post


Link to post
Share on other sites

This is what I use.

http://www.armaholic.com/page.php?id=11288

Just plop down a module and as you enter buildings you get little bouncing balls and hints which you can copy at all valid positions, so you can easily visualize where to place people. Just remove the module when you're done.

Share this post


Link to post
Share on other sites

That's pretty damn cool! Cheers man! I might use that at some point.

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  

×