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:
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:
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 !
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: