Home   Help Search Login Register  

Author Topic: getpos player select 2....  (Read 966 times)

0 Members and 3 Guests are viewing this topic.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
getpos player select 2....
« on: 21 Mar 2005, 21:17:50 »
that should give the player's height, right?

but it doesn't want to work. what am i doing wrong?

Code: [Select]
_playerheight = getpos player select 2
?_playerheight>=2:goto "collect"

no matter what height value i use, the goto won't fire...

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:getpos player select 2....
« Reply #1 on: 21 Mar 2005, 21:27:08 »
Is this in a script?

Possibly try putting some spaces in there:

?_playerheight >= 2:goto "collect"


Planck
« Last Edit: 21 Mar 2005, 21:31:50 by Planck »
I know a little about a lot, and a lot about a little.

Offline Blanco

  • Former Staff
  • ****
Re:getpos player select 2....
« Reply #2 on: 21 Mar 2005, 21:28:40 »
Should work...

Maybe update the code when you check your condition...

Code: [Select]
?getpos player select 2 >= 2:goto "collect"
Or put a space between _playerheight and >=
Search or search or search before you ask.

Offline Woodpeckersam

  • Members
  • *
  • I'm a llama! ooh! Yeah!
Re:getpos player select 2....
« Reply #3 on: 21 Mar 2005, 21:30:26 »
Code: [Select]
player setpos [(getpos this select 0),(getpos this select 1),5] : goto collect
explanation...
Player is the name of the unit you want to set height of

Setpos means that you are telling it to make the unit set its position somewhere

[(getpos this select 0)is basically saying that you want it to get the positon of the unit (This) or position of an object (change this a name of the unit)

[(getpos this select 1)is basically saying that you want it to get the positon of the unit (This) or position of an object (change this a name of the unit)

,5]this sets the units height, in ths above, it is 5 metres high.
« Last Edit: 21 Mar 2005, 21:31:54 by Woodpeckersam »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:getpos player select 2....
« Reply #4 on: 21 Mar 2005, 21:38:51 »
um, aye. thanks ;)

just tried a hint format check on the player position, and have found the problem. the z coordinate seems wonky. 'ground level' gives a value of -0.00125122. moving upstairs changes the value weirdly, but always at a value of +/- 0.00n.

most weird.  :-\

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:getpos player select 2....
« Reply #5 on: 21 Mar 2005, 21:55:13 »
That's because he is touching something. He has to be in air to be over 0. Getting below 0 is just OFP's way of saying "HEY! YOU SCREWED UP ON MY MODEL! MY FEET ARE ACTUALLY 1/64th OF A CENTIMETER BELOW GROUND! MORON!"

I think. Don't look at me I'm not addon maker. ;D

:beat: *Gets Shot* :beat:

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:getpos player select 2....
« Reply #6 on: 21 Mar 2005, 22:14:27 »
Nope ::)
It does that with default BIS soldiers as well... Only vehicles return 0 altitude on surface...

And:
Spaces between variables and operators are not so important, just do not write functions and/or variables together or they won't work :P
for example
?_playerheight>=1:goto "blah" works just fine...

in
Code: [Select]
this setPos [(getpos that select 0),(getpos that select 1),5]you dont need those brackets ()...
Only when you + or - something from them you need the brackets, like:
Code: [Select]
this setPos [(getPos that select 0)+_someVarib,getPos this select 1,5]
But this is off the point...

To the original question; try this:

Code: [Select]
_playerheight = (getpos player) select 2
?_playerheight>=2:goto "collect"

Somethings require some bracket usage...
Of course not certain it will work but I'm quite sure that's the problem...
Otherwise this would be too odd :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:getpos player select 2....
« Reply #7 on: 21 Mar 2005, 22:22:26 »
too odd it is. no amount of brackets will solve it. i had a look in the comref and thought perhaps getting at the positional array via square brackets might also be it, but apparently not.

i've sidestepped the problem anyways, but thanks all :)

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:getpos player select 2....
« Reply #8 on: 22 Mar 2005, 02:03:14 »
When units are over roadways (stairs, ladders, ramps of vehicles, etc.) the Z posistion value is not the distance above the ground, but the distance above the roadway (hence about 0).  So as a workaround try making a script that sets a game logic at the unit's postion (but at ground level) then use the distance command between the unit and the GL.  That will be his height above the ground.
« Last Edit: 22 Mar 2005, 02:03:57 by Raptorsaurus »