OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Knowlife on 22 Mar 2003, 13:16:45

Title: Hight of objects
Post by: Knowlife on 22 Mar 2003, 13:16:45
Hey, i'm making a map where i'l put some furniture on the 2nd floor of a bulding. So i write this script:

Hight.sqs  
Code: [Select]
_hight = _this select 0
_this setpos [getpos _this select 0,getpos _this select 1,(getpos _this select 2) + _hight]

And in the init field of a tabel i write: [10] exec "Hight.sqs"
But all i get is this error messenge:

Quote
'_this setpos [getpos _this select|#| 0,getpos _this select 1,(getpos _this select 2) + _hight]': Error getpos: Type Array, expected Object
What am i missing here?
Title: Re:Hight of objects
Post by: R3dF0x on 22 Mar 2003, 17:15:52
Try:

Code: [Select]
_object = _this select 0
_height = **WHATEVER HEIGHT YOU WANT**
_object setpos [getpos _this select 0, getpos _this select 1, (getpos _this select 2) + _height]


[this] exec "Height.sqs"
Title: Re:Hight of objects
Post by: Knowlife on 22 Mar 2003, 17:26:27
Nope, doesent work. I'm getting:

Quote
'_object setpos [getpos _this select|#| 0, getpos _this select 1, (getpos _this select 2) + _height': Error getpos: Type Array, expected Object]
Title: Re:Hight of objects
Post by: Chris Death on 22 Mar 2003, 21:06:41
[this,(getpos this)] exec "height.sqs"

Now you should be able to refer to the object in your script like:

_object = _this select 0

_objpos = _this select 1

_height = **WHATEVER HEIGHT YOU WANT**
_object setpos [(_objpos select 0),(_objpos select 1),(_objpos  select 2) + _height]


Sorry i can't try it out for myself right now to ensure it (i'm at work  :-[ ) but it should work.

~S~ CD
Title: Re:Hight of objects
Post by: Knowlife on 22 Mar 2003, 23:08:39
Yeah! It works, nice....

Thanks