OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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...
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.
-
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.
-
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
-
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
-
I tested that getPos command with a trigger, and it seems not to be working. Are there any other ways to move unit higher? :-\
-
I don't understand you. getPos does work with triggers. What progress have you made with buildingPos?
-
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. ::)
-
or the names of the units he's moving...
(good eye!)
-
:-[
Thanks, didn't notice it.