Difference between revisions of "Pikifen/Object categories/Group task"
Revision as of 13:28, 8 February 2020
Group tasks are objects that need to be cleared or moved out of the way, and to do so, several Pikmin need to work together on them. Once the combined Pikmin power reaches a certain goal amount, the task begins.
Examples of group task types include the pushable cardboard box in Pikmin, where several Pikmin need to all push together, or the electrode in Pikmin 3, where Yellow Pikmin need to pose together to transmit the current from one end to the other.
To create a new type of group task, please follow the creating object types tutorial.
A group task object can be anything and do anything, but it has information on how much Pikmin power is required to get the task started, how many Pikmin can contribute at once, what type of contribution a Pikmin can do, and rules about the Pikmin's layout, work poses, and contribution methods.
Each object has a series of spots for Pikmin to stand on when they're working on it. These spots are organized into rows, and as Pikmin are tasked to work, they move to the closest free spot in the frontmost row. After all spots in that row are taken, new Pikmin go to the row behind, if any, and so on.
Group task objects are hardcoded in the engine to do whatever the script tells them, but when the required power quota is reached, the
goal_reached message is sent; this should be handled by the script in order to do something. Likewise, the message
goal_lost is sent if enough Pikmin leave the task such that the power goes below the required quota.
Besides the global object type attributes, a group task type has the following attributes.
first_row_p1: X and Y (in relative coordinates) of the leftmost point of the first row.
first_row_p2: Same as above, but the rightmost point.
contribution_method: In what way does a Pikmin contribute? Possible values are
normal, where each Pikmin contributes by 1,
weight, where it depends on the Pikmin's weight,
carry_strength, for each Pikmin's carry strength, and
push_strength, for each Pikmin's pushing strength. Defaults to normal.
power_goal: How much combined power is required to meet the quota. Defaults to 10.
max_pikmin: Maximum number of Pikmin that can contribute to the task. Defaults to 20.
worker_pikmin_angle: Pikmin that are working will be facing this angle (relative to the group task object). Defaults to 0.
worker_pikmin_pose: Pikmin that are working will be doing this pose. Possible values:
pushing. Defaults to stopped.
interval_between_rows: Keep this much distance between each row. Defaults to 10.
pikmin_per_row: How many Pikmin fit in one row. Defaults to 10.
speed_bonus: If this object can move, it will speed up by this much for every extra unit of power put on the task beyond the goal. Defaults to 1.
Group task object types do not need any specific animations, only the ones that you call in the script.
All of the group task type object's behavior is defined by the user-made script. You should add events for
on_receive_message to know when the power goal has been met or lost. You should also set the object's health to zero when you are done, if you don't want the Pikmin to work on it any more.
Object spawn script variables
Besides the global spawn script variables, group task type objects do not read any specific script variables.