Skip to content

How to Make Branched Action Sequence

theoallen edited this page Jan 14, 2015 · 7 revisions

One of the TSBS features which I'm so proud is that you could make branched condition for action sequences. If you come across a certain condition, you could make a change the battler sequence animation. Let say that if the active battler under influence of a certain state, the action sequence will be different. It will perform damage 3 times instead of one. Or, different weapon will use different action sequence if you going to use a skill. This will come in handy if you want to expand all possibilities and battle system features.

There're two commands avalaible to use. They are :

  1. [:if, "Script", true, false],
  2. [:case, {}],

##1. If else type branches Similar as RPG Maker eventing. "If else" branches allow you to make two branch. If the condition is true, and if it's false. In TSBS, you could do the same. By using script call, it checks whether it will return true or not. The command format is

[:if, "Script", true, false],

You need to replace the "true" with other things. "False" could be omited if not necessary to have alternative move if the condition is false. There're three avalaibles options to replace the "true" and "false".

1. Replace it with Action Key

As you already know, all registered action sequences have their own String/Text Key. You could call those registered action sequences by putting its key. An example :

[:if, "!state?(16)", "Sol_BlackState", "Sol_BlackRecharge"],

That's mean if the subject / action battler has no state 16 influenced, it will call the "Sol_BlackState" sequence. Otherwise, it will call the "Sol_BlackRecharge" (Soleil Blackhole Force from sample game, ED; Skyward Temple)

2. Replace it with Single Line Action

Another alternative. For some case, it's unecessary to register a new action sequence just for a single line action. What is that mean? Perhaps you only need to put a single [:add_state, 30] or such. And that't totally makes no sense if you need to register it as

"AddState" => [
[:add_state, 30],
],

So I made an alternative, you could put a single line action for it. An example from Flay's normal attack (Sample Game).

[:if, "target.result.hit?", [:add_state, 30, 100]],

It means that if target is successfully being hit, state 30 will be applied to target.

3. Replace it with Multiple Lines Action

Similar as single line action. But this alternative, you could put many action sequences together. The format is same as how do you set up a new sequence. Without putting any sequence key. Here is the format

[:if, "Condition script call",
  [
  [:command, 1, 1],
  [:command, 1, 1],
  [:command, 1, 1],
  ],
  # Add more
],

Sample usage

[:if,"target.result.hit?",
  [ 
  [:target_slide, -5, 0, 3, 0], 
  [:slide,-5, 0, 3, 0],
  ],
], 

##2. Case type branches Case type branches allow you to set a multiple branches of action sequences. So, you also may have a multiple condition as well. Let say that if the value of a variable is 1 will use action A. It will be different it you have the different value such as 2,3,4, or 5. Yes, multiple branches at once. The command format would be like this.

[:case, {
  "Condition1" => Action1
  "Condition2" => Action2
  "Condition3" => Action3
  "Condition4" => Action4
}],

Replace the Action1, Action2 with other thing. It's same as how do you set up the "if else" conditional branches. Yes, three options are avalaibles. Note that higher condition also has higher priority. Let say that "Condition1" and "Condition2" are both true. It will use the "Condition1" because it's higher than "Condition2". Examples

Action Key

[:case, {
  "weapons[0].nil?" => "Barehand Attack",
  "weapons[0].id == 1" => "Sword Attack",
  "weapons[0].id == 2" => "Axe Attack",
}]

Single Line Action

[:case, {
  "enemy_id != 26" => [], # Does nothing
  "state?(42)" => [:change_skill, 123], 
  "state?(43)" => [:change_skill, 127], 
  "state?(44)" => [:change_skill, 125], 
  "state?(45)" => [:change_skill, 124], 
}],

Multiple Lines Action

[:case, {
  "$game_variables[1] == 1" => [
    [:show_anim],
    [:target_damage],
    ],
  "$game_variables[1] == 2" => [
    [:show_anim],
    [:target_damage, 1.5],
    ],
   "$game_variables[1] == 3" => [
    [:show_anim],
    [:target_damage, 2.0],
    ],
}],

Well, that's all folks. Hope it clear enough =D

You can’t perform that action at this time.