OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ahmed117 on 16 Jan 2012, 09:24:35
-
Hi guys,
I was wondering that how object are placed on tables such as a radio in official campaigns. I tried it several time but the object falls down the table, as shown in the picture.If any one knows how to put radio on table so please help me.
Ahmed 117 (A.rogers)
-
This is easy, man!
Just put this in the "init" field of your object:
this setPos [(getPos this select 0), (getPos this select 1), x]
and change the x with number... Try putting 0.5 and item should appear right above table; if you don't get right height of object at first try, you may need a few more attempts by little increasing that value in order to find correct height.
-
I agree with Guido, but I'll suggest you, don't write 'this' because you'd have to place it yourself, but if you change it for 'name of table' for example if your table is called 'tableone'. You will need the following command
this setpos [getpos tableone select 0 , getpos tableone select 1 , 1]
1, it's the correct heigh, for the table.
-
Got to be careful with naming objects in OFP. Only name objects that scripts will interact with so that you keep the number of global variables to a minimum. Otherwise you risk an encounter with the savegame bug. For something as simple as setting an object atop another, no names are needed, just the setpos command.