Jump to content
Sign in to follow this  
1para{god-father}

Unit intoa building

Recommended Posts

I am trying to get a unit into a building but i just cannot seem to get him in there

The building ID is 227959

So I am using:-

this setPos (nearestBuilding this buildingPos 238597)

is that correct ?

Share this post


Link to post
Share on other sites

u can easily give your unit a waypoint "on" the building, then u have same extra options in the waypoint-menu.There u can chose one of the proxys in the building.You have to try which Number is good to go for you.

Share this post


Link to post
Share on other sites
I am trying to get a unit into a building but i just cannot seem to get him in there

The building ID is 227959

So I am using:-

this setPos (nearestBuilding this buildingPos 238597)

is that correct ?

It's not the building ID you need but the bulding position.

http://community.bistudio.com/wiki/buildingPos

Try search this forum for "house patrol script", this script will let units randomly patrol inside buildings.

Here it is:

http://forums.bistudio.com/showthread.php?t=76423

Share this post


Link to post
Share on other sites

You need to know the building possition that you want your guy to be in. The code is this:

this setpos (((getpos this) nearestobject <building ID number>) buildingpos <possition number -1>);

So to explain it, here's an example:

this setpos (((getpos this) nearestobject 1818) buildingpos 2);

The object ID is 1818 (a tower I think in Zargabad) and the building possition is 2 (possition 3 on the tower because all the possition are -1. So possition 1 would be 0, 2 is 1, 3 is 2, and so on).

Hope this helps.

Share this post


Link to post
Share on other sites

I am trying to figure out how to randomly position units in a house automatically.

Scenario - I want to randomly place units throughout an area of the city but have them automatically be inside random positions of a house.

I can do it for individual units by placing this line in their init field:

this setPos (nearestBuilding this buildingPos random 10

But that's a time consuming process when you want dozens of different types of units and i have to check the amount of pos within a building to stop my units going to nowheresville

i thought the basics would be like this:

{_x setPos (nearestBuilding this buildingPos random 10)} foreach thislist

but yeah like that doesn't work. foreach group this works but again i have to check the pos of each building if i want them to maximise it's use.

any ideas?

Share this post


Link to post
Share on other sites

What about moving a unit to a specific position in a building that is not an actual building position. I.e. move to a coordinate position [4333.91,4108.03,21.0012] that just happens to be in a house. I want a trigger to spawn a wp at a certain coordinate(height included) to move a pre-placed unit already in the building to the specific coordinate I just mentioned. This coordinate just happens to be just outside a doorway on the second floor landing at the top of the steps.

I'm trying this with an object(evidence) named move1 placed on top of the stairs via this code:

this setPosATL [getPosATL this select 0, getPosATL this select 1, 3.9];

Then via trigger I spawn a wp like this:

_wp = insg1 addWaypoint [position move1, 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointCombatMode "RED";
_wp setWaypointFormation "FILE";

The unit moves but instead of stopping at the top of the stairs where the object is placed he moves down the stairs to a position below the object. I'm guessing it doesn't account/allow for the objects height when moving the ai units to the wp.

Is there a way to make the wp "up in the air"(read on top of the steps where the object is)?

Edited by Manzilla

Share this post


Link to post
Share on other sites
What about moving a unit to a specific position in a building that is not an actual building position. I.e. move to a coordinate position [4333.91,4108.03,21.0012] that just happens to be in a house. I want a trigger to spawn a wp at a certain coordinate(height included) to move a pre-placed unit already in the building to the specific coordinate I just mentioned. This coordinate just happens to be just outside a doorway on the second floor landing at the top of the steps.

Instead of WP, use move/domove.

Share this post


Link to post
Share on other sites

I did that as well. Just forgot to mention.

I tried:

InsMg1 doMove (position move1);

In this instance I used the actual unit name of the unit. With the previous example I used the group name of the unit. This unit is grouped with another that has a 0 probability of presence. I did this cause I could only find info about spawning a wp using a group name and not an individual unit.

Share this post


Link to post
Share on other sites
I made this for a mission of mine.

Another very useful script from you, thanks! :)

Share this post


Link to post
Share on other sites
Another very useful script from you, thanks! :)

