OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: loki72 on 31 May 2008, 09:54:26

Title: basics of teleport and onMapSingleClick... (solved)
Post by: loki72 on 31 May 2008, 09:54:26
greetings,
i am sure i could not be more vague.. however... ???

if i am in one spot, and i want to hit 'M' and click on the map to teleport to another area.. how would i?

if i had an addaction;

Code: [Select]
player addAction ["gotoA","scripts\tele.sqf"];
how does the onMapSingleClick connect to the addAction?

thanks
Title: Re: basics of teleport and onMapSingleClick...
Post by: Mandoble on 31 May 2008, 10:47:53
 :blink:
You simply put the onMapSingleClick command inside the action script tele.sqf and a title text asking for map click.
Code: [Select]
// tele.sqf
titleText["Select Map Position", "PLAIN"];
onMapSingleClick "vehicle player setPos _pos; onMapSingleClick '';true;";

Note that onMapSingleClick ''; is with two single quotes.
Title: Re: basics of teleport and onMapSingleClick...
Post by: loki72 on 31 May 2008, 15:20:36
 :D

i laughed for 5 minutes... i had only wished it was that simple.. thank you.
Title: Re: basics of teleport and onMapSingleClick... (solved)
Post by: Rommel92 on 01 Jun 2008, 03:45:19
Mandoble, is there any way to check for the "shift" inside the
Code: [Select]
titleText["Select Map Position", "PLAIN"];
onMapSingleClick "vehicle player setPos _pos; onMapSingleClick '';true;";

Perhaps:
titleText["Shift-Click Map Position", "PLAIN"];
onMapSingleClick "If (_shift) then {vehicle player setPos _pos; onMapSingleClick ''};;true;";

Title: Re: basics of teleport and onMapSingleClick... (solved)
Post by: Mandoble on 01 Jun 2008, 10:44:49
You may check for shift and alt (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=o#239) states.
Title: Re: basics of teleport and onMapSingleClick... (solved)
Post by: Rommel92 on 01 Jun 2008, 12:27:14
I don't think you understood the question I was asking, I meant is it possible within the scope of the OnMapSingleClick string/script to be executed, ie within the " ". Rather then launching another script to check for the states of _shift or _alt. Check the script I posted as a possibility, not sure whether it works, and am not unto the liberty to test it at this moment in time.