1. Home
  2. Unity RTS Engine
  3. Tasks
  4. Task Launcher

Task Launcher

The Task Launcher component handles creating and managing tasks for both units and buildings.

Attach this component to a unit or a building in order to add tasks that can launched when the unit/building is selected.

General view of the Task Launcher Component.


Task Launcher Settings:

Task Launcher Code: Unique code for the task launcher to be recognized by custom events.

Min Health: Minimum health value that the task holder (either the unit or the building) must have in order to launch a task from this task launcher.

Max Active Tasks: The maximum amount of the tasks that the task launcher can have on the queue to be launched.

Launch Task Sound Effect: Audio clip played when a task is successfully launched.

Declined Task Sound Effect: Audio clip played when a task can not be launched for any reason (insufficient resources, etc..).


Task Navigation/Creation:

To add a task, you can simply click the button “Add Task” which also displays the current task count. To navigate between tasks, you can use both the “<<” (go to previous task) or the “>>” (go to next task) buttons. The task ID that you are currently configuring will be displayed between the navigation buttons and the toolbar. Right after the task settings, a “Remove Task” button will delete the displayed task when clicked.


General Task Settings:

The first tab on the toolbar provides a list of general settings that applied to all task types.

  1. Task Code: Unique code for this task to be recognized by custom events
  2. Faction Specific: If the task is faction type specific (only one type of faction can actually start this), then enable this.
  3. Faction Code: If the task is faction type specific, then this field will appear at which you’ll be able set the code of the faction that can launch this task.
  4. Type:
    1. Unit Creation: produce units.
    2. Research: apply changes to units attributes.
    3. Destroy: task holder self-destruction.
    4. Custom Task: will only call custom events.
  5. Description: A short description for the task that will appear when the player’s mouse is over the task icon.
  6. Task Panel Category: When using categories in the task panel (check the UI Manager documentation), this is the ID of the task panel that this task belongs to when it appears while selecting this task launcher’s holder and displaying its tasks. Task Panel categories allow to organize tasks based on a criteria that you can decide.
  7. Icon: The icon that will appear in the task panel for this task.
  8. Reload Time: Duration before this task takes effect.
  9. Required Resources: Which resources and how much of these resources does the task need to be launched? Amount of resource types matches the size of the array in this field. For each element of this array, provide the name of the resource and the amount required.
  10. Task Completed Audio: Audio clip played when the task is done.
  11. One-Time Use: Enable this if you only want the player to launch this task once (and after using it once, it will get removed and player will not be able to launch it again).

Custom Task Settings:

The second tab of the toolbar provides a list of settings that are specific to the task type that has been chosen in the general task settings tab.

  1. Unit Creation Task:
    1. Prefabs: A list of the unit prefabs that can be created using this task. You can more than one prefab for a unit creation task and only one will be randomly chosen each time to be created. If you only want to create one unit type using this task then you can simply assign only one unit prefab into this field.
    2. Upgrades: Upgrades are independent tasks that change the settings of the task that are defined in. There will be only one upgrade available to be launched at a time. Each time an upgrade task is done, the next one on the list will be available. To add an upgrade, you can simply click the button “Add Upgrade” which also displays the current upgrade tasks count. To navigate between upgrade tasks, you can use both the “<<” (go to previous upgrade task) or the “>>” (go to next upgrade task) buttons. The upgrade task ID that you are currently configuring will be displayed right under the navigation buttons. Right after the upgrade settings, a “Remove Upgrade” button will delete the displayed upgrade when clicked.
      1. Target Prefabs: This list will replace the task’s prefabs list after the upgrade takes effect.
      2. Upgrade Description: A short description for the upgrade task which will be displayed when the player’s mouse is over the upgrade task.
      3. Upgrade Task Panel Category: When using categories in the task panel (check the UI Manager documentation), this is the ID of the task panel that this upgrade task belongs to when it appears while selecting this task launcher’s holder and displaying its tasks. Task Panel categories allow to organize tasks based on a criteria that you can decide.
      4. Upgrade Icon: The icon of the upgrade task on the Task Panel.
      5. Upgrade Reload: Duration before the upgrade takes effect.
      6. Upgrade Resources: List of resources required to launch the upgrade task.
      7. New Description: This will replace the main task description after the upgrade is done.
      8. New Icon: This will replace the main task icon after the upgrade is done.
      9. New Reload Time: This will replace the main task reload time after the upgrade is done.
      10. New Task Resources: This will replace the main task required resources after the upgrade is done.
  2. Research Task:
    1. Prefabs: A list of the units that this research will modify. (Unit types that are already spawned in the map will also be affected by this research task, the list includes the unit prefabs because it’s easier than entering each unit code).
    2. Research Attributes: Each value entered in the research attributes fields will be added to the value of the attribute for the units in the above list (this means that if you want to increment the unit’s attribute, the value entered must be positive. A negative value on the other hand will decrement the value of the attribute).
  3. Other Task Types: There are no custom settings for the rest of the task types.

Events:

In addition to the delegate events (which are called for tasks). You can trigger events for each task independently by using the event triggers below:

  1. Task Launch Event: Triggered when the task is launched.
  2. Task Complete Event: Triggered when the task is completed.
  3. Task Cancel Event: Triggered when the task is cancelled.

How can we help?