Jump to content
Sign in to follow this  
evilnate

How to add objects to building positions

Recommended Posts

I am making a mission where I would like to add enemy solders and civilians to specific building positions.

I can do this with one unit by making him a move waypoint over a building and selecting which position, but I don't have the ability to place several units on the same building at different positions.

The only other way I know to do this is to place a unit on a building and set it's height so that it could be on different floors. The problem with this is that the solder doesn't seem to know he is indoors and tries (ans sometimes does) to walk through walls.

If there is a good way to do this with arma please let me know. I have tried the examples from the wiki but I get syntax errors "missing ) next to building number"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos ((object 453210) buildingpos 1)

Share this post


Link to post
Share on other sites
There is no more object command in ArmA (see this discussion).

I read that discussion and it makes sense to me, but I still can't get solders to move into different positions in the same building. I keep getting syntax errors, and I've used many combinations. I admit that I am a scripting newbie but I just want to move guys in a house - why is it so difficult?? crazy_o.gif

I would expect to use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this domove nearestObject 123456

It says type number expected array before nearestObject

Share this post


Link to post
Share on other sites

I think Kronzky is suggesting, you should try something like this. Place a gamelogic ontop of the building you want to enter, then use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">soldier setPos (buildingPos [nearestBuilding gamelogic, 2])

Share this post


Link to post
Share on other sites

I've placed 4 soldiers manually on the roof with waypoints.

roofne0.jpg

I think I had some problems attaching the second unit's waypoint. Each time I tried to place the second one, I'd accidentally chose the first unit's waypoint and opened it.

I just continued untill I finally made it. Maybe you could just merge two missions with each unit at different positions?

Share this post


Link to post
Share on other sites

yes iv been trying to put an unit inside of an building and well cant get it to work can some one help? Iv tryed soldier setPos (buildingPos[nearestBuilding gamelogic,2]) and nothing it says missing ; or something? Iv tryed this setpos((nearestBuildingthis)buildingPos1); this works but does not put the unit in the building it puts the unit far away? plz some one help me with this smile_o.gif

Share this post


Link to post
Share on other sites

this setpos((nearestBuilding this)buildingPos 1)

if it dosen't work than the nearest building dosen't have a pos....also some building might have a pos but they don't work so

try a different number.

I did a bit of code on this while learning....have a look at the

hideout.sqf it has comments.

My old code

Share this post


Link to post
Share on other sites

I use this in the units init:-

this setpos [(getpos this select 0),(getpos this select 1),7.3]

to place units at various heights in buildings

the 7.3 being the height value

Share this post


Link to post
Share on other sites

omg iv tryed all of them and so many of them to make an unit be inside of an house crazy_o.gif In OFP there was only one way why is there so many ways? All post on this topic have an diffrent way of doing this crazy_o.gif Yet none work, Plzz can some one give me right way to put an unit inside of an house by useing the int line huh.gif In the OFP it was this sepos [getpos this select 0,getpos this select 1, (getpos this select 2) +x] x adjust the height of the unit this worked fine yet in ArmA people got so many diffrent replys on this. I just need one that works smile_o.gif

Share this post


Link to post
Share on other sites

Go panic outside your house, stay away from your computer!

Come back, take a deep breath.

