createSimpleTask: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<dd class="note">([^}]*)<code>([^<]*)<\/code>" to "<dd class="note">$1<sqf>$2</sqf>") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 42: | Line 42: | ||
}} | }} | ||
{{Note | |||
|user= Lou Montana | |||
|timestamp= 20110702114500 | |||
|text= *Creating child will position the new task just under the parent task. | |||
*Creating child will position the new task just under the parent task. | |||
*Creating another "normal" (parent) task will create a new line '''above''' the others. Think of it if you want ordered objectives. | *Creating another "normal" (parent) task will create a new line '''above''' the others. Think of it if you want ordered objectives. | ||
*Succeeding parent task will automatically succeed childs, whatever their [[taskState]] was set to. (I.E. If a task is set as a child to another, it will be completed when its parent is complete.. no matter if the child task really was or not). | *Succeeding parent task will automatically succeed childs, whatever their [[taskState]] was set to. (I.E. If a task is set as a child to another, it will be completed when its parent is complete.. no matter if the child task really was or not). | ||
Line 54: | Line 51: | ||
Full step by step code from beginning to end:<br> | Full step by step code from beginning to end:<br> | ||
'''Step 1: create a new simpleTask''' | '''Step 1: create a new simpleTask''' | ||
<sqf> | <sqf>MySimpleTask = player createSimpleTask [(localize "STR_aSimpleTask")];</sqf> | ||
</sqf> | |||
You may create a task at any given point in time. You just need to be aware of the fact, that you've created the task for a single unit (the player). So if you make use of teamSwitch, respawn or similiar, you need to think about how to manage this, so all of these units will have up to date tasks assigned to them. | You may create a task at any given point in time. You just need to be aware of the fact, that you've created the task for a single unit (the player). So if you make use of teamSwitch, respawn or similiar, you need to think about how to manage this, so all of these units will have up to date tasks assigned to them. | ||
Second, it is a good practice to use a stringtable, even if you do not plan (yet) to offer translations.<br> | Second, it is a good practice to use a stringtable, even if you do not plan (yet) to offer translations.<br> | ||
'''Step 2: task destination'''<br> | '''Step 2: task destination'''<br> | ||
<sqf> | <sqf>MySimpleTask setSimpleTaskDestination _destination;</sqf> | ||
</sqf> | |||
variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it.<br> | variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it.<br> | ||
'''Step 3: task description''' | '''Step 3: task description''' | ||
<sqf> | <sqf> | ||
MySimpleTask setSimpleTaskDescription [ | |||
(localize "STR_aSimpleTaskLongText"), | (localize "STR_aSimpleTaskLongText"), | ||
(localize "STR_aSimpleTask"), | (localize "STR_aSimpleTask"), | ||
(localize "STR_aSimpleTaskWaypointLabel") | (localize "STR_aSimpleTaskWaypointLabel") | ||
];</sqf> | ]; | ||
</sqf> | |||
Again, no magic involved here. You take your task, the command setSimpleTaskDescription an pass an array with three strings in it. The first string is the long description text, the second is the name/title of the task and the last one will show up on-screen on the waypoint in cadet mode.<br> | Again, no magic involved here. You take your task, the command setSimpleTaskDescription an pass an array with three strings in it. The first string is the long description text, the second is the name/title of the task and the last one will show up on-screen on the waypoint in cadet mode.<br> | ||
'''Step 4: set and update task states''' | '''Step 4: set and update task states''' | ||
<sqf> | <sqf>MySimpleTask setTaskState "CREATED";</sqf> | ||
</sqf> | |||
And that's it. Here a minimal working example: | And that's it. Here a minimal working example: | ||
<sqf> | <sqf> | ||
MySimpleTask = player createSimpleTask ["simple task title"]; | |||
MySimpleTask setSimpleTaskDestination (position player); | |||
MySimpleTask setSimpleTaskDescription [ | |||
"simple task long description", | "simple task long description", | ||
"simple task title", | "simple task title", | ||
"simple task waypoint label" | "simple task waypoint label" | ||
]; | ]; | ||
MySimpleTask setTaskState "CREATED"; | |||
</sqf> | |||
And then later in the mission: | And then later in the mission: | ||
<sqf> | <sqf>MySimpleTask setTaskState "SUCCEEDED";</sqf> | ||
</sqf> | |||
If you want to keep the player in the loop about the status of tasks, you may always do this: | If you want to keep the player in the loop about the status of tasks, you may always do this: | ||
<sqf>[ objNull, objNull, | <sqf>[objNull, objNull, MySimpleTask, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";</sqf> | ||
</sqf> | }} | ||
Revision as of 11:01, 13 May 2022
Description
- Description:
- Creates a new Task and adds it to the Diary.
- Multiplayer:
- The task effect is local, it will only exist on the client it was added.
- Groups:
- Briefing
Syntax
- Syntax:
- unit createSimpleTask [name, parentTask]
- Parameters:
- unit: Object - Unit to add this new task
- name: String
- parentTask: Task - (Optional, taskNull) - The new task will be a sub task of the parent task
- Return Value:
- Task - The new task
Examples
- Example 1:
- Example 2:
Additional Information
- See also:
- simpleTasks removeSimpleTask setSimpleTaskDescription setSimpleTaskDestination setTaskState setTaskResult taskState Tasks Briefing
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Jul 02, 2011 - 11:45 (UTC)
-
- Creating child will position the new task just under the parent task.
- Creating another "normal" (parent) task will create a new line above the others. Think of it if you want ordered objectives.
- Succeeding parent task will automatically succeed childs, whatever their taskState was set to. (I.E. If a task is set as a child to another, it will be completed when its parent is complete.. no matter if the child task really was or not).
- This command has to be executed again for it to be applied for JIP players - no server sync
Step 1: create a new simpleTask You may create a task at any given point in time. You just need to be aware of the fact, that you've created the task for a single unit (the player). So if you make use of teamSwitch, respawn or similiar, you need to think about how to manage this, so all of these units will have up to date tasks assigned to them. Second, it is a good practice to use a stringtable, even if you do not plan (yet) to offer translations.
Step 2: task destination
variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it.
Step 3: task descriptionAgain, no magic involved here. You take your task, the command setSimpleTaskDescription an pass an array with three strings in it. The first string is the long description text, the second is the name/title of the task and the last one will show up on-screen on the waypoint in cadet mode.MySimpleTask setSimpleTaskDescription [ (localize "STR_aSimpleTaskLongText"), (localize "STR_aSimpleTask"), (localize "STR_aSimpleTaskWaypointLabel") ];
Step 4: set and update task statesAnd that's it. Here a minimal working example:And then later in the mission:MySimpleTask = player createSimpleTask ["simple task title"]; MySimpleTask setSimpleTaskDestination (position player); MySimpleTask setSimpleTaskDescription [ "simple task long description", "simple task title", "simple task waypoint label" ]; MySimpleTask setTaskState "CREATED";If you want to keep the player in the loop about the status of tasks, you may always do this: