Home   Help Search Login Register  

Author Topic: Problems with getPos command  (Read 1186 times)

0 Members and 1 Guest are viewing this topic.

Serial Killer

  • Guest
Problems with getPos command
« on: 25 Sep 2005, 22:13:21 »
I'm doing a cutscene where some guys should go inside a building with getPos command. But those guys goes to wrong floor / they're not in that position where I wanted them to go. Here's a little part of the intro...

Code: [Select]
deleteVehicle nbc1
deleteVehicle nbc2
deleteVehicle nbc3
deleteVehicle sc1
deleteVehicle sc2
deleteVehicle sc3
deleteVehicle sc4
building1 say "d1"; building1 animate ["medlab", 1]
nbc11 setPos getMarkerPos "a1"
nbc11 setPos [getPos this select 0,getpos this select 1,4];
nbc22 setPos getMarkerPos "a2"
nbc22 setPos [getPos this select 0,getpos this select 1,4];
nbc33 setPos getMarkerPos "a3"
nbc33 setPos [getPos this select 0,getpos this select 1,4];
sc11 setPos getMarkerPos "sc111"
sc11 setPos [getPos this select 0,getpos this select 1,4];
sc22 setPos getMarkerPos "sc222"
sc22 setPos [getPos this select 0,getpos this select 1,4];
sc33 setPos getMarkerPos "sc333"
sc33 setPos [getPos this select 0,getpos this select 1,4];
sc44 setPos getMarkerPos "sc444"
sc44 setPos [getPos this select 0,getpos this select 1,4];

The 'nbc' guys will go to their positions without a problem, but 'sc' guys won't.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Problems with getPos command
« Reply #1 on: 25 Sep 2005, 22:51:58 »
I suggest you use the buildingPos locations for the particular building.  Find a buildingPos on each floor then use select 2 of the relevant buildingPos to put the units on the floor you want.

Offline Pilot

  • Contributing Member
  • **
Re:Problems with getPos command
« Reply #2 on: 26 Sep 2005, 00:30:04 »
I'm not sure if it makes a difference or not, but I always use () when using getpos:
nbc11 setpos [(getpos this select 0), (getpos this select 1), 4]

I can't find anything actually wrong with the code, though.

-Student Pilot

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Problems with getPos command
« Reply #3 on: 26 Sep 2005, 09:00:29 »
Pilot:  You only need brackets when you are doing some maths with the number, like adding some value:

getPos this select 0

is fine


getPos this select 0 + 5

is not.  It should be:

(getPos this select 0) + 5



Serial Killer

  • Guest
Re:Problems with getPos command
« Reply #4 on: 26 Sep 2005, 17:36:44 »
I tested that getPos command with a trigger, and it seems not to be working. Are there any other ways to move unit higher? :-\

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Problems with getPos command
« Reply #5 on: 26 Sep 2005, 18:05:38 »
I don't understand you.  getPos does work with triggers.  What progress have you made with buildingPos?

Kyle Sarnik

  • Guest
Re:Problems with getPos command
« Reply #6 on: 27 Sep 2005, 20:50:07 »
Does anyone else realize that he is using this as his variable? Silly Serial Killer, this only works for commands in a units init field. You wanna use either a global or local (_this) variable instead.  ::)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Problems with getPos command
« Reply #7 on: 28 Sep 2005, 01:50:22 »
or the names of the units he's moving...

(good eye!)

Serial Killer

  • Guest
Re:Problems with getPos command
« Reply #8 on: 29 Sep 2005, 21:24:58 »
 :-[

Thanks, didn't notice it.