Make dynamic action sequence - theoallen/TSBS GitHub Wiki

First, this wiki only dedicated for those who already understand how to script since it's involves [:script] command to use. And it may be hard to understand if you're not scripter.

Well, so what exactly dynamic action sequence is? As you already aware that most of TSBS action sequences are constant and it can not be changed freely even if you use [:if] or [:case] command. It might be possible but you need to do tedious works such as define each case. So, by using [:script] command you may define action sequence more dynamic.

How action sequence is handled in implementation

TSBS action sequence is a hash which has nested array as value, each array assigned to a variable named @acts. And then, it's executed inside execute_sequence method. So, basically if you want to call an particular action command using [:script] command, you can do that by making this

[:script, "
@acts = [:move_to_target, 50, 0, 15, 0]
execute_sequence
"],

Those two lines are must. Put a new array to @acts and then call execute_sequence afterward.

So, how do you gonna use this as dynamic sequence? If you're scripter, you may get the idea instantly. Let say that the X coordinate is based on $game_variables. For example

[:script, "
@acts = [:move_to_target, $game_variables[1], 0, 15, 0]
execute_sequence
"],

The X coordinate position will be depends on $game_variables[1]. You change the value, your sequence will be changed as well.

By doing this, you can make the dynamic damage scaling using $game_variables and [:target_damage] at same time. The example implementation. It might not the best or good idea though.

[:script, "
rate = $game_variables[1] * 0.01
@acts = [:target_damage, rate]
execute_sequence
"],

If you put 150 in variable ID 1, the damage output will be 150% from the original output

Well, these are just an insight how to use [:script] command properly in my TSBS. Honestly, I can't really think what can I do with this thing. But you as the script user may have better idea than me. ;)