Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Server side hud scripty thingy

  1. #1

    Server side hud scripty thingy

    deleted
    Last edited by famematt; Oct 10 2012 at 14:32.

  2. #2
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    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.

  3. #3
    deleted
    Last edited by famematt; Oct 10 2012 at 14:32.

  4. #4
    Quote Originally Posted by famematt View Post
    Now, How do i get the distance from the Shift+Click marker?
    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.

  5. #5
    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

  6. #6
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    this is one way to track distance to shift click on map:

    1: add this in unit init:
    Code:
    destination = [];
    onMapSingleClick "if (_shift) then {destination = _pos;}; true;"
    for testing purposes i placed the hint part in init aswell.

    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; 
    };
    
    };

  7. #7
    deleted
    Last edited by famematt; Oct 10 2012 at 14:32.

  8. #8
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    _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.

  9. #9
    deleted
    Last edited by famematt; Oct 10 2012 at 14:32.

  10. #10
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    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:
    Code:
    _myArray_With_Strings = ["hello","mom","bruce"];
    if ("hello" in _myArray_With_Strings) then {
       hint "its there";
    } else {
       hint "its not there";
    };
    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 {
       _sel = _myArray_With_Strings find "hello";
       hint format["string is number %1 in the array",_sel];
    };
    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.
    Last edited by Demonized; Jun 24 2011 at 12:17.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •