Jump to content
Sign in to follow this  
RM GSTQ

setUnitPos command does not work on rooftop

Recommended Posts

Hi All,

I have checked the Wiki and also done a search here and cannot seem to find a fix to this problem. I am placing a unit on a rooftop and want him to lay down concealed until a trigger is hit then I want him to pop up to ambush approaching units.

The problems is this:

1. The setUnitPos command does not work in waypoints on rooftops

2. The setUnitPos command does work on the unit activation on the rooftop but any subsequent commands do not work in the waypoints

This is frustrating the hell out of me so any assistance would be apprecaited. Oh and before you ask I am on version 1.05 and as soon as I move the unit off the roof the commands start working so it is only the fact that the unit is on a rooftop huh.gif???

Regards

DOINGMYHEADIN

Share this post


Link to post
Share on other sites

try something like this, instead

x=10 ; this setpos [getpos this select 0, getpos this select 1, ((getpos this select 2)+ x) ]

where x is the hight of the building

Share this post


Link to post
Share on other sites
Quote[/b] ]1. The setUnitPos command does not work in waypoints on rooftops

This is because waypoints do not work by default on rooftops.

You have to use setWPPos to actually move the waypoint up to the rooftop.

this setunitpos "Middle"

does work for units on rooftops as it does on the ground.

Changing the stance via trigger is no problem aswell.

Waypoints that are on rooftops or any level above ground level

do not work by default. What you see is that the AI is trying to get to the waypont that has a groundlevel coordinate. That´s why your command in the waypoint will not be executed as the unit just will not make it to the ground. At least alive.

Share this post


Link to post
Share on other sites

As Balschoiw said, the problem is not with setUnitPos, but with the waypoints not activating (as in the units not reaching them). That's because waypoints are actually 3 dimensional, that means if the waypoint is on the ground and the unit is on top of a building, the height difference is considered in his distance from the waypoint, and the waypoint only activates when the distance is below a certain value (in otherwords he's too high above the waypoint to be able to reach it).

Share this post


Link to post
Share on other sites

Ok thanks lads......never had any problems with this in OFP so am assuming this is a change with ARMA. Will have a play and see how I go

Share this post


Link to post
Share on other sites
Ok thanks lads......never had any problems with this in OFP so am assuming this is a change with ARMA. Will have a play and see how I go

No change actually, it was like this in OFP, which was seen when you set aircraft to fly at high altitudes (~120m and above), just not with buildings (maybe the distance tolerance was greater in OFP).

Share this post


Link to post
Share on other sites

Think you must be right mate just never came accross it before and been editing for years.....in ofp of course

Share this post


Link to post
Share on other sites

But if you place a waypoint on a building you can choose the buildingpos to where the unit will (or should..) go in the trigger box. Are these positioned at ground level too?

Share this post


Link to post
Share on other sites

Thanks for the help so far but I am still having problems:

I have put a unit on a rooftop in a specific position and want him to move to crouch position at a certain point in time to ambush passing units I have done the following:

1. Placed the unit on the rooftop named Player1

2. Inserted the command hint format["Player Position: %1", getpos player] into the initi line for the unit

3. This returns the position [6752.64, 8154.02,0]

4. Inserted the following into the correct unit waypoint [Player1, 2] SetWPPos [6752.64,8154.02,0]; this setunitpos "Middle"

the unit remains prone can someone help correct what I have done.

Regards

Q

Share this post


Link to post
Share on other sites

hey RM GSTQ,

sorry to highjack your topic but didn't think this deserves a topic and yours was closest.

need a little help with setpos and buildingpos in ArmA,

OFPEC says:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setPos ((object 172902) buildingPos 1);

ArmA Editor says:

Quote[/b] ]Missing (

Red Devil says:

help.gif please!

Share this post


Link to post
Share on other sites
Thanks for the help so far but I am still having problems:

I have put a unit on a rooftop in a specific position and want him to move to crouch position at a certain point in time to ambush passing units I have done the following:

1. Placed the unit on the rooftop named Player1

2. Inserted the command hint format["Player Position: %1", getpos player] into the initi line for the unit

3. This returns the position [6752.64, 8154.02,0]

4. Inserted the following into the correct unit waypoint [Player1, 2] SetWPPos [6752.64,8154.02,0]; this setunitpos "Middle"

the unit remains prone can someone help correct what I have done.

Regards

Q

Have you tried simply using a trigger? Waypoint activation fields can be unreliable because of the very same problem you're having. If the unit doesn't need to move to his position on the rooftop then just get rid of the waypoints altogether and use put the code in a trigger. Only use waypoint activation fields when you know the unit can and will (that means never for players' waypoints, they won't always follow them correctly) move to them.

Quote[/b] ]this setPos ((object 172902) buildingPos 1);

Two things, first is the game doesn't like when you use parentheses around the object command (because it's actually incorrect to do so, it'd be like doing this: '(player) setpos [0,0,0]' ). Second, as you can see on the biki and in the countless number of other threads by people with the same problem (who also failed to search the forum and the biki) had you searched prior to posting, the object command DOES NOT WORK IN ARMED ASSAULT, and that there is proper alternative; using nearestObject ID.

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  

×