Jump to content

Scripts

From ROIdle Wiki

One of the staple mechanics of Ragnarok Oblivion is how each character is controlled. The algorithm that dictates what they do is called Battle Scripts, more commonly referred only as Scripts.
They are a step by step Condition-Action-Target system, where each step has a set of filters and rules that choose those 3 things, and if the Condition is true, that step executes that Action against the chosen Target.
If left untouched, the game has default Scripts for every class in the game. But by building the Runic Battle Codex in the Estate, the player then can (and has to) create and choose which script each of their characters is going to be using at the moment.

Default Scripts

Warrior Classline Scout Classline Apprentice Classline
Tier 1: Warrior#Default Tier 1: Scout#Default Tier 1: Apprentice#Default
Tier 2: Knight#Default Tier 2: Archer#Default Tier 2: Mage#Default
Tier 2: Mercenary#Default Tier 2: Rogue#Default Tier 2: Sorcerer#Default
Tier 3: Sentinel#Default Tier 3: Sniper#Default Tier 3: Wizard#Default
Tier 3: Paladin#Default Tier 3: Arrowslinger#Default Tier 3: Shaman#Default
Tier 3: Berserker#Default Tier 3: Scourge#Default Tier 3: Alchemist#Default
Tier 3: Ravager#Default Tier 3: Assassin#Default Tier 3: Sage#Default
Tier 3: Priest#Default
Tier 3: Druid#Default

The Very Basics

In the Character AI menu, you can configure the "Battle Behavior" for various characters. You can use the default scripts provided by the game, or you can create new scripts from scratch or by modifying the default ones. Additionally, you can import and export scripts to share with other players—if you need help, feel free to ask in Discord!

Here’s a breakdown of the functions available:

Character Selector

At the top, there is a selection menu that allows you to choose a specific character in your party. When you click on a character, it automatically highlights and selects the script currently assigned to that character. To assign a different script to the selected character, click on the desired script on the left, then click the Select script for character button.

Add Script

The Add Script button lets you create a new script with a custom name. This new script will be mostly empty. It will not be automatically equipped to the selected character.

Copy Default Class Script

The Copy Default Class Script button creates a new script by copying the default script for the selected character's class. Like the "Add Script" button, it will not be automatically equipped to the selected character.

Rename

The Rename button allows you to change the name of the selected script.

View/Edit

The View/Edit button opens a detailed editor where you can modify and customize the script’s content.

Copy

The Copy button creates a duplicate of the selected script with a new name. This is useful if you want to create variations of a script without altering the original.

Export/Import

The Export button generates a copiable JSON of the selected script in text format, which you can export. To import a script, simply paste the script’s JSON into the import box, and it will overwrite the current selected script.

Delete

The Delete button removes the selected script from the list.

Select Script for Character

The Select script for character button allows you to assign a different script to the selected character. First, select the character at the top, then select the desired script from the list on the left. Finally, click the Select script for character button to equip the new script.

The Also Basics

Every script works in steps, and every round characters and enemies will perform one action. There are some exceptions for consumables and basic attacks.

Here’s a breakdown:

Starting Position

This determines the starting position of your character at the beginning of each battle on the hunt. The battle ground is divided into 6 columns: 3 for your party and 3 for the enemy. You can select where the character will be placed in one of the 3 available columns in your party’s side. Movement costs 1 round, so it’s important to plan ahead to ensure that the character doesn’t waste time moving to get into range for a skill.

Utility Buttons

For every step, there are some Quality of Life (QOL) buttons:

Disable step: A checkbox to disable the step without deleting it. This is useful if you think the step might be needed in a specific hunt, but you don’t want it to trigger at the moment.

Clone step: Copies the current step exactly as is and places it in the same position. This is helpful when you want to quickly duplicate a step without having to drag a new one from the bottom of the list.

Arrows: Drag and drop a step to a new position to change its priority in the sequence.

Bin: Deletes the selected step from the script.

Conditions

Every step is triggered or skipped based on conditions. Most of the conditions are self-explanatory, but more details will be provided in the next section. You can add new conditions by pressing the + button, or delete existing ones using the bin button. You can also move conditions up and down to adjust their priority by clicking and dragging. A maximum of 5 conditions is allowed per step.

Action

An action is what your character will do if the conditions for that step are met. If an action can’t be performed for any reason, such as the character being unable to move or the skill being unusable, the whole step will be ignored and the script will proceed to the next step. Here are the basic actions available:

Attack: The character performs one or more basic attacks, based on SPEED.

Idle: The character does nothing for this round and recovers MP.

Skip next script: Skips the next script in the sequence, this is for more complex scripting.

