Home   Help Search Login Register  

Author Topic: Problem with getpos(), setpos(), buildingPos() and nearestbuilding()  (Read 670 times)

0 Members and 2 Guests are viewing this topic.

Red Ant

  • Guest
Hello,

I'm currently trying to place a bunch of resistance soldiers in that large building in the center of Lipany (Nogova map). I've tried two different methods to get the soldiers where I want them to be.

A) Create a temporary unti controlled by me and walk to the positions, then use a scripted radio command and the hint function to get my current coordinates and azimuth. Note the numbers down and then setpos() a soldier to that position in the initialization field in the editor.

B) Just get the coords of the position using the nearestbuilding() and buildingPos() functions and setpos my soldier to the position.

Now here's the problem(s) I've run into. With some of the building positions, especially the one that's basically on the roof of the building (great sniping position ;) ), neither method works and I think it's something to do with getpos() returning the z coord (height) relative to the floor I'm standing on rather than absolute, because if I go on the roof and use the radio trick to get my current coords, it'll always return something very close to zero (sometimes even slightly less than zero) even tho the roof is cearly higher up than that. Thus when I use the coords returned by getpos(), and then setpos() a unit there, it often ends up somewhere completely wrong!  I tried guessing the correct height, but this didn't work very well either. Anyone know a solution to this problem?  ???

Red Ant

  • Guest
Oh yeah, I forgot to say that the following



this setpos  ( ( nearestbuilding this ) buildingPos 28 )


will teleport my soldier straight into the sea. But i know that building position #28 exists as it is displayed as house position #28 if I tell another soldier to go there.
« Last Edit: 18 Sep 2005, 18:29:43 by Red Ant »

bored_onion

  • Guest
for putting units inside the town hall, the technique of setpossing using experimentation and trial and error usually works fine. for putting dudes on the roof of the building it might be possible just to put them over the building to start with and then setting them as "flying".

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
It's not even neccessary to set them as flying.
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08