Home   Help Search Login Register  

Author Topic: Two actions with a single map click  (Read 2117 times)

0 Members and 1 Guest are viewing this topic.

Offline rcmw

  • Members
  • *
Two actions with a single map click
« on: 04 Mar 2010, 16:39:44 »
Ok I've been searching though the forums for a few days now and can't find an answer to my question so I hope someone can help.

I'm setting up what I hoped would be a simple radio trigger that will then set a marker and move a unit on a single map click (the unit is going to be an invisible heli pad that can then be used to help control some supports I've set up).

At the moment I've got it so I can move the unit with a single map click with,
 
onMapSingleClick "unit setPos _pos; onMapSingleClick """";";

(where unit is the unit I wish to move) and move the marker with a single map click using,

onmapsingleclick {"mark" setmarkerpos _pos;onmapsingleclick {}} 

(where mark is the marker I with to move) but when I put them in the same trigger or make two triggers with the same activation it only moves one of them.

Dose anyone know a way I can combine them? So that after a radio alpha you click once putting the unit and the marker in one place? I was hopping this would be something simple I could then use in lots of missions.

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Two actions with a single map click
« Reply #1 on: 04 Mar 2010, 17:59:53 »
Code: [Select]
onMapSingleClick "unit setPos _pos; "mark" setMarkerPos _pos; onMapSingleClick """";";

Offline rcmw

  • Members
  • *
Re: Two actions with a single map click
« Reply #2 on: 04 Mar 2010, 18:17:59 »
Unless I'm doing something else wrong that I don't know about the code wont work, you get “missing ;" just before mark.  If I delete the “" around mark it accepts it but the command only moves the unit again.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Two actions with a single map click
« Reply #3 on: 04 Mar 2010, 19:45:55 »
Code: [Select]
onMapSingleClick "unit setPos _pos; ""mark"" setMarkerPos _pos";
Maybe? Since onMapSingleClick is another one of those aaancient commands that really should use {}'s instead of ""'s :) Double quotes!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Two actions with a single map click
« Reply #4 on: 04 Mar 2010, 19:50:52 »
Er, it is.

Code: [Select]
onMapSingleClick {unit setpos _pos; "mark" setMarkerPos _pos}
 ::)

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Two actions with a single map click
« Reply #5 on: 04 Mar 2010, 22:13:20 »
Code: [Select]
onMapSingleClick "unit setPos _pos; ""mark"" setMarkerPos _pos";
Maybe? Since onMapSingleClick is another one of those aaancient commands that really should use {}'s instead of ""'s :) Double quotes!

Wolfrug out.

Bah, I forgot the quotes, and honestly had never used the new syntax!  You learn something new every day  :good:

Offline rcmw

  • Members
  • *
Re: Two actions with a single map click
« Reply #6 on: 05 Mar 2010, 21:58:06 »
Thanks everyone, that now works fine, would never have worked that one out.

Offline CaptainBravo

  • Members
  • *
Re: Two actions with a single map click
« Reply #7 on: 23 Mar 2010, 14:10:07 »
INteresting idea, using an invisible h pad. Any chance you can share example mission of above code as I am having issue with helicopters landing where I want them to land.

Thanks.