deleted
deleted
Last edited by famematt; Oct 10 2012 at 14:32.
quick and easy is to use hint combined with format, wich will give a silent hint in top right corner of screen, difficult is to use dialogs, wich i dont know much about.
you might also want these commands:
speed
distance
onMapSingleClick
while loops
My scripts:
Spoiler:
what to do when posting any kind of code dammit!!
Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.
deleted
Last edited by famematt; Oct 10 2012 at 14:32.
onMapSingleClick returns the position of the click as _pos which you can then use to figure out the distance between your current position and _pos.
Be careful with _pos wrt onMapSingleClick, as _pos select 2 gives negative output - or something. Get into the habit of using [_pos select 0, _pos select 1, 0] instead. I don't know, it's a really weird one that one...
Regards
Carl Gustaffa - left this game due becoming Steam Exclusive
this is one way to track distance to shift click on map:
1: add this in unit init:
for testing purposes i placed the hint part in init aswell.Code:destination = []; onMapSingleClick "if (_shift) then {destination = _pos;}; true;"
Code:_null = [] spawn { waitUntil {(count destination) != 0}; _showMe = true; while {_showMe} do { _veh = vehicle player; _speed = round (speed _veh); _pos = [destination select 0, destination select 1,0]; _dist = round (_veh distance _pos); hintSilent format["speed of vehicle is %1 km/h \n distance to destination is %2 meter",_speed,_dist]; sleep 1; }; };
deleted
Last edited by famematt; Oct 10 2012 at 14:32.
_localVariable = 0; // this can only be acessed from within its script. underscore in front.
globalVariable = 0; // this can be acessed from anywhere, no undercore in front.
deleted
Last edited by famematt; Oct 10 2012 at 14:32.
just a note on global variables, in MP you need to use the publicVariable command also to broadcast the variable to all clients, this ofc if clients need to "know" the variable.
for table (one similar to Sqlite or Mysql?), i dont know what you mean, sorry.
for finding a string in a array use in command:
you can also find its position in the array like this with find command:Code:_myArray_With_Strings = ["hello","mom","bruce"]; if ("hello" in _myArray_With_Strings) then { hint "its there"; } else { hint "its not there"; };
note that find command gives the select number so first one will be 0, second one 1, unlike count wich will use 1 for 1 and 2 for 2.Code:_myArray_With_Strings = ["hello","mom","bruce"]; if ("hello" in _myArray_With_Strings) then { _sel = _myArray_With_Strings find "hello"; hint format["string is number %1 in the array",_sel]; };
Last edited by Demonized; Jun 24 2011 at 12:17.