Jump to content

Ford

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Ford

  1. 27 minutes ago, WLF said:

    https://yadi.sk/i/4FmOuv7-3RBLET - text on that button (in red box) not completely displayed - 

    
    https://github.com/oiad/remoteVehicle/blob/dc58639b6e1a11d82987434076d0d058c404745d/scripts/remoteVehicle/remoteVehicle.hpp#L288

    (double minus for testing).

    https://yadi.sk/i/ZLA3_hCJ3RBLQc - can't find that text (in red box, and "price to claim...") in other dialog) for translate.

    Yes, bugs with displaying some strings in game are possible, since I didnt test them. Please create pull request on GitHub with your own version for it. We will be grateful to you.

  2. @Zoranth

    Yeah, you are right. I just edited script and used other function to get real direction to object.

    Code:

    Spoiler
    
    /**
    	Config.
    */
    _scanRange = 1500; // Scanning range.
    _showAllVeines = true; // Show how many each ore vines are in range. E.g. Within 1500m there are 3 Ore Veins: 2 Iron, 0 Silver and 1 Gold.
    _showNearestIronOreVine = true; // Show nearest iron ore vine with distance and direction. 
    _showNearestSilverOreVine = true;  // Show nearest silver ore vine with distance and direction. 
    _showNearestGoldOreVine = true;  // Show nearest gold ore vine with distance and direction. 
    
    _findObj = {
    	private ["_class","_pos","_range","_objects","_objCount","_nearest"];
    	_class = _this select 0;
    	_pos = _this select 1;
    	_range = _this select 2;
    	_nearest = objNull;
    	
    	_objects = nearestObjects [_pos, [_class], _scanRange];
    	_objCount = count _objects;
    	
    	if (_objCount > 0) then {
    		_nearest = _objects select 0;
    	};
    	
    	[_objCount, _nearest]
    };
    
    _revealNearest = {
    	private ["_name","_nearest"];
    	_name = _this select 0;
    	_nearest = _this select 1;
    	
    	_degree = round ([player, _nearest] call BIS_fnc_dirTo);
    	if (_degree < 0 ) then { _degree = 360 + _degree };
    	_distance = floor (player distance _nearest);
    	
    	_direction = call {
    		if ((_degree >= 0 && _degree < 45) || _degree == 360) exitWith { 'North' };
    		if (_degree >= 45 && _degree < 90) exitWith { 'NorthEast' };
    		if (_degree >= 90 && _degree < 135) exitWith { 'East' };
    		if (_degree >= 135 && _degree < 180) exitWith { 'SouthEast' };
    		if (_degree >= 180 && _degree < 225) exitWith { 'South' };
    		if (_degree >= 225 && _degree < 270) exitWith { 'SouthWest' };
    		if (_degree >= 270 && _degree < 315) exitWith { 'West' };
    		if (_degree >= 315 && _degree < 360) exitWith { 'NorthWest' };
    		"unknown"
    	};
    	
    	systemChat format["Nearest %1 Ore Vein in %2m on the %3.", _name, _distance, _direction];
    };
    
    _pos = getPosATL player;
    
    _ironVeins = ["Iron_Vein_DZE", _pos, _scanRange] call _findObj;
    _silverVeins = ["Silver_Vein_DZE", _pos, _scanRange] call _findObj;
    _goldVeins = ["Gold_Vein_DZE", _pos, _scanRange] call _findObj;
    
    _ironCount = _ironVeins select 0;
    _silverCount = _silverVeins select 0;
    _goldCount = _goldVeins select 0;
    
    if (_showAllVeines) then {
    	_total = _ironCount + _silverCount + _goldCount;
    	
    	if (_total > 0) then {
    		systemChat format["Within %1m there are %2 Ore Veins: %3 Iron, %4 Silver and %5 Gold.", _scanRange, _total, _ironCount, _silverCount, _goldCount];
    	} else {
    		systemChat format["Within %1m there are no Ore Vines.", _scanRange];
    	};
    };
    	
    if (_showNearestIronOreVine && _ironCount > 0) then {
    	["Iron", (_ironVeins select 1)] call _revealNearest;
    };
    if (_showNearestSilverOreVine && _silverCount > 0) then {
    	["Silver", (_silverVeins select 1)] call _revealNearest;
    };
    if (_showNearestGoldOreVine && _goldCount > 0) then {
    	["Gold", (_goldVeins select 1)] call _revealNearest;
    };

     

  3. On 23.08.2017 at 0:57 PM, Zoranth said:

    Thank you Ford for the variation. I will give it a try.

    I have already added this to my clickactions off of the Compass

    Also, what is your take on providing a direction to an ore vein type from player position? Any Ideas?

    I modified the script a bit. Now it shows nearest iron, silver and gold ore vines, distance to it and direction too.

    E.g.

    bcbf449762514528ad233547f474d0b5.jpg

    Code:

    Spoiler
    
    private ["_ironVeins","_silverVeins","_goldVeins"];
    
    /**
    	Config.
    */
    _scanRange = 1500; // Scanning range.
    _showAllVeines = true; // Show how many each ore vines are in range. E.g. Within 1500m there are 3 Ore Veins: 2 Iron, 0 Silver and 1 Gold.
    _showNearestIronOreVine = true; // Show nearest iron ore vine with distance and direction. 
    _showNearestSilverOreVine = true;  // Show nearest silver ore vine with distance and direction. 
    _showNearestGoldOreVine = true;  // Show nearest gold ore vine with distance and direction. 
    
    _findObj = {
    	private ["_class","_pos","_range","_objectsArray","_nearest"];
    	_class = _this select 0;
    	_pos = _this select 1;
    	_range = _this select 2;
    	_objectsArray = [];
    	_nearest = "";
    	
    	{
    		_objectsArray set [count _objectsArray, _x];
    		if (_forEachIndex == 0) then {
    			_nearest = _x;
    		};
    	}
    	forEach nearestObjects [_pos, [_class], _scanRange];
    	
    	[_objectsArray, count _objectsArray, _nearest]
    };
    
    _revealNearest = {
    	private ["_name","_nearest"];
    	_name = _this select 0;
    	_nearest = _this select 1;
    	
    	_degree = round (abs ([player, _nearest] call BIS_fnc_relativeDirTo));
    	_distance = floor (player distance _nearest);
    	
    	_direction = call {
    		if ((_degree >= 0 && _degree < 45) || _degree == 360) exitWith { 'North' };
    		if (_degree >= 45 && _degree < 90) exitWith { 'NorthEast' };
    		if (_degree >= 90 && _degree < 135) exitWith { 'East' };
    		if (_degree >= 135 && _degree < 180) exitWith { 'SouthEast' };
    		if (_degree >= 180 && _degree < 225) exitWith { 'South' };
    		if (_degree >= 225 && _degree < 270) exitWith { 'SouthWest' };
    		if (_degree >= 270 && _degree < 315) exitWith { 'West' };
    		if (_degree >= 315 && _degree < 360) exitWith { 'NorthWest' };
    		"unknown"
    	};
    	
    	systemChat format["Nearest %1 Ore Vein in %2m on the %3.", _name, _distance, _direction];
    };
    
    _pos = getPosATL player;
    
    _ironVeins = ["Iron_Vein_DZE", _pos, _scanRange] call _findObj;
    _silverVeins = ["Silver_Vein_DZE", _pos, _scanRange] call _findObj;
    _goldVeins = ["Gold_Vein_DZE", _pos, _scanRange] call _findObj;
    
    _ironCount = _ironVeins select 1;
    _silverCount = _silverVeins select 1;
    _goldCount = _goldVeins select 1;
    
    if (_showAllVeines) then {
    	_total = _ironCount + _silverCount + _goldCount;
    	if (_total > 0) then {
    		systemChat format["Within %1m there are %2 Ore Veins: %3 Iron, %4 Silver and %5 Gold.", _scanRange, _total, _ironCount, _silverCount, _goldCount];
    	} else {
    		systemChat format["Within %1m there are no Ore Vines.", _scanRange];
    	};
    };
    	
    if (_showNearestIronOreVine && _ironCount > 0) then {
    	["Iron", (_ironVeins select 2)] call _revealNearest;
    };
    if (_showNearestSilverOreVine && _silverCount > 0) then {
    	["Silver", (_silverVeins select 2)] call _revealNearest;
    };
    if (_showNearestGoldOreVine && _goldCount > 0) then {
    	["Gold", (_goldVeins select 2)] call _revealNearest;
    };

     

  4. Thank you for the script. Also, its more clearly to use:
    - getPosATL instead of position player (getPos), that slower in 1.67 times.
    - local variables instead of global.

    My variant:

    //Range that it will scan for veins
    _scanRange = 1500;
    
    //Get number of each vein within defined range
    _pos = getPosATL player;
    _ironVeins = count (_pos nearObjects ["Iron_Vein_DZE",_scanRange]);
    _silverVeins = count (_pos nearObjects ["Silver_Vein_DZE",_scanRange]);
    _goldVeins = count (_pos nearObjects ["Gold_Vein_DZE",_scanRange]);
    
    //Get total veins
    _total = _ironVeins + _silverVeins + _goldVeins;
    
    //Display results to player
    systemChat format["Within %1m there are %2 ore veins: %3 Iron, %4 Silver and %5 Gold.", _scanRange,_total,_ironVeins,_silverVeins,_goldVeins];

    If you are using "Deploy Anything" script, its so simple to add script handler on right click on, e.g. map.

    DZE_CLICK_ACTIONS = DZE_CLICK_ACTIONS + ["ItemMap","Find Ore Veins","execVM 'scripts\findOreVeins.sqf';","true"];

     

×
×
  • Create New...