Jump to content
iV - Ghost

Get editor placed marker from array

Recommended Posts

I wanna make a script called by a addAction (local on executing pc) which spawns a minefield on a random marker placed in the editor. If I test in singleplayer everything seems ok. But if I test it on my dedicated server the task icon is on the correct place but my area marker (red ellipse with 45° stripes) isn't there. The file will be remoteExec ["execVM", 0, true] on every client and the server. Maybe somebody has a tip for me. My script as follow:

 

Task_LM.sqf

// VARIABLES
private _randomMarker = iV_TaskMarkerLM deleteAt floor random (count iV_TaskMarkerLM);
publicVariable "iV_TaskMarkerLM";

private _taskID = format ["T_%1", _randomMarker];
private _taskMarker = _randomMarker;
private _taskTitle = localize "STR_iV_TaskTitle_Landmines";
private _taskDescription = localize "STR_iV_TaskDesc_Landmines";
private _taskMarkerType = "mine";
private _parentTask = "IDAP";


// CREATE PARENT AND CHILD TASK
call iV_fnc_taskCreate;


// CREATE MINES & MARKER
["M_TaskLM", getMarkerPos _randomMarker, 30, "APERSMine", [8, 9, 10]] call iV_fnc_minesCreate;  // if (!isServer) exitWith {};


// TIMEOUT & TRIGGER END
sleep 60;

waitUntil {

    sleep 5;
    {mineActive _x && _x inArea "M_TaskLM"} count allMines < 6;  // Value < 6 only for faster tests. Later == 0
	
};


// TASK SUCCEEDED
if ({mineActive _x && _x inArea "M_TaskLM"} count allMines < 6) then {

    ["Succeeded"] call iV_fnc_taskState;
    deleteMarker "M_TaskLM";
	
	
    // CHECK AMOUNT OF MARKERS & PUSHBACK TO ARRAY IF TRUE
    if ((count iV_TaskMarkerLM) > 0) then {

        iV_TasksIDAP pushBack "scripts\taskmanager\tasksIDAP\Task_LM.sqf";
        publicVariable "iV_TasksIDAP";
	
    };
	
};

 

I think the problem starts with _randomMarker.

 

 

 

EDIT 1:

 

initServer.sqf

// LAND MINE MARKERS
iV_TaskMarkerLM = [

    "LM_1",
    "LM_2",
    "LM_3"
	
];
publicVariable "iV_TaskMarkerLM";

 

Share this post


Link to post
Share on other sites

maybe set the marker that you place via script or editor to a different shape? then get the shape and if its equal to the one placed in the editor then thats the one you placed via editor?

Share this post


Link to post
Share on other sites

Creating markers by code should work. But it would be much easier to placed the needed markers in the editor.

If you wanna play on some new settings/areas you can drag the marker and play. Nothing more to do.

And if I add a new map I can placed the markers on the wished ao's. This will save a lot of time!

 

More functions for creating weapon boxes or hostages for find and bring back and some other tasks are existing.

Need only a working way for detecting the editor placed marker in mulitplayer for creating a area of operations at this point.

 

Share this post


Link to post
Share on other sites

Nobody who can help me with my problem?

I don't get it work in MP.

 

I think a editor placed marker is local to everyone and the server.

And if I'm using an array with all the variable names from the markers inside and making this as publicVariable everyone should use it.

I can't understand why this doesn't working.

Share this post


Link to post
Share on other sites

Why not work around it and use objects like flagpoles instead of markers?

Just grab their positions and delete them upon mission start.

 

Cheers

Share this post


Link to post
Share on other sites

like stated above, set your editor placed markers of a different type or color from the script placed markers. then use a forEach to cycle through that array of markers, if the color or type equals the editor placed markers then add them to a separate array or whatever you want with it.

Share this post


Link to post
Share on other sites

I've tried now with BIS_fnc_randomPos but my editor placed marker called SM1 doesn't work too.

 

private _randomPos = ["SM1"] call BIS_fnc_randomPos;

Seems that editor placed markers not working this way.

Really strange...

 

 

Thx for the tips with the workarounds. I'll think a bit about it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×