OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Meatball0311 on 30 Nov 2007, 06:13:11
-
I am wanting to make an airstrike script. What I would like to happen is give the plane three commands via onMapSingleClicks.
1st one the target (clicking once on the map)
2nd the inbound waypoint (by using shift, and click)
3rd the outbound waypoint (by using shift, alt, click)
What commands do I use?
-
The script detects Alt and Shift-clicks by the way of two localized variables, _shift and _alt, that are passed to the script. Does it matter to you if the commands are given in order (i.e., it has to go from position-inbound-outbound) or can you decide which you want to set yourself? In either case, let's say you have a single script for all your actions. It might look something like this. First you tell onMapSingleClick to execute the script:
onMapSingleClick "nil=[_pos, _shift, _alt] execVM ""YourScript.sqf""";
(note the double parenthesises around the script-string)
And then the script itself could look like this:
_pos = _this select 0;
_shift= _this select 1;
_alt = _this select 2;
if (!_alt && !_shift) exitWith
{
hint "This is where you'd put in the code for designating target.";
}:
if (_shift) exitWith
{
hint "Code for inbound";
};
if (_alt) exitWith
{
hint "Code for outbound";
};
Spooner tells me the if-then's are faster than switch...do, so I believe him :D Otherwise that might have been a possible contender as well.
I'm not sure if you can combine shift and alt (i.e., if (_alt && _shift)), but I suppose you can try? Otherwise the above should be enough, methinks. :)
Good luck!
Wolfrug out.
-
u can detect shift + alt clicks :D
and even if if then are faster than switch... i dont see this script as a script dat needs somin fast or somin... and it does do 3 difrent checks...
LCD OUT
-
Please excuse me, but I am a nOOb when it comes to scripting. I still cannot create an onMapSingleClick that you have to press shift + click to place marker. This is what I got so far.
I have a radio Alpha trigger set up to call on my "call4cas.sqs"
I have onMapSingleClick "[_pos] exec "airstrike.sqs"
airstrike.sqs
_pos = _this select 0
_shift = _this select 1
_alt = _this select 2
#target
hint "Check"
_target = createMarker ["target", _pos]
_target setMarkerShape "ICON"
"target" setMarkerType "DESTROY"
~1
hint "SELECT INBOUND WAYPOINT"
onMapSingleClick "(_pos && _shift);true;"
#inbound
_pos2 = _this select 0
_inbound = createMarker ["inbound", _pos2]
_inbound setMarkerShape "ICON"
"inbound" setMarkerType "MOVE"
I am getting error
onMapSingleClick "(_pos && _shift);true;"
type array, expect boolen
I dont know if I am heading in the right direction or have everything screwed up. Please help, oh great script writing wizards :D
-
its da onmapsingleclcik line... u got it wrong :P
u have
"[_pos] exec "airstrike.sqs"
and u need
onMapSingleClick "nil=[_pos, _shift, _alt] exec ""YourScript.sqs""";
also its preferable u start scripting in .sqf scripts :D they look beter ;) :D but dats ur choise :D
LCD OUT