Jump to content
Sign in to follow this  
eagledude4

Personal waypoints through script

Recommended Posts

Spent a good 15 minutes looking around for how to do this only to come up with results for AI waypoints. I'm trying to add the waypoint (when you shift click on the map) to a certain location through a script.

Share this post


Link to post
Share on other sites

That thing is a bit of an enigma but this may help, it's a function that allows a temporary deviation from a set task, or simply creates a HUD marking at the given position if there is no current task, It's yellow instead of green and gets deleted if you move within 2m. You can use it many times - the current task is always reassigned after you move to the symbol:

//init.sqf
[] call compile preprocessFile "fnc_NavPnt.sqf";
//do this where you need to
nul = [player, getMarkerPos "markerName"] spawn fnc_NavTask;

fnc_NavPnt.sqf

fnc_NavTask = {

private ["_grpLog","_unit","_pos","_curTsk","_navTsk","_HQctrlog"];

_unit = _this select 0;           
_pos = _this select 1;
_curTsk = currentTask _unit;

if ({side _x == sideLogic} count (allMissionObjects 'Logic') == 0) then 
{
   _HQctrLog = createCenter sideLogic;
};

if (isNil "navTaskLogic1") then 
 {
   _grpLog = createGroup sideLogic;
   navTaskLogic1 = (_grpLog) createunit ["Logic",[0,0,0],[],0,"NONE"];
 };

navTaskLogic1 setPos _pos;

_navTsk = _unit createSimpleTask ["MoveTo"];
_navTsk setSimpleTaskDescription ["Move to HUD marker", "Navigation Task", "MoveTo"];
_navTsk setSimpleTaskTarget [navTaskLogic1, true];
_unit setCurrentTask _navTsk;
_navTsk setTaskState "Assigned";

waitUntil {_unit distance navTaskLogic1 <2};
 _unit removeSimpleTask _navTsk;

   if (!(isNil "_curTsk")) then 
  {
   _unit setCurrentTask _curTsk;
  };
};

Edited by Mattar_Tharkari

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
Sign in to follow this  

×