Jump to content
david-grylls

Attaching BIS_fnc_taskCreate to a Moving Marker

Recommended Posts

G'day my ArmA Friends!

I'm developing a mission that see's you at one point escort a HELO to an insertion point. I'm trying to attach the Task Destination/Waypoint to the marker. I originally was using the old ArmA 2 createSimpleTask code which actually did work and attached my waypoint to the marker as the HELO flew around. However when I ran the the createSimpleTask script it would not show the popup box saying mission assigned. I later found that ArmA 3 added the BIS_fnc_taskCreate which is easier to use and does show the popup however I'm struggling to find a way to attach it to my HELO. I am aware there is a BIS_fnc_taskSetDestination but no documentation that helps me exists. 

 

I'm going to attach the createSimpleTask code that actually worked alongside the BIS_fnc_taskCreate code that I'm trying to update to.

 

What I WAS using:

init.sqf that Attaches my Mark_Medi marker to the HELO:

[] spawn {
while{not isnull Heli1} do {"Mark_Medi" setmarkerpos getpos Heli1; A_MEDI_TASK setSimpleTaskDestination (getMarkerPos "Mark_Medi"); sleep 0.5};
};

createSimpleTask script:

A_MEDI_TASK = player createSimpleTask ["Escort MEDIVAC"];
A_MEDI_TASK setSimpleTaskDescription [
   "Act as an escort for the <marker name='Mark_Medi'>MEDIVAC</marker> HELO as it makes its insertion to extract the critically wounded troops.'",
   "Escort MEDIVAC",
   "Escort MEDIVAC"
];
A_MEDI_TASK setTaskState "CREATED";

 

So that code above worked when I fired a Trigger that executed the script. However using that code means it won't show the popup. Here is what I 'upgraded'.

What I tried updating to:

_Pos1 = getMarkerPos "Mark_Medi";
[group player,["Tsk1"],["Escort the HELO","Escort HELO","Escort HELO"],[_Pos1],1,2,true] call BIS_fnc_taskCreate;

Now because the HELO is moving I did also try putting BIS_fnc_taskSetDestination into a loop but still nothing seems to work. I'm sure there is an answer to this and I'm making things 50x harder but hey I'm learning. 

 

Cheers for the help in advance,

David-Grylls
 

 
 

 

Share this post


Link to post
Share on other sites

The solution should be much simpler. 

 

BIS_fnc_taskSetDestination allows you to attach the destination to an object. No loops are needed.

["Tsk1",[Heli1,true]] call BIS_fnc_taskSetDestination

"true" attaches the destination to the precise location of the object. If set to "false", the position known to the owner of the task is used instead.

 

 

Also, BIS_fnc_setTask is a good one-step solution for creating/modifying tasks.

Share this post


Link to post
Share on other sites
["Tsk1",[Heli1,true]] call BIS_fnc_taskSetDestination

 

Worked perfectly. I see where I was going wrong now and how I could have just attached it to Heli1 instead. 

 

Thank you very much ted_hou!

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

×