OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wadmann on 04 Apr 2005, 20:02:16
-
I ran into a problem over the weekend when using the onsinglemapclick command, in particular the _pos value that is returned.
I wanted to do a simple "make smoke at the landing site that is determined by a single map click" script but I kept running into a problem:
It appears that when the object is setposed to the _pos location, it is at [x,y,sealevel] when I need it to be [x,y, groundlevel].
I was trying to incorporate the Active Smoke Signal (http://www.ofpec.com/editors/resource_view.php?id=764) by Sterling Silver but I ran into the above problem.
Can anyone
a) confirm the format of the array returned with the _pos value (is it [x,y] or [x,y, z] )
and
b) give me a direct or workaround solution to my problem?
My thought was to find the nearest object to the map click point and take and add that "z" value to the _pos array to get an invis H to be close to the surface of the map but I am just not bright enough to make it work.
Does anyone know how to get this working correctly?
Thanks in advance!
Wadmann
-
I had this problem. It was a long time ago and the whole workaround was complex and badly done because I didn't know very much at the time, but I suspect the essence of it is something to the effect of:-
object setPos [getPos _pos select 0, _pos select 1, 0]
-
Thanks for the quick reply mac!
I guess that I am confused as to the value of "0" then as I thought that it was sea level. Are you telling me that using zero as the third parameter in a position array is equal to ground level?
After thinking about it for a moment, I guess that it would be as whenever you setpos a unit in a tower, you only add the height needed to get them in the tower and not taking into account whether the tower is at sea level or on top of a mountain.
Not that I do not trust you mac, but I will keep the topic open until I get it working in game. This just goes to show that my mind is not focused enough to edit/script at 2:30 am after being up more than 20 hours straight!
Thanks again!
Wadmann
-
My pleasure. :wave:
Yes, 0 is ground level.
I always keep topics open until I have thoroughly tested the answer. And usually for a day or two after that.
-
I had a moment to test the code out last night and it worked! :thumbsup:
Actually, it did not work as posted. As usual, macguba nudged me in the right direction but he forgot to leave his trademark phrase:
"Syntax not guaranteed "
For the record, the syntax that I got to work is:
object setpos [(_pos select 0), (_pos select 1), 0]
Thanks again mac!
Wadmann