This script allows you to set an action to execute a different skill if certain conditions are met, with some probability. The condition is a formula that can use any game data available, including the action’s user as well as the action targets.
For example, if your actor’s HP is less than 50%, then there might be a chance
that each attack will be a special “critical attack” instead.
Script: download here
Place this script below Materials and above Main
Tag your skills with something of the form
<skill change> id: 3 chance: 0.5 condition: a.hp < a.mhp * 0.5 </skill change>
id is the skill ID to change it to
chance is the probability that it will be changed, as a percent
condition is a formula that must be satisfied
The following variables are reserved for your formulas:
a - the action's user b - the action's target** (see below for warnings)
Note that a single skill may have multiple skill change tags: during the game, it will pick the first one whose condition is met and use it. If you would like your skill to do different things depending on different conditions, create multiple skill change tags with different conditions.
In the configuration, you will find an option called “Per Target Mode”. This means that the skill change is checked for each target individually, rather than checking all targets at the same time. Per-target mode is not necessary if none of your skills using the skill change property will have multiple targets.
Be careful about the targets variable. If per-target mode is OFF, then it is given as a list of targets. For example if you want to check if a target has certain states:
b.state?(5) # first target has state 5 applied b.state?(2) # second target has state 2 aplied b[-1].state?(6) # last target has state 6 applied