OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Serial Killer on 25 Sep 2005, 22:13:21

Title: Problems with getPos command
Post by: Serial Killer 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.
Title: Re:Problems with getPos command
Post by: THobson 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.
Title: Re:Problems with getPos command
Post by: Pilot 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
Title: Re:Problems with getPos command
Post by: THobson 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


Title: Re:Problems with getPos command
Post by: Serial Killer 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? :-\
Title: Re:Problems with getPos command
Post by: THobson on 26 Sep 2005, 18:05:38
I don't understand you.  getPos does work with triggers.  What progress have you made with buildingPos?
Title: Re:Problems with getPos command
Post by: Kyle Sarnik 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.  ::)
Title: Re:Problems with getPos command
Post by: Triggerhappy on 28 Sep 2005, 01:50:22
or the names of the units he's moving...

(good eye!)
Title: Re:Problems with getPos command
Post by: Serial Killer on 29 Sep 2005, 21:24:58
 :-[

Thanks, didn't notice it.