OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: rcmw on 04 Mar 2010, 16:39:44

Title: Two actions with a single map click
Post by: rcmw 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.
Title: Re: Two actions with a single map click
Post by: JamesF1 on 04 Mar 2010, 17:59:53
Code: [Select]
onMapSingleClick "unit setPos _pos; "mark" setMarkerPos _pos; onMapSingleClick """";";
Title: Re: Two actions with a single map click
Post by: rcmw 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.
Title: Re: Two actions with a single map click
Post by: Wolfrug 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.
Title: Re: Two actions with a single map click
Post by: bedges on 04 Mar 2010, 19:50:52
Er, it is.

Code: [Select]
onMapSingleClick {unit setpos _pos; "mark" setMarkerPos _pos}
 ::)
Title: Re: Two actions with a single map click
Post by: JamesF1 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:
Title: Re: Two actions with a single map click
Post by: rcmw on 05 Mar 2010, 21:58:06
Thanks everyone, that now works fine, would never have worked that one out.
Title: Re: Two actions with a single map click
Post by: CaptainBravo 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.