OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcus3 on 17 Mar 2005, 16:04:49

Title: what this do?
Post by: marcus3 on 17 Mar 2005, 16:04:49
i know what these do but can you explane how they do it ( i think it might helpme understand some things)
this setpos [(getpos this select 0), (getpos this select 1), 5.8]
and
man sidechat format [""I have %1$ in my pocket"",manmoney]

thanks
Title: Re:what this do?
Post by: ACF on 17 Mar 2005, 17:26:14
this setpos [(getpos this select 0), (getpos this select 1), 5.8]
'this' refers to the unit.
GetPos this returns the grid position array of 'this' unit: [x,y,z]
GetPos this Select 0 is the first element of the position array: x
GetPos this Select 1 is the second element of the position array: y
this SetPos [e,n,h] instantly moves 'this' unit to that grid position
So:
this setpos [(getpos this select 0), (getpos this select 1), 5.8]
moves this unit to its original x and y coordinates but 5.8m above ground level


Quote
man sidechat format [""I have %1$ in my pocket"",manmoney]
Format ["this is a string I want to put a %1 in",variable]
converts a variable to a string (e.g. a value of 8 to "8") and displays it on its own or in a string containing the place holder %1.
man Sidechat "Roger" displays a text radio message "Roger" to all units on man's side
So:
man sidechat format [""I have %1$ in my pocket"",manmoney]
Displays "I have 27$ in my pocket" as radio text when the value of manmoney is 27
Title: Re:what this do?
Post by: marcus3 on 17 Mar 2005, 17:44:22
ok thanks man this will help alot.
;)