Jump to content

Recommended Posts

Im looking for a script that allow players in a dedicated srv spawn custom tasks with a map click for location. A few years ago I played with a unit that uses a script to generate practice tasks. It was very simple, you interact with an object then choose a task type from a lists and then just click on the map to generate the task. It was very simple: click on the flag, click on the Tasks Options screen, click on map, play!

Share this post


Link to post
Share on other sites

Damnit. If only Bohemia included a module that let you do EXACTLY this like say a Game Master Curator or something. You could create missions on the fly etc. What a great idea.

 

Damn you Zeus Damn you all to hell!

Share this post


Link to post
Share on other sites

Markers are very handy!

The only thing you can't have is the task state changing, that you can't have with a "task on the fly", anyway (lack of condition).

 

Now, it's possible to script for an automatic hint, or even creation of a standard task, when positioning a marker...

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

Markers are very handy!

The only thing you can't have is the task state changing, that you can't have with a "task on the fly", anyway (lack of condition).

 

Now, it's possible to script for an automatic hint, or even creation of a standard task, when positioning a marker...

or do something tricky like, regular click is just a move task.

shift click is a attack task,

ctrl click is a defend task, 

etc. 

Share this post


Link to post
Share on other sites

So, I wrote a little code for anyone who like to auto create  tasks with the "action" markers: objective, ambush, destroy, join, pickup.

 

For evident reason, the others ones are not impacted! (default dot for example)

The action marker is faded, becomes a red circle around the task, and the task is created.

To remove the task, delete the marker.

No succeeded/failed/canceled  states for these tasks. (no condition filled)

Marker channels serve the tasks also (global for all players, group for group, vehicle for crew ... why not?)

Icons depend on the type of marker, the text of the marker is displayed as description of the task.

 

In init.sqf, or any running field on each PC.
 

_MGI_taskOnMarker = addMissionEventHandler ["map",{
  if (_this select 0) then {
    [] spawn {
      _mks = allMapMarkers;
      private ["_tgt","_tgtText","_mk"];
      while {visibleMap && hasInterface} do {
        waitUntil {!(_mks isEqualTo allMapMarkers)};
        if (count allMapMarkers > 0) then {
          _mk = allMapMarkers select (count allMapMarkers - 1);
          _mkType = markerType _mk;
          if (_mkType in ["hd_objective","hd_ambush","hd_destroy","hd_pickup","hd_join"]) then {
            _mkText = markerText _mk;
            _mkPos = getMarkerPos _mk;

            _tskType = switch (_mkType) do {
              case "hd_objective": {"target"};
              case "hd_ambush": {"attack"};
              case "hd_destroy": {"destroy"};
              case "hd_pickup": {"interact"};
              case "hd_join": {"meet"};       
            };
            _mkTitle = switch (_mkType) do {
              case "hd_objective": {"new objective"};
              case "hd_ambush": {"ambush here"};
              case "hd_destroy": {"destroy"};
              case "hd_pickup": {"pick up"};
              case "hd_join": {"join"}
            };
            _channel = _mk select [count _mk - 1];
            call {
              if (_channel == "0") exitWith {_tgt = true; _tgtText = "all!"};
              if (_channel == "1") exitWith {_tgt = side player; _tgtText = "our camp!"};
              if (_channel == "2") exitWith {_tgt = allPlayers select {side _x == side player && _x == leader _x}; _tgtText = "our camp!"};
              if (_channel == "3") exitWith {_tgt = Group player; _tgtText = "our group!"};
              if (_channel == "4") exitWith {_tgt = crew vehicle player; _tgtText = "our crew!"};
              _tgt = player; _tgt = "ourselves!"
            };

            _tsk = [_mk, _tgt, ["new task for " + format [_tgtText  + toString [60,98,114,47,62] + _mkText],_mkTitle,_mk], _mkPos, "AUTOASSIGNED", 1, true, true, _tskType, false] call BIS_fnc_setTask;
            _mk setMarkertype "mil_circle";
            _mk setMarkerAlpha 0.7;
            _mk setMarkerColor "colorRed";
            [_tsk,_mk] spawn {
              params ["_tsk","_mk"];
              waitUntil {sleep 0.5; !(_mk in allMapMarkers)};
              [_mk] call BIS_fnc_deleteTask;
            };
          };
        };
        _mks = allMapMarkers;
      };
    };
  };
}];

 

Have fun!

Pierre

 

 

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

×