Theolized Sideview Battle System

Essentially, I want to have a counterattack determination occur after the attack is processed but before the target's data is cleared.
It would likely proc after the last target is hit, as I don't plan to have multiple-target moves be counter-able anyway.
First, the counterattack system needs to be removed completely. Changing the invoke item will do the work.
Code:
  def tsbs_invoke_item(target, item, subj = @subject)
    return if item.nil?
    if rand < target.item_mrf(subj, item)
      tsbs_invoke_mreflect(target, item)
    else
      tsbs_apply_item(tsbs_apply_substitute(target, item, subj), item, subj)
    end
  end
This is what you may actually want.

It would go like this:

Determine if evasion occurs (I don't use the item_hit system so I merely set it to always result as true; I only use item_eva) or not
--If not evaded, then calculate damage.
Battlers return to idle.
Based on the sequence phases I put above, how would you put each of them?
Is the evasion calculated before the main sequence is played? or right before the item is applied?

Process secondary effects like states and MP/TP/HP costs (Lunatic Object's After Effects allows for dynamic, formulaic ailment chances and custom MP cost processes).
Likewise, I think I have put the "lunatic object after effect after" the sequence. If it wasn't in the right place, idk where else I should put the compatibility.

Whether hit or miss, determine whether opponent counterattacks, the rate of counterattacking increasing if the skill is dodged.
Clear action data.
Enemy counterattacks or not (this counterattack doesn't need to be a literal invoke_counterattack but can either be a forced action or a call from Hime's Battle Reactions script).
For counterattack, you can try to make your own formula. But your order of wording seems contradictive. Here, you first want to clear the action data, then counterattack. But in the first sentence is the opposite. Regardless, here are what you need and how if you want to proc a reaction skill.

Determine :
> Who is the subject that will do the action sequence
> What is the item/skill they will use?
> Who is the target?

For fun, I just try to modify the post-main sequence.
Code:
class Scene_Battle
  def tsbs_action_post(targets, item, subj)
 
    # Proc an action (Hardcoded)
    battler = $game_troop.members[0]            # Who? Troop member index 1
    battler.item_in_use = copy($data_skills[1]) # What to use? skill ID 1
    battler.target = subj                       # Who is the target?
    battler.battle_phase = :skill               # Settled? now go action!
    wait_for_sequence                           # Let's watch the sequence
    battler.battle_phase = :return              # If done, returning to the original position
 
    # Determine if item has no return sequence
    subj.break_action = false if subj.break_action
    unless item.no_return? || subj.battle_phase == :forced
      subj.battle_phase = :return
    else
      subj.battle_phase = :idle
    end
    wait_for_sequence
  end
end
The result is something like this. If this is what you want.
newcounter.gif

Of course, the who can be anyone, and depends on how you executed it.
You can do something like this as well. So that everyone will react to you
Code:
class Scene_Battle
  def tsbs_action_post(targets, item, subj)
 
    # Proc an action
    $game_troop.members.each do |battler|
      battler.item_in_use = copy($data_skills[1])
      battler.target = subj
      battler.battle_phase = :skill
    end
    wait_for_sequence
    $game_troop.members.each do |battler|
      battler.battle_phase = :return
    end
 
    # Determine if item has no return sequence
    subj.break_action = false if subj.break_action
    unless item.no_return? || subj.battle_phase == :forced
      subj.battle_phase = :return
    else
      subj.battle_phase = :idle
    end
    wait_for_sequence
  end
end
newcounter2.gif

The downside is that the damage counter will also need to rework because the damage counter will add all of them as well.
The upside is, maybe you can also use this to create a followup skill?

For example, I use it for a custom "Attack String" process where battlers' basic attacks normally strike 2.25 times, aka twice with a 25% chance to attack a third time, this rate of attack varying from battler to battler and is affected by states. So it'll be basic attack -> follow up attack -> potential third follow up attack and soforth. I only plan to have it so that the last hit of an Attack String can be countered
I'm not sure by the attack strike, you mean proc the skill 2.25 times, i.e, it has 2 instances of attack or it's basically a single attack but hits 2 times. If it's the latter, it's as easy as making a custom sequence conditional branch like.
Code:
[:if, "rand <0.25", "ExtraActionCode"]

EDIT:
If I'm going to be honest, I don't really get/agree to the whole Game_Action code in the default script and how they're being used. I used it merely because the targeting algorithm is there (and maybe for compatibility).
@TheoAllen, wow that is amazing. That is sound very hard to do by yourself and a lot of code to write.
@TheoAllen, wow that is amazing. That is sound very hard to do by yourself and a lot of code to write.
Now you know why I'm still staying in Ace 😀
It gives me an undefined error for "break_action". Are you using the 1.4 version? I've been using 1.3 since ya' said it's more stable. In that version, there is no mention of the break_action call nor am I sure whether it's important or not.

And yes, I stick with Ace because I don't want to learn a different coding language and ditch all the scripts and resources made specifically for the engine and its resolution. MV has an onboard mouse system with better resolution and some of the plugins can reach greater complexities, but there are also many Ace scripts that lack MV-equivalents, so far.
It gives me an undefined error for "break_action". Are you using the 1.4 version? I've been using 1.3 since ya' said it's more stable. In that version, there is no mention of the break_action call nor am I sure whether it's important or not.

And yes, I stick with Ace because I don't want to learn a different coding language and ditch all the scripts and resources made specifically for the engine and its resolution. MV has an onboard mouse system with better resolution and some of the plugins can reach greater complexities, but there are also many Ace scripts that lack MV-equivalents, so far.
It's been a while since someone uses 1.3, but to be honest I forgot what is inside in version 1.3 all about. My reply was always been about version 1.4. It was all about making it more modular by revamping almost the entire position handling so that I could create a battle camera for it. Such revamp might introduce unwanted and unexpected bugs/glitch that had been missed on my own. Hence I said 1.3 might be more stable during that time.

However, as time goes by, I continue to use 1.4 even in the sample project uses 1.4. And the patch goes bigger ever since. So, version 1.4 + patch will be more stable than before. It overwrites some methods that gave the bug/glitches.

EDIT: Yeah break action is totally from v1.4 (it behaves like "exit event" in eventing)
You can remove that if you still want to use v1.3 I guess.
That's pretty neat with the counter mechanics you added, maybe a 1.5 is on the horizon??? XDDDDD
That's pretty neat with the counter mechanics you added, maybe a 1.5 is on the horizon??? XDDDDD
Idk, actually, I have made some unreleased patches while working on my game 😛
They're not bugfixes, just some convenience and also additional feature.

Screenshot_434.jpg


But yeah, I plan to change counter to be more classic way later.
Not sure if most of ppl care if I update the script anyway.
It'd definitely be helpful! The regular mechanics of counter attacking on VX Ace always bothered me. The regular counter from most RPG's I'm fine with.

If you are planning to do counter mechanics, is there a way to make it so if an enemy is struck with a certain element they would use a counter attack skill?

EDIT: I also wanted to try and use your Advanced A.I script on this system, but it felt overwhelming for me, haha. XD
If you are planning to do counter mechanics, is there a way to make it so if an enemy is struck with a certain element they would use a counter attack skill?
Depends. If you want a reactive skill that will be executed in the next turn, it's easy. Maybe you can toy with some enemy AI script, or just play with custom states like adding an invisible state, so that the enemy will react to it.

However, if you want it to be in the same turn, i.e, so that the enemy may act twice, it's a different story. Based on my modification above, you can try the following.

Code:
if item.is_a?(RPG::Skill) && item.damage.element_id == <element id here>
  targets.each do |battler|
    if battler.enemy_id ==  <specify enemy id here>
      battler.item_in_use = copy($data_skills[1]) # What to use? skill ID 1
      battler.target = subj                       # Who is the target?
      battler.battle_phase = :skill               # Settled? now go action!
      wait_for_sequence                           # Let's watch the sequence
      battler.battle_phase = :return              # If done, returning to the original position
    end
  end
end
Someone managed to break the projectile system by combining "Boomerang", "Area", and "One Animation" tag together.
I patched the bug in the latest patch.

You can download it here https://github.com/theoallen/TSBS/blob/master/Patch/Version 1.4 Bugfixes.rb
Replace the old patch.
Someone managed to break the projectile system by combining "Boomerang", "Area", and "One Animation" tag together.

The things that users do.. xD
The things that users do.. xD
True. Combining those three configs is just beyond my comprehension and I can't think of a single case why would u do that (although apparently in the case of the one who reported the issue it kinda makes sense). But I don't want it to crash since it isn't even a user configuration error.
So this is a really nice script and I love it, but I've run into an issue and I feel like an idiot because I don't know how to solve it...

I'm trying to set it so that each of my characters have unique animations for using items, but I can't figure out how to do that? I know how to set the default item_use animation under the config, but how do I set it for individual characters? I figured I'd just have to put something like "item_use : AnimName" in the Actors' notes, but that doesn't work, and I can't seem to find anything that actually changes the item_use animation?

I've figured out how to do quite a few things with this script, but for whatever reason this particular issue has me stumped! If anyone could tell me what I'm doing wrong, it would be much appreciated!
I'm trying to set it so that each of my characters have unique animations for using items, but I can't figure out how to do that?
Use this
Code:
  [:case, {
    "@actor_id == 1" => "ActionKey1",
    "@actor_id == 2" => "ActionKey2",
    "@actor_id == 3" => "ActionKey3",
    "@actor_id == 4" => "ActionKey4",
    "@acotr_id == 5" => "ActionKey5",
  }],
Oh, thank you for the quick reply! I'm not sure how to get the 'case:' thing to work, though. I have it set up as shown in the attached image under the script "#TSBS - Config 2", but it doesn't do anything, so I'm assuming I'm setting it up wrong, or I'm supposed to use it elsewhere.
Also, just in case I wasn't clear enough earlier, I'd like to specify that I'd like each character to have his/her own sequence for using an item.
Oh, thank you for the quick reply! I'm not sure how to get the 'case:' thing to work, though. I have it set up as shown in the attached image under the script "#TSBS - Config 2", but it doesn't do anything, so I'm assuming I'm setting it up wrong, or I'm supposed to use it elsewhere.
Also, just in case I wasn't clear enough earlier, I'd like to specify that I'd like each character to have his/her own sequence for using an item.
Oh no, not that way. I assume if you put it that way, you don't know how to set up the action sequence, or maybe even how action sequence works.

Also, in case I wasn't clear enough, you put them inside the action sequence. Revert back that setting to the original setting. Look at the setting up basic sequence. I'm not sure if the wiki is clear enough, but basically
Code:
"K-item" => [
[],
[:case, {
   "@actor_id == 1" => "ActionKey1",
   "@actor_id == 2" => "ActionKey2",
   "@actor_id == 3" => "ActionKey3",
   "@actor_id == 4" => "ActionKey4",
   "@acotr_id == 5" => "ActionKey5",
}],
], 

"ActionKey1" => [
[],
# You define the action sequence for actor 1 here
],

"ActionKey2" => [
[],
# You define the action sequence for actor 2 here
],
Oh no, not that way. I assume if you put it that way, you don't know how to set up the action sequence, or maybe even how action sequence works.

Also, in case I wasn't clear enough, you put them inside the action sequence. Revert back that setting to the original setting. Look at the setting up basic sequence. I'm not sure if the wiki is clear enough, but basically
Code:
"K-item" => [
[],
[:case, {
   "@actor_id == 1" => "ActionKey1",
   "@actor_id == 2" => "ActionKey2",
   "@actor_id == 3" => "ActionKey3",
   "@actor_id == 4" => "ActionKey4",
   "@acotr_id == 5" => "ActionKey5",
}],
],

"ActionKey1" => [
[],
# You define the action sequence for actor 1 here
],

"ActionKey2" => [
[],
# You define the action sequence for actor 2 here
],
OH! That makes a lot more sense, thank you! I misunderstood what the ":case" was used for, whoops. I got the item animations working now, thanks~

I had one other question, though! Is there a way I could change the graphic of a battler by changing a variable? (I.e. 0 = default, 1= desert, 2 = snow, etc.) There are a few circumstances where I'd like my characters to change costumes. Right now I have this done by using the "State Transformation", which works just fine for right now, but I feel like if I could directly change it with a variable it'd just make certain things a bit more convenient.
I had one other question, though! Is there a way I could change the graphic of a battler by changing a variable? (I.e. 0 = default, 1= desert, 2 = snow, etc.) There are a few circumstances where I'd like my characters to change costumes. Right now I have this done by using the "State Transformation", which works just fine for right now, but I feel like if I could directly change it with a variable it'd just make certain things a bit more convenient.
I'm not going to endorse this, but I can tell you where to edit to suit your needs.
Screenshot_701.jpg

Change the line 3802 into something like
Code:
name = "#{base_battler_name+classname+state_trans_name+$game_variables[x].to_s}_#{battler_index}"
I'm not sure if it's the same line there since I might already forget that I changed the code for my game.
Hi there, excellent script!

I'm having two errors that are probably related to some incompatibility with another script, but I have so many now that I don't know which one could be causing it. So I went here to check if it could be told what could possibly be causing the error.
The first one is, whenever I try to use an item in battle, I get this:

Script 'Theo - Basic Modules v1.5d' line 116: ArgumentError occurred.
comparison of String with 0 failed

While I was trying to fix it by rearranging the other of the scripts (I thought it might have something to do with YEA BattleEngine, which I ended up placing it above the basic modules), the Basename Changer Addon, that was working fine, started giving off this error:

Theolized SBS:
Basename Changer Condition check error on Actor ID : 1
wrong number of arguments (1 for 0)

When I was actually not even trying to use the script, it was just pasted there.
Script 'Theo - Basic Modules v1.5d' line 116: ArgumentError occurred.
comparison of String with 0 failed
The line in question is this
Code:
if @target_index < 0
taken from https://forums.rpgmakerweb.com/index.php?threads/rgss3-unofficial-bugfix-snippets.1131/
So I'd put a disclaimer that this isn't essentially my error. Are you by any chance have a script like a target manager or something that change the targeting? I don't get why "@ target_index" can be turned into a string.

Theolized SBS:
Basename Changer Condition check error on Actor ID : 1
wrong number of arguments (1 for 0)

When I was actually not even trying to use the script, it was just pasted there.
If you're not using the script, then you can just remove the script. The error indicates that there's something wrong with your setting. Not necessarily script error as well. You're expected to customize the setting. The error is not really a big deal because you're going to change it anyway if you plan to use it. That said, I can probably track why it gives such error, but it just pointless.

Original thread: https://forums.rpgmakerweb.com/threads/theolized-sideview-battle-system.29231/