:)

It's updated now, added couple of params and fixed the hiding feature. Oh and example/test mission.

Share this post


Link to post
Share on other sites

Hi Shk,

I am using your script to place men in buildings

nul = [(thislist select 0),thislist,20,0,[true,true]] execvm "shk_buildingpos.sqf";

My issue is that as i have set them to not move (as they will jump of the buildingd before i gte there !), they stand there like lemon's and only if you walk direly in from of them they will shoot , how can I take of the disable move once in range from another trigger?

Cheers

Share this post


Link to post
Share on other sites

Using version 0.12?

Then you are doing parameters wrong at least. Should probably be:

[...20,0,[],true,true]

Well, you just have to make a trigger that does something like this when players are within area/detected:

{_x enableai "move"} foreach (nearestobjects [getpos yourTrigger,["Man"],50]);

Share this post


Link to post
Share on other sites

Probably trying to give an empty array to setpos or something else that needs [x,y,z] array.

What line was that?

Share this post


Link to post
Share on other sites

"getpos yourTrigger" is supposed to be replaced by whatever position you use. :P

Share this post


Link to post
Share on other sites

Add some diag_log/globalchat between there so it prints out the position and the array the nearestobjects returns.

Share this post


Link to post
Share on other sites
Hi Shk,

I am using your script to place men in buildings

My issue is that as i have set them to not move (as they will jump of the buildingd before i gte there !), they stand there like lemon's and only if you walk direly in from of them they will shoot , how can I take of the disable move once in range from another trigger?

Cheers

I am experiencing the same. I can walk up to any of them, from behind, in front, it doesn't matter. I have even tried shooting at their feet. They just don't respond when using the following parameters:

[(thislist select 0),thislist,20,0,[],false,true]

Also, I see in your script header that you include a parameter called "movingMode" that is not in any of your examples and if used results in the other params following not used. Ver 012

nul = [position,unitList,movingMode,radius,priority,height,disableMove,stance,hide]

Is there a possible fix? Love all of the possiblities these scripts open for a mission maker so I am eagerly waiting for a resolution.

Thanks

Share this post


Link to post
Share on other sites

I always use - this disableAI "MOVE";this setPos ((position this nearestObject 1506) buildingPos 12); this setDir 106;this setCaptive true;

works great except for the fact that once you disable the AI's movement their basicaly just gonna grow roots and stay right where there at, which works fine when you dont want them running around or moving from the post you put them in, just fails to bring any realism when you finaly reach the house the AI's in and he just stands there looking at you or if your lucky he'll pop a few shots at you.

I usually just place the AI and remove the disableAI "move".

Either way it does what its supposed to...the hard part is when you wanna place static weapons in buildings :p

Then its all about hieght, left, right, etc etc...

hope that helped some...

Share this post


Link to post
Share on other sites
I am experiencing the same. I can walk up to any of them, from behind, in front, it doesn't matter. I have even tried shooting at their feet. They just don't respond when using the following parameters:

[(thislist select 0),thislist,20,0,[],false,true]

The script just does: disableai "move" to the units if disableMove is used. To re-enable it you can use multiple methods, one being the trigger already discussed in this thread. Just do: enableai "move" to all of them.

Also, I see in your script header that you include a parameter called "movingMode" that is not in any of your examples and if used results in the other params following not used. Ver 012

nul = [position,unitList,movingMode,radius,priority,height,disableMove,stance,hide]

Is there a possible fix? Love all of the possiblities these scripts open for a mission maker so I am eagerly waiting for a resolution.

I don't even remember what for that was, but I ended up not adding it to the script after all. Forgot to remove it from the syntax example.

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  

×