English Dynamic Markers

Yuri Zoko

Leader
Membre du personnel
31/3/20
462
77
62
1 300
Following several requests, I make a simple but effective tutorial that will allow you to MOVE a marker to a random position from an array.

To start, you will have to create a file in the folder life_server\Functions\Systems which will be called "fn_dynMarkers.sqf", add in it :
[CODE title="fn_dynmarkers.sqf"]/*
Author: Yuri Zoko
Web site: www.the-programmer.com
Discord: discord.the-programmer.com

Terms of use:

- This file is forbidden unless you have permission from the author. If you have this file without permission to use it please do not use it and do not share it.
- If you have permission to use this file, you can use it on your server however it is strictly forbidden to share it.
- Out of respect for the author please do not delete this information.

EXAMPLE :

_var = [[pos 1 XYZ], [pos 2 XYZ], [pos 3 XYZ]];
"name_marker" setMarkerPos (selectRandom _var);

*/
_weed = [[11561.5,7040.28,0],[11586.8,9060.27,0],[7454.65,12307,0]];
"weed_1" setMarkerPos (selectRandom _weed);[/CODE]

We will better understand the code:

We define the different positions of the desired marker (for example: Kavala, Athira, Pyrgos), at the server startup, the script will select 1 random position and move the marker present on the map (in the example "weed_1", on the random position). You can add as many random position as you want, just add data to the array:
Code:
_var = [[XYZ], [XYZ], [XYZ], [XYZ], [XYZ], [etc.....]];

To know the desired position for the marker, teleport to the desired location and type in the debug console:
[CODE title="debug"]getPos player[/CODE]

Once your markers and their positions are set, go to the life_server init and add all of them at the end:
Code:
[] execVM "\life_server\Functions\Systems\fn_dynMarkers.sqf";

Enjoy ! You've managed to create dynamic markers (which can be used to create random farm road, etc).

If you like this tutorial more, don't hesitate to put a little like to motivate me to do more ! :)
 
Dernière édition:
  • Like
Les réactions: IceEagle132 et Mathis
Plop!
Great initiative, thanks to you Yuri for this tutorial!

I specify that to have access to the debug console, you have to do in the chat (basic ! key) :
Code:
#login adminpassword

Then you will have "Logged in as Administrator".
And you will be able to do Escape and have access to it. With infiStar, it seems to me that F3 also gives access to the debug console!
 
Not bad I used mine like this:
[CODE lang="cpp" title="fn_dynMarkers.sqf"]#include "\life_server\script_macros.hpp"
/*
File: fn_dynMarkers.sqf
Author: Yuri Zoko
Web site: www.the-programmer.com
Discord: discord.the-programmer.com

Terms of use:
- This file is forbidden unless you have permission from the author. If you have this file without permission to use it please do not use it and do not share it.
- If you have permission to use this file, you can use it on your server however it is strictly forbidden to share it.
- Out of respect for the author please do not delete this information.
*/
private _stayTime = LIFE_SETTINGS(getNumber, "fields_position_time");
_weed = [[11556.4,7048.07,0],[4219.25,20464.5,0],[15880.5,18843.8,0]];
_heroin = [[19879,17006.7,0],[8331.38,20787.2,0],[9659.47,8852.26,9.53674e-007]];
_cocaine = [[13462.2,20630.8,0],[5188.2,20872.7,0],[25915.7,20678,0]];

/* Weed Field */
private _weed_field1 = createMarker ["weed_1", selectRandom _weed];
"weed_1" setMarkerColor "ColorRed";
"weed_1" setMarkerType "mil_dot";
"weed_1" setMarkerText "Weed Field";
_w1 = getMarkerPos "weed_1";
private _drug1 = createMarker ["w_field",_w1];
"w_field" setMarkerColor "ColorWhite";
"w_field" setMarkerType "empty";
"w_field" setMarkerShape "ELLIPSE";
"w_field" setMarkerSize [35, 35];

/* Heroin Field */
private _heroin_field1 = createMarker ["heroin_1", selectRandom _heroin];
"heroin_1" setMarkerColor "ColorRed";
"heroin_1" setMarkerType "mil_dot";
"heroin_1" setMarkerText "Heroin Field";
_h1 = getMarkerPos "heroin_1";
private _drug2 = createMarker ["h_field",_h1];
"h_field" setMarkerColor "ColorWhite";
"h_field" setMarkerType "empty";
"h_field" setMarkerShape "ELLIPSE";
"h_field" setMarkerSize [35, 35];

/* Cocaine Field */
private _cocaine_field1 = createMarker ["cocaine_1", selectRandom _cocaine];
"cocaine_1" setMarkerColor "ColorRed";
"cocaine_1" setMarkerType "mil_dot";
"cocaine_1" setMarkerText "Cocaine Field";
_c1 = getMarkerPos "cocaine_1";
private _drug3 = createMarker ["c_field",_c1];
"c_field" setMarkerColor "ColorWhite";
"c_field" setMarkerType "empty";
"c_field" setMarkerShape "ELLIPSE";
"c_field" setMarkerSize [35, 35];

[3,"<t align='center'><t size='2.4'><t color='#FF0000'>Drug Fields</t></t><br/> The Drug Fields have found a new place to grow!"] remoteExecCall ["life_fnc_broadcast",0];
diag_log "..:: Drug Fields - Loaded ::..";

sleep(_stayTime * 60);
[3,"<t align='center'><t size='2.4'><t color='#FF0000'>Drug Fields</t></t><br/> The Drug Fields are moving to a new location. There new location will be marked on map soon!"] remoteExecCall ["life_fnc_broadcast",0];
deleteMarker "weed_1";
deleteMarker "heroin_1";
deleteMarker "cocaine_1";
deleteMarker "w_field";
deleteMarker "h_field";
deleteMarker "c_field";

diag_log "..:: Drug Fields - Removed ::..";
[] spawn TON_fnc_initFields;[/CODE]
 
  • Like
Les réactions: Mathis et Yuri Zoko