Home   Help Search Login Register  

Author Topic: onSingleMapClick problem  (Read 1138 times)

0 Members and 1 Guest are viewing this topic.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
onSingleMapClick problem
« 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 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

Check out my Camouflage Collection! New items added 31 July 2005.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onSingleMapClick problem
« Reply #1 on: 04 Apr 2005, 20:53:36 »
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]
Plenty of reviewed ArmA missions for you to play

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:onSingleMapClick problem
« Reply #2 on: 04 Apr 2005, 22:39:33 »
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
Check out my Camouflage Collection! New items added 31 July 2005.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onSingleMapClick problem
« Reply #3 on: 04 Apr 2005, 23:56:33 »
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.
Plenty of reviewed ArmA missions for you to play

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:onSingleMapClick problem
« Reply #4 on: 05 Apr 2005, 17:06:54 »
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:

Code: [Select]
object setpos [(_pos select 0), (_pos select 1), 0]
Thanks again mac!

Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.