Step forward: Moves the character one column forward to the right.

Step backward: Moves the character one column backward to the left.

Step to ally: Moves the character one column towards the ally’s position.

Step to foe: Moves the character one column towards the enemy’s position.

Escape: The party attempts to escape from battle, requires items.

Use consumable item: The character uses an item from their inventory. You can select up to 3 items, the script will give priority from left to right if it finds the items in the inventory. In addition to the basic actions every active skill in the game is an action. Your character can only use skills from their class. You can filter available skills by class to make it easier to assign the right abilities to the character.

Target

You can select the type of target this will combine with the conditions, more details in the next section.

Cooldown

You can also set up a cooldown for a step. Even if the conditions are triggered the script will skip the step if it is in cooldown. Every round the cooldown goes down by 1 and a new ecounter resets it to 0.

Understanding Conditions

Starting from the 1st step the conditions will be tested to see if your character will perform the action for this step or not. You can add multiple conditions and they will be evaluated one after the other, additively (AND operator), from top to bottom. If that set of conditions is met, the related action will be performed. If not, the script will move to the next step, and check the conditions for it. If the conditions on all steps are not met, and they all get skipped, the character will perform an idle action.


The are two kinds of conditions boolean (true/false) and filters. Filter conditions stack with each other, they will refine the subset of characters/enemies with each subsequent condition. For example, let's say you have conditions "foe: nearest" + "foe: is air-week" + "foe: highest current HP". The first condition will first select all of the nearest enemies, then the second condition will select air-week enemies from the nearest and the last condition will select the highest current HP one from those. The step will be skipped if there aren't air-weak enemies in the nearest group. Boolean conditions are simple true false check. For example, let's say you have conditions "foe: nearest" + "foe: more than X+", where X = 3. The first condition will first select all of the nearest enemies and only then check if there are 3 of them amongst those nearest. In an example where you invert the logic and have "foe: more than X+", where X = 3, and then "foe: nearest", it will first check if there are 3 foes on the battlefield and if there are 3+ foes, it will check for nearest foes, which might be less than 3.

Examples:

Using AOE only if the enemy count is above X

- foe: at range X or less - filter only the foes which are in range for the skill you plan to use, usually 1 or 3. - foe: X or more enemies - check if the number of enemies in range is above a minimum requirement

Using AOE only if the enemy count is above X, but exclude gathering nodes

- foe: is gathering node NOT - selecting Not checkbox it will exclude gathering nodes - foe: at range X or less - filter only the foes which are in range for the skill you plan to use, usually 1 or 3. - foe: X or more enemies - check if the number of enemies in range is above a minimum requirement

Using AOE only if the enemy count is above X, but exclude gathering nodes and the enemy must be air-weak

- foe: is gathering node NOT - selecting Not checkbox it will exclude gathering nodes - foe: at range X or less - filter only the foes which are in range for the skill you plan to use, usually 1 or 3. - foe: is air-weak - filter only the air-weak ones from the ones in range - foe: X or more enemies - check if the number of enemies in range and air-weak is above a minimum requirement

Using AOE only if the enemy count is above X, but exclude gathering nodes and the enemy must be air-weak and the character must have at least 50% MP

- self: MP higher than X% (50) - start the step by checking the mp requiremt, this works even if the target is Foe - foe: is gathering node NOT - selecting Not checkbox it will exclude gathering nodes - foe: at range X or less - filter only the foes which are in range for the skill you plan to use, usually 1 or 3. - foe: is air-weak - filter only the air-weak ones from the ones in range - foe: X or more enemies - check if the number of enemies in range and air-weak is above a minimum requirement

Healing the lower HP allies if multiple allies are under a % HP threshold

For this we will require multiple steps with a scaling % priority

1st step - target Ally - ally: HP lower than X% (30) - first it will target allies below 30% HP

2nd step - target Ally - ally: HP lower than X% (50) - second it will target allies below 50% HP

3nd step - target Ally - ally: HP lower than X% (80) - third it will target allies below 80% HP

Healing always a character before the others

1st step - target Ally - ally: class is priest - this will check the priest in the party - ally: HP lower than X% (80) - check if the priest is lower than 80% HP

2nd step - target Ally - ally: HP lower than X% (30) - target allies below 30% HP ...

Resurrect before healing

1st step - target Ally - ally:is knocked-out - this will check if there are KO characters

2nd step - target Ally - ally: class is priest - this will check the priest in the party - ally: HP lower than X% (80) - check if the priest is lower than 80% HP

3rd step - target Ally - ally: HP lower than X% (30) - target allies below 30% HP ...