Then slowly (no sudden moves!wink_o.gif, get back into the ArmA mission editor and try again.

You have enough information available here on this forum to succeed in your task.

Share this post


Link to post
Share on other sites
Go panic outside your house, stay away from your computer!

Come back, take a deep breath.

Then slowly (no sudden moves!wink_o.gif, get back into the ArmA mission editor and try again.

You have enough information available here on this forum to succeed in your task.

come on now yes there is a lot of info on this page but iv tryed them all and i get missing ; ) ( all the time? Just would love it if i could get an one that works because there is well a lot of diffrent info on here a.

Share this post


Link to post
Share on other sites
omg iv tryed all of them and so many of them to make an unit be inside of an house crazy_o.gif  In OFP there was only one way why is there so many ways? All post on this topic have an diffrent way of doing this crazy_o.gif  Yet none work, Plzz can some one give me right way to put an unit inside of an house by useing the int line huh.gif In the OFP it was this sepos [getpos this select 0,getpos this select 1, (getpos this select 2) +x]    x adjust the height of the unit this worked fine yet in ArmA people got so many diffrent replys on this. I just need one that works smile_o.gif

Setpos still works (And IMO its alot easier then trying 25 different building positions).

Share this post


Link to post
Share on other sites

Slightly related. I am looking for a way to have units walk around in buildings. I have no problem positioning them but I´m looking for the code to alter a waypoints hight to make the unit move to the waypoint on a certain hight or level in the building. SetWpPos is said to work with a 3D array, but what syntax does it have in combination with an additional hight coordinate ?

Share this post


Link to post
Share on other sites

To Bolschoiw, as far as I know the only way to get units to move around a building sensibly is with the building positions. You can get them to move to different positions with waypoints in the editor (you probably know this but holding shift with the editor allows you to access whatever object is below waypoints you've already placed, so you can put multiple waypoints on the same building/vehicle).

Simple tip for using building positions - if you don't know which position number is where in the building, just create a player character as the leader of a group with at least one other soldier and preview it. Then when you select your soldier for a movement command and aim the cursor at the building it will tell you which building position he will move to and even give you a white line pointing to where that is.

Share this post


Link to post
Share on other sites

Thx for answering, but I know about the building Pos already. It doesn´t really help me though as I want to have guards patrolling on rooftops and such.

What came to my mind aswell is the Arma specific movement pattern for AI infantry units. I guess their waypoint precision has been toned down by default in their config, so they sometimes have problems to go to a spot. Is this right ?

What I basically want to achieve is that I can use waypoints with a hight coordinate that I can alter to my liking. Right now the infantry troops will always try to get to the waypoint on ground level. This means they fall of the roof. Another use of this would be to have units patrol several floors and use stairways to get there. I don´t want to be limited to predefined building positions as they are to unflexible for my goals.

Share this post


Link to post
Share on other sites

@Balschoiw

i dont think anything else then buildingpos will work.

keep in mind that you will need a roadway lod and a given path in the model. the buildingpos points are on these path to make them enterable by walking. without roadway lod ai cant "airwalk" cause they need ground to be able to move.

if a building has a huge amount of buildingpos u can find some points wich are quite usefull for a patrol like thing. but ai usually get stuck at some point, only turning around on the pos.

f.e. the plattenbau style houses have enough buildingpos on the roof to send the guys from corner to corner.

Share this post


Link to post
Share on other sites

After some quick testing I understand what you´re saying. I was not aware that footsoldiers need a roadway lod, but this also explains why they are so eager to jump off roofs first.

Well, overall this is bad as it basically renders the idea of units patrolling on rooftops and balconies of buildings without proper buildingPos useless confused_o.gifsad_o.gif

There isn´t a way to override the regular pathfind routines of AI and simply send them into a direction, apart from using setvelocity, right ?

Thx for explaining though thumbs-up.gif

Share this post


Link to post
Share on other sites

nothing to thank for balschoiw.

maybe a custom fsm file can do what you need. best specified for a singlebuilding and the buildingpos numbers of this building.

in combination with animations (wich should work no matter if the feet touch the ground or not) a patrol over different floors should be possible, very work intensive, thats for sure. the main problem i think really is the fsm file, wich force groupmembers to enter the buildings in formation, wich blocks the buildingpos for the other units of the team. result is a leader shouting moveto commands without a pause and standing units doing 360´s instead of moving out of the way.

i tested the movement in buildings via buildingpos some time ago and with single soldiers i had very good results. as soon it was a group i had the effect described above. the problem with the single soldier was that as soon some enemy start shooting nearby the ai went nuts, falling from the roof or doing some other stupid thing. but the reason for this should have been the fsm aswell i guess. all tries i had with any kind of custom fsm so far didnt work as desired.

for static units the buildingpos work great, a shame no one really uses it in missions.

Share this post


Link to post
Share on other sites

you can fake it using aniamtions and interupting them with alert status variable. its cheap but works ok, i have tried it.

Share this post


Link to post
Share on other sites

ok, lets c if i got it right.

you "walk" the patrolpath by playing the animation for it.

endless patroling is prevented by the alert level.

so what do you do after they anim get stopped?

you disableai move then? hard to imagine they not dive to safety (of the roof). did you tested more then one floor? is there a stairs up down anim?

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  

×