This script allows you to “link” battlers together. Linked battlers can share some special properties that regular battlers do not have.
Links follow a parent-child relationship. When the parent dies, the child also dies. But if the child dies, nothing happens to the parent. You can set up a two-way link between a parent and a child such that when the child dies, so does the parent.
Suppose you have a hydra that consists of three heads and a body. When you kill a head, the rest of the heads and the body is unaffected, but when you kill the body, the heads will also die. The hydra’s body is the parent, and each head is a child.
In the script editor, place this script below Materials and above Main
Here is a summary of the script calls available. Read further for more details about what they do
link_enemy(child_index, parent_index, two_way) unlink_enemy(child_index, parent_index) link_actor(child_index, parent_index, two_way) unlink_actor(child_index, parent_index) link_battler(child_battler, parent_battler) unlink_battler(child_battler, parent_battler)
To link two enemies together, make the script call
link_enemy(child_index, parent_index) link_enemy(child_index, parent_index, two_way)
Where the index is based on the order that the enemy was inserted into the
troop. You can look up the index by selecting one of the “enemy battle” event
commands such as “Change Enemy HP”, showing the dropdown list, and looking at
the index before the enemy name.
two_way is either true or false, and is used to establish a two-way link
between child-parent and parent-child.
To unlink two enemies, make the script call
unlink_enemy(child_index, parent_index) unlink_enemy(child_index, parent_index, two_way)
This will break a link between two enemies.
To link two actors, make the script call
link_actor(child_index, parent_index) link_actor(child_index, parent_index, two_way)
Where the index is a number that can represent two things: if the index is positive, then it is the actor ID. If the index is negative, then it is the party index. For example, an index of 3 would mean “actor 3”, but an index of -3 would mean “the actor in the 3rd party position”
To unlink two actors, make the script call
You are not limited to linking actors to actors or enemies to enemies. You can link any battler to any other battler using the script call
Which will link battler1 to battler2, where battler1 is the child and battler2 is the parent. There are two methods available to make this easy for you:
get_actor(index) - returns an actor for the given index get_enemy(index) - returns an enemy for the given index
The indexing rules are the same as before. When you have your actor and enemy,
you can now link them together like this
actor = get_actor(-2) enemy = get_enemy(3) link_battler(actor, enemy)
This will link the actor to tne enemy, where the actor is the child and
the enemy is the parent.
To unlink battlers, use the script call
To set up the hydra example, you would create a troop consisting of a hydra
body and three hydra heads. Assume the body is index 1, and the heads
are indices 2, 3, 4.
Then you would make the following script calls to run at the beginning of the
link_enemy(2, 1) # link first head to body link_enemy(3, 1) # link second head to body link_enemy(4, 1) # link third head to body
Now, when the body is killed, all three heads will die as well.