createSimpleTask: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (effect is local, easily verified with simpleTasks command + format. see also) |
m (formate) |
||
Line 37: | Line 37: | ||
<dl class='command_description'> | <dl class='command_description'> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on July | <dd class="notedate">Posted on July 02, 2011 - 11:45 (GMT+1) | ||
<dt> | <dt class="note">[[User:Lou Montana|Lou Montana]]<dd class="note"> | ||
<dd> | |||
*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). | ||
*This command has to be executed again for it to be applied for JIP players - no server sync<br><br> | |||
Full step by step code from beginning to end:<br> | |||
'''Step 1: create a new simpleTask''' | |||
<code> | |||
A_SIMPLE_TASK = [[player]] [[createSimpleTask]] [([[localize]] "STR_aSimpleTask")]; | |||
* | </code> | ||
< | |||
< | |||
Full step by step code from beginning to end: | |||
Step 1: create a new simpleTask | |||
A_SIMPLE_TASK = player createSimpleTask [(localize "STR_aSimpleTask")]; | |||
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's a good practice to use a stringtable, even if you do not plan (yet) to offer translations. | Second, it's 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 | <code> | ||
A_SIMPLE_TASK [[setSimpleTaskDestination]] _destination; | |||
A_SIMPLE_TASK setSimpleTaskDestination _destination; | </code> | ||
variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it. | variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it.<br> | ||
'''Step 3: task description''' | |||
Step 3: task description | <code> | ||
A_SIMPLE_TASK [[setSimpleTaskDescription]] [ | |||
A_SIMPLE_TASK setSimpleTaskDescription[ | ([[localize]] "STR_aSimpleTaskLongText"), | ||
(localize "STR_aSimpleTaskLongText"), | ([[localize]] "STR_aSimpleTask"), | ||
(localize "STR_aSimpleTask"), | ([[localize]] "STR_aSimpleTaskWaypointLabel") | ||
(localize "STR_aSimpleTaskWaypointLabel") | |||
]; | ]; | ||
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. | </code> | ||
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''' | ||
<code> | |||
A_SIMPLE_TASK setTaskState "CREATED"; | A_SIMPLE_TASK [[setTaskState]] "CREATED"; | ||
</code> | |||
And that's it. Here a minimal working example: | And that's it. Here a minimal working example: | ||
<code> | |||
A_SIMPLE_TASK = player createSimpleTask ["simple task title"]; | A_SIMPLE_TASK = [[player]] [[createSimpleTask]] ["simple task title"]; | ||
A_SIMPLE_TASK setSimpleTaskDestination (position player); | A_SIMPLE_TASK [[setSimpleTaskDestination]] ([[position]] [[player]]); | ||
A_SIMPLE_TASK setSimpleTaskDescription[ | A_SIMPLE_TASK [[setSimpleTaskDescription]] [ | ||
"simple task long description", | "simple task long description", | ||
"simple task title", | "simple task title", | ||
"simple task waypoint label" | "simple task waypoint label" | ||
]; | ]; | ||
A_SIMPLE_TASK setTaskState "CREATED"; | A_SIMPLE_TASK [[setTaskState]] "CREATED"; | ||
</code> | |||
And then later in the mission: | And then later in the mission: | ||
<code> | |||
A_SIMPLE_TASK setTaskState "SUCCEEDED"; | A_SIMPLE_TASK [[setTaskState]] "SUCCEEDED"; | ||
</code> | |||
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: | ||
<code> | |||
[objNull, | [ [[objNull]], [[objNull]], A_SIMPLE_TASK, "SUCCEEDED"] [[execVM]] "CA\Modules\MP\data\scriptCommands\taskHint.sqf"; | ||
</code> | |||
<!-- Note Section END --> | |||
</dl> | |||
<h3 style='display:none'>Bottom Section</h3> | <h3 style='display:none'>Bottom Section</h3> |
Revision as of 02:14, 29 August 2014
Description
- Description:
- Creates a new Task. The task effect is local, it will only exist on PC it was added.
- Groups:
- Uncategorised
Syntax
- Syntax:
- Object createSimpleTask Array
- Parameters:
- Object: Unit to add this new task
- Array: ["TaskName"] or ["TaskName", taskParent]
- Return Value:
- Task - the new task
Examples
- Example 1:
_currentTask = player createSimpleTask ["NewTask"];
- Example 2:
_childTask = player createSimpleTask ["ChildTask", _currentTask];
Additional Information
- See also:
- TaskssimpleTasksbriefingremoveSimpleTasksetSimpleTaskDescriptionsetSimpleTaskDestinationsetTaskStatesetTaskResulttaskState
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
Notes
- Posted on July 02, 2011 - 11:45 (GMT+1)
- Lou Montana
-
- 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 simpleTaskA_SIMPLE_TASK = player createSimpleTask [(localize "STR_aSimpleTask")];
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's a good practice to use a stringtable, even if you do not plan (yet) to offer translations.
Step 2: task destination
A_SIMPLE_TASK setSimpleTaskDestination _destination;
variable/pointer-to-your-task setSimpleTaskDestination some-position. That's it.
Step 3: task descriptionA_SIMPLE_TASK setSimpleTaskDescription [ (localize "STR_aSimpleTaskLongText"), (localize "STR_aSimpleTask"), (localize "STR_aSimpleTaskWaypointLabel") ];
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.
Step 4: set and update task statesA_SIMPLE_TASK setTaskState "CREATED";
And that's it. Here a minimal working example:A_SIMPLE_TASK = player createSimpleTask ["simple task title"]; A_SIMPLE_TASK setSimpleTaskDestination (position player); A_SIMPLE_TASK setSimpleTaskDescription [ "simple task long description", "simple task title", "simple task waypoint label" ]; A_SIMPLE_TASK setTaskState "CREATED";
And then later in the mission:A_SIMPLE_TASK setTaskState "SUCCEEDED";
If you want to keep the player in the loop about the status of tasks, you may always do this:[ objNull, objNull, A_SIMPLE_TASK, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma 2 version 1.00
- Arma 2: New Scripting Commands
- Arma 2: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands: Local Effect
- ArmA 2: New Scripting Commands List
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Command Group: Briefing