Home   Help Search Login Register  

Author Topic: Setunitpos???? (newbie question)  (Read 832 times)

0 Members and 1 Guest are viewing this topic.

Goatcheese

  • Guest
Setunitpos???? (newbie question)
« on: 02 May 2005, 12:27:35 »
hey all....im a newbie with a question.....ive got some machine guns in a bunker but they are appearing through the fllor and arent high enough to shoot out the window of the bunker.......ive read that u can set a units hieght and i was wondering if it would help me?........plz help ive got a really good mission in mind......thanx

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Setunitpos???? (newbie question)
« Reply #1 on: 02 May 2005, 14:08:42 »
You need a setPos command.   Look it up in the online command reference, which has an example of the kind of thng you need.

Depending on the exact nature of the bunker it may not work but give it a try.   Set the MG a little above where you want and see if it drops correctly onto the floor.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Setunitpos???? (newbie question)
« Reply #2 on: 02 May 2005, 16:41:50 »
You should also look at buildingPos.  I don't know if any are defined for a fortress, but if there are any they are likely to be in some very useful places.

Goatcheese

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #3 on: 03 May 2005, 09:35:54 »
ok thanx guys ill give them both a shot  :)

Goatcheese

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #4 on: 03 May 2005, 09:57:00 »
ok well i found out how to do the set pos but i cant get the unit to stay in the same place.......im using    unitname setPos [X,Y,Z]       if i add something to the X and Y areas it ends up sending my unit miles away from where hes meant to be. If i just add something to the Z area and hav X and Y = 0......then my unit doesnt rise any higher off the ground.....im in a really difficult problem.....any ideas would help....

Goatcheese

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #5 on: 03 May 2005, 11:43:09 »
oh and another piece of info.......if i set the X and Y stats to zero then my unit starts over the ocean somewhere....can anyone help me??........i dont understand how i get my unit to stay where i placed it but raise it up a little bit ??? >:(

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Setunitpos???? (newbie question)
« Reply #6 on: 03 May 2005, 12:02:42 »
X is east-west
Y is north-south
Z is up-down

The origin of the map [0,0,0] is sea level in the bottom left hand corner.

Try it on a flat piece of grass somewhere.   The fortress is probably screwing things up.

When you encounter a new command, it is usually worth making it work in a very simple situation first, before trying it in a live mission.

IIRC loons are subject to gravity but objects are  not.
Plenty of reviewed ArmA missions for you to play

sa8gecko

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #7 on: 03 May 2005, 12:03:38 »
the X,Y,Z cohordinates are absolute, non relative to the place you put
your MG in the editor.
That is, use:
Code: [Select]
unitname setpos [getpos (unitname) select 0,getpos (unitname) select 1, Z]Z is tricky to determine, cause setpos use ABSOLUTE rather than RELATIVE
heights above ground: that is, height above sea level is required.
To determine this Z, just place a gamelogic under the X,Y cohordinnates of
the unit at height 0 and then take the distance from the unit itself, and add
to this the height you want the unit to be raised above ground:
Code: [Select]
logic = "gameLogic" camcreate [0,0,0];
logic setpos [getpos (unitname) select 0,getpos (unitname) select 1, 0];
dist = logic distance unitname;
unitname setpos [getpos (unitname) select 0,getpos (unitname) select 1, dist + height]
where height is the height above ground you want unitname to be.

EDIT>
Macguba already answered part of this in the post above.
« Last Edit: 03 May 2005, 12:05:35 by sa8gecko »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Setunitpos???? (newbie question)
« Reply #8 on: 03 May 2005, 12:06:35 »
Err, I thought z was the height above ground level, not sea level.    So to raise something 2m above its original spot you would use

this setPos [getPos this select 0, getPos this select 1, 2]

in its init field.
Plenty of reviewed ArmA missions for you to play

sa8gecko

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #9 on: 03 May 2005, 12:39:43 »
Code: [Select]
Err, I thought z was the height above ground level, not sea levelI was confused by the fact that  'EmptyDetector' objects obey the ASL height  rule.

Goatcheese

  • Guest
Re:Setunitpos???? (newbie question)
« Reply #10 on: 04 May 2005, 07:50:29 »
thanx guys for ur help i got it to work ;D
oh yeh...thanx especially to sa8gecko ur code helped aot

once again thanx guys ;D ;D ;D

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Setunitpos???? (newbie question)
« Reply #11 on: 04 May 2005, 21:52:57 »
hmmm interesting takes on the issue...my 2 cents:

this setpos [(getpos this select 0), (getpos this select 1), (getpos this select 2) + height above ground desired in meters]

Then I just put the object where I want in the editor......

am I doing too much typing?
« Last Edit: 04 May 2005, 21:54:32 by Zombie »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Setunitpos???? (newbie question)
« Reply #12 on: 04 May 2005, 22:07:33 »
Yes.   But it doesn't matter.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Setunitpos???? (newbie question)
« Reply #13 on: 05 May 2005, 22:52:52 »
Lol  ;D
You only need the brackets when you are adding or subtracting a value.

so
getPos blob select 0,

is okay

getPos blob select 2 + 10

causes a bit of a problem because the + is resolved before the select so this is saying

getPos blob select 12

which is nonsense.

this setpos [getpos this select 0,getpos this select 1, (getpos this select 2) + height above ground desired in meters]

Works fine and saves you two ( and two )



« Last Edit: 05 May 2005, 22:53:24 by THobson »

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Setunitpos???? (newbie question)
« Reply #14 on: 06 May 2005, 12:34:23 »
ok, makes sense.   ;)