Features:
- The script is server driven; all task additions and updates are called on server side. All changes are broadcasted to players in one array variable. This enables more work to be done only on server, since most of AI-related things happen there anyway. This way the number of triggers placed goes down, as they are unnecessary for clients (players). Number of publicvariabled variables goes down also.
- Only one eventhandler is created instead of one per task.
- As tasks are kept in an array, no global variable is created for each task.
- No "call compile format" type of coding.
- Variables used to check for task states and statuses are replaced with functions, cutting down number of global variables.
- Usage simplified; briefings are easier to create, some parameters are made optional.
Creating a briefing in init.sqf
Task DataCode:[[ ["Task1","Task1Title","Task1Desc"], ["Task2","Task2Title","Task2Desc",true,["markerTask2",getpos obj2]] ],[ ["Note1","Hello West",WEST], ["Note2","Hello East",EAST], ["Credits","Made by: Shuko of LDD Kyllikki<br />www.kyllikki.fi"] ]] execvm "shk_taskmaster.sqf";
Condition (limiting the units to who the tasks and notes are created)Code:["TaskName","Title","Description",Condition,[Marker],"State",Destination] Required parameters: TaskName string Name used to refer to the task Title string Task name shown in the in/game task list Description string Task description, the actual text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the task is added to. Default is everyone Marker array Marker related to the task. It will be created only for the units who have the task. Marker will be hidden after task is completed. Can be an array of marker arrays, if you want to create multiple markers. Name string Name of the marker to create. Position string Position of the marker. Type string Marker type. Optional, default is "selector_selectedMission". Color string Marker color. Optional, default is red. State string Task state of the newly created task. Default is "created". Destination object/position/marker Place to create task destination (game's built-in waypoint/marker). If an object is given, setSimpleTaskTarget command is used, attaching the destination to it.
Then there is the IF syntax, so you can create a condition anyway you want, where _x is the unit (=player).Code:Examples: [...,WEST] All playable units on BLUFOR (WEST) [...,"USMC"] Faction USMC [...,grpMarine1] Units that belong to group named grpMarine1 [...,myDude] Unit named myDude
TaskStateCode:Examples: "((group _x == grpScouts) OR (_x == pilot1))" Members of grpScouts and unit named pilot1 "(typeof _x == ""CDF_Soldier_Sniper"")" All CDF snipers
The task state of the newly created task. Valid states are succeeded, failed, canceled and assigned. Default is assigned.
Note Data
Code:[NoteTitle,NoteText,Condition] Required parameters: NoteTitle string Text shown in the list NoteText string The actual note text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the note is added to. Default is everyone.
Updating tasks
Task states are updated by calling a function. Possible states are: succeeded/failed/assigned/canceled.
It's possible to set state of one task and set another as assigned using an optional 3rd parameter.Code:Example: ["Task1","succeeded"] call SHK_Taskmaster_upd;
This will make task state of task Task1 to succeeded and the state of the task Task2 as current.Code:Example: ["Task1","succeeded","Task2"] call SHK_Taskmaster_upd;
Another optional 3rd parameter can be used to add a new task after updating another task.
This will make task Task1 as succeeded and create a new task Task2. Same set of parameters is used for the creation as in init.sqf or SHK_Taskmaster_add.Code:Example: ["Task1","succeeded",["Task2","Title","Desc"]] call SHK_Taskmaster_upd;
Creating tasks during a mission
Tasks can be added after briefing with the add function. Same set of parameters is used as in creating a briefing. The new task is set as current task automatically.
Code:Example: ["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;
Functions
SHK_Taskmaster_isCompleted
This function can be used to check if a task is completed. Task is considered completed with states succeeded, failed and canceled. Function returns a boolean (true/false) value.
SHK_Taskmaster_getAssignedCode:Example: "Task1" call SHK_Taskmaster_isCompleted
Returns list of tasks which have "assigned" as their state.
SHK_Taskmaster_getStateCode:Example: call SHK_Taskmaster_getAssigned Example result: ["Task1","Task4"]
Returns the task state (succeeded/failed/canceled/assigned/created).
SHK_Taskmaster_hasStateCode:Example: "Task1" call SHK_Taskmaster_getState
Checks if a task's state matches the given state. Function returns a boolean value.
SHK_Taskmaster_hasTaskCode:Example: ["Task1","succeeded"] call SHK_Taskmaster_hasState
Checks if a task with the given name has been created. Returns boolean.
SHK_Taskmaster_addNote (client side only)Code:Example: "Task1" call SHK_Taskmaster_hasTask
Creates a briefing note. This can only be used on client side, and it's not boardcasted for other players.
Parameters: ["Title","TextBody",Condition], Condition is optional.
Code:Example: ["Enemy forces","Oh noes, there will be enemy soldiers in the area of operation."] call SHK_Taskmaster_addNote
Files
shk_taskmaster.sqf
Example mission
I'm sure there are something to fix, add and change. Don't be afraid to ask for instructions, give feedback or report bugs.
HOME 



Reply With Quote




