Jump to content

[Release]Locate Ore Veins Script


_Jack

Recommended Posts

Hey guys, here is a simple script I made that allows players to scan for ore veins. I no longer run arma 2 servers so I decided to release some of the scripts I used!

Hope you find it useful! :)

//Range that it will scan for veins
ScanRange = 1500;

//Get number of each vein within defined range
VeinsCountIron = count ((position player) nearObjects ["Iron_Vein_DZE",ScanRange]);
VeinsCountSilver = count ((position player) nearObjects ["Silver_Vein_DZE",ScanRange]);
VeinsCountGold = count ((position player) nearObjects ["Gold_Vein_DZE",ScanRange]);

//Get total veins
VeinsCountTotal = VeinsCountGold+VeinsCountSilver+VeinsCountIron;

//Display results to player
systemChat format["[IG]Within %1M there are %2 ore veins: %3 Iron, %4 Silver and %5 Gold.",ScanRange,VeinsCountTotal,VeinsCountIron,VeinsCountSilver,VeinsCountGold];

format["[IG]Within %1M there are %2 ore veins: %3 Iron, %4 Silver and %5 Gold.",ScanRange,VeinsCountTotal,VeinsCountIron,VeinsCountSilver,VeinsCountGold] call dayz_rollingMessages;

 

Link to comment
Share on other sites

Thank you for this. Would you happen to have an idea on how to add a General direction such as N,NE,E,SE,S,SW,W,NW or if not then a direction in Degrees Relative?

Such as 1 Silver Vein 140, 1 Iron Vein 224

I am pretty sure it would need to use the following but I really do not know how to implement it.

_dir = [player, object] call BIS_fnc_relativeDirTo;

 

Link to comment
Share on other sites

Could try something similar to this;

_dir = [player, VeinsCountIron] call BIS_fnc_relativeDirTo
systemchat format ["There is %1 Iron vein at %2 on compass",VeinsCountIron,_dir];

Might have to play around with foreach.

Could cause lag if there are a lot of gems nearby though.

Link to comment
Share on other sites

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"];

 

Link to comment
Share on other sites

  On 8/23/2017 at 9:57 AM, 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?

Expand  

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:

  Reveal hidden contents

 

Link to comment
Share on other sites

@Ford

I just tried this and it is showing the direction to the ore vein based on the direction you are facing. For example:

If I am facing true north and the _nearest ore vein is to the east, it will display the ore vein is to the east. However, if I am facing east and the _nearest is to the east, it will display that the ore vein is to the north.

In other words, it is displaying the relative direction based on the direction I am facing instead of true north.

Link to comment
Share on other sites

@Zoranth

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

Code:

  Reveal hidden contents

 

Link to comment
Share on other sites

@Ford@jack

Thank You, This works Great. and again, Thank You @jack for the original work

For anyone that wants to use actual Compass Directions in Degree's instead of Points of the Compass (otherwise known as a Compass Rose) you can change the following:

  Reveal hidden contents

If you want to change the output from being displayed in System Chat to Rolling Messages that are in the middle of your screen. Do the following:

  Reveal hidden contents

You could even have two separate files. One that is activated off of the Map that gives the Points of the Compass (General Direction such as NW, W, SE) to the ore vein. Then have the second file that is activated off of the GPS that  gives the actual relative direction from you to the ore vein.

 

 

Link to comment
Share on other sites

  • 2 years later...
  • 4 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...