- Joined
- Mar 16, 2012
- Messages
- 6,052
- Reaction score
- 7,139
- First Language
- Indonesian
- Primarily Uses
- RMVXA
First, the counterattack system needs to be removed completely. Changing the invoke item will do the work.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.
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
Based on the sequence phases I put above, how would you put each of them?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.
Is the evasion calculated before the main sequence is played? or right before the item is applied?
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.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).
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.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).
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

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

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?
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.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
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).
Last edited: