Animation skill on enemy but damage on actor

Hello ! I have – hope not dumb– a question regarding Scopes in the game. I made this skill x that causes Blind in my actor (plus some DEF debuffs) but the actual animation is shown over the very enemy. For pure aesthetics, I want to show the animation of this skill over the graphic for the enemy but, this is only made when the scope of the skill is The User.

It worked nicely but that option makes the skill work ONLY for the enemy (including buffs, states) so, in the formula, I added the b.add_state and b.add_debuff blah blah but IT IGNORES COMPLETELY the target and the skill still affects the user. I thought the scope wouldn't work over the formula but it does and redirects my damage to the Enemy instead of the actor.

I tried to play around making a.add_state or a.add_debuff but it makes the same. The issue is IT ALL WORKS but not for the target even though it's on the formula. Here, I'm sharing screenshots of the skill and the message popups.

Any thoughts on this? Yeah, I tried changing the scope as regular but I don't wanna show the animation on the target. Also, I tried making a Common Event but it does exactly the same, redirects damage to enemy instead.

I'd be thankful to find a solution the soonest. If it's the Common Event, how does it work in the battle by switches?

Pd: ignore the changing name of the skill xd
screnskilleerie_.png
noscopeworking.png
the scope defines the target, so if the target/scope is set as user then it is correct that b.add_state works on the user.
The scope "user" is effectively the only case where the placeholder a and b are for the same battler.

Who is supposed to use the skill that should place animation on the enemies?
if that is the player the scope has to be the enemy, if it is an enemy the scope has to be on allies if you want the skill to place an animation on the enemies.
the scope defines the target, so if the target/scope is set as user then it is correct that b.add_state works on the user.
The scope "user" is effectively the only case where the placeholder a and b are for the same battler.

Who is supposed to use the skill that should place animation on the enemies?
if that is the player the scope has to be the enemy, if it is an enemy the scope has to be on allies if you want the skill to place an animation on the enemies.
Hi, thanks for the fast reply! I'm a bit lost at here because the animation of any skill is handled by the scope, do far. So, my ACTOR is the one affected by the damage (state, debuff) as a regular skill and the "caster" is the ENEMY.

I did try playing with the scopes, I used the Allies option, but the animation still doesn't show over the enemy but over the actor, which is the opposite of what I'm trying to achieve visually.
So if you want the animation over the enemy, but the affects to happen to the player,
You need to not use "user' as the scope. As explained by Andar, User will make any effects happen to the user.
a = actor doing the action
b = target of the action.

So user would mean that the your actor is the caster and the target.

You will either have to use one random enemy, or make a common event to select a random enemy and use the animation on it.
Or perhaps you can use a follow up skill that calls a common event or does a random enemy.
There are options, but using one random enemy is the easiest with specifying a.add_state as the formula.
I've tested this and it works.
Thanks! This info is interesting! It's like the formula would be overwritten by the scope which, for me, doesn't make sense.

Regarding the random enemy, I'm not sure what you mean with that ? My Battle System includes only one enemy in the troop all the time (The screenshot shows too merely for trial purpose) but do you mean, to look for an option that shows animation on battle not giving a care on the caster/target?

I haven't tried any common event. I could try it this way with the option "Show Animation" and then come back here to close or keep complaining

I appreciate all the help, @Andar and @Roninator2 You guys are awesome, I've seen you helping around a lot.

Pd: I'm really overwhelmed on how this option of choosing the animation target doesn't PROPERLY exist.
It's like the formula would be overwritten by the scope which, for me, doesn't make sense.
no, exactly the other way around.

the scope determines the target of the formula.
but there are some commands that can be included in the formula that ignore the scope when processed, to the point that they are processed multiple times when the scope has multiple targets.

a and b are mathematical placeholders that are intended to allow you to access both skill user and skill target data when calculating how much damage a skill does.
the default 4*a.atk - 2*b.def does exactly that: take the attack value from the skill user, multiply it by 4, then substract double the defence of the skill target.
after all a tiny rat should not be able to bite through a full plate armor and so on.
no, exactly the other way around.

the scope determines the target of the formula.
but there are some commands that can be included in the formula that ignore the scope when processed, to the point that they are processed multiple times when the scope has multiple targets.

a and b are mathematical placeholders that are intended to allow you to access both skill user and skill target data when calculating how much damage a skill does.
the default 4*a.atk - 2*b.def does exactly that: take the attack value from the skill user, multiply it by 4, then substract double the defence of the skill target.
after all a tiny rat should not be able to bite through a full plate armor and so on.
But let's say, so I can fully learn about this because it's off grips for me now; I have a Dragon that "casts" Healing Fire or whatever, and it will heal itself but a side effect is burning my actor with it (and Burn is a state in the game).

If I set the skill Fire Spell's scope to The User and in the formula I write like this: b.add_state(x); recovery formula won't the actor receive the state at all?

As far as everyone here has explained numerously, a in the formula is the attacker and b is the receiver. If the scope is The User, it means that a's attack goes to a and no to b, something like I'm attacking myself. Is this correct?
I have a Dragon that "casts" Healing Fire or whatever, and it will heal itself but a side effect is burning my actor with it (and Burn is a state in the game).

If I set the skill Fire Spell's scope to The User and in the formula I write like this: b.add_state(x); recovery formula won't the actor receive the state at all?
that will never work, because "The User" is simply always the battler that is using the action/skill.

You need to think from the other side:

Your dragon casts a fire at the actor, that has the side-effect of healing himself.
THAT will work, with the target being an enemy and a javascript code affecting the skill user.

As far as everyone here has explained numerously, a in the formula is the attacker and b is the receiver.

ABSOLUTELY NO

a is the placeholder for the SKILL USER - always and every time.

If the skill is an attack against an enemy, then a is the "attacker", the one using the attack skill.
But if a is healing an ally, then a is still the skill user, the "healer", and there is no attack at all.

and with the scope of "the user" then there is no attack at all, because you never attack yourself.
I'm really overwhelmed on how this option of choosing the animation target doesn't PROPERLY exist.
The skills animation target is defined by the scope. If it is an ally, then it goes on the ally, if it is the enemy, then it goes on the enemy.

If I set the skill Fire Spell's scope to The User and in the formula I write like this: b.add_state(x); recovery formula won't the actor receive the state at all?
You keep thinking that b is the other team. It is not as I and Andar have repeatedly tried to explain.
B is the target. If the scope is the user then a=b. As I said above a = the caster. Whether it is an actor or enemy, it doesn't matter. The one casting the spell or using the skill is the A. The target of the spell/skill is B.
So, at the risk of repeating myself...
Actor Alice uses Heal
Scope = The User
damage type is hp recovery
Formula = a.add_state(100); b.add_state(101); a.mat
Result...
Alice gets state 100 added to her.
Alice gets state 101 added to her
Alice heals magic attack (points) amount of health.
Animation plays on Alice

If you used the same skill and the scope was one ally, then it would do this
Alice gets state 100 added to her.
Target gets state 101 added
Target heals Alice's magic attack (points) amount of health.
Animation plays on Target (ally)
I appreciate all your help guys and I'm sorry if I sounded too dumb but I understand all what I wrote is what I've gathered from other developers and veterans who have simplified formulas.

Maybe the way I spelled my words confuse you I see. But yeah, I didn't want to sound too specific. I do understand that a is the caster and b is the target. And I understand that caster and target can be the same depending on the scope.

@Andar when I wrote "attacker", I meant the SKILL USER, because for me, both are the same even though the skill is not an attack per se. Sorry, but that is another way of seeing it; excuse the simpler terminology XD

@Roninator2 Yeah, about the scope is what I wrote before. Nevertheless, you write One Ally can work with the formula I posted in the beginning? I kinda think I already tried that scope with the same result (the animation was shown over the actor yet). Anyway, guys haven't been able to test and I'll put into practice all of this again to recheck. Meanwhile, thanks for the insights and the lessons. I'm gonna write all of this down!

Once I try it, I'll come back. How do I close a thread if I find my solution?
Once I try it, I'll come back. How do I close a thread if I find my solution?
click on the report link in your first post.
On the bottom left of the post.

(the animation was shown over the actor yet)
If it is to the ally, then yes the animation will be on the ally.

I just edited my post above to mention animations as well. Forgot to say that part.
Hello guys ! So, I tried all of the Scopes and a combination with formulas but neither worked for me. The only way I could find to show the animation over the "caster" (enemy) was with the scope The User. So, at the end, I stayed with that in my skill.

However, in order to affect my actor instead with that same skill, I just edited my Battle Event.

When the enemy uses skill x, it turns a switch. The battle event page checks if the switch is ON; when so, I change the Parameters and add the State I wanted to the actor. Once I do that, I turn the switch OFF.

This does work for me so far. I can close this thread now. Thank y'all!

I'm currently working on a tutorial for all of those newbies like me that want to make their Enemies a littler flashier and the help here was kinda useful.
Sorry to not do this earlier. I was able to make a script to do what you want.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Pre Skill Animation          ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║  Show an animation before the skill ║    09 Jun 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║    Add note tag to skills that will show an              ║
# ║    animation before the skill is done                    ║
# ║       <pre anim: x>                                      ║
# ║                                                          ║
# ║    Add note for changing the subject target              ║
# ║    of the animation                                      ║
# ║       <pre target: user>                                 ║
# ║     Options are user, ally or enemy                      ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║   2022-Jun-09 - Initial publish                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker VX Ace - except nudity    ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Pre_Skill_Animation
  PREANIM = /<pre anim:[ ](\d+)>/i
  TARGET = /<pre target:[ ](\w*)>/i
end

module DataManager
  class <<self; alias load_database_pre_anim load_database; end
  def self.load_database
    load_database_pre_anim
    load_notetags_pre_anim
  end
  def self.load_notetags_pre_anim
    for obj in $data_skills
      next if obj.nil?
      obj.load_notetags_pre_anim
    end
  end
end

class RPG::Skill < RPG::UsableItem
  attr_accessor :pre_animation
  attr_accessor :pre_target
  def load_notetags_pre_anim
    @pre_animation = 0
    @pre_target = 'user'
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_Pre_Skill_Animation::PREANIM
        @pre_animation = $1.to_i
      when R2_Pre_Skill_Animation::TARGET
        @pre_target = $1.to_s.downcase
      end
    }
  end
end
class Scene_Battle
  def use_item
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
    if item.pre_animation != 0
      pre_target = item.pre_target
      total = []
      target = @subject.current_action.make_targets.compact
      clear = target.size - 1
      if clear > 1
        for i in 1..clear
          target[i].pop
        end
      end
      case pre_target
      when 'user'
        target[0] = @subject
      when 'ally'
        target[0] = @subject.friends_unit.random_target
      when 'enemy'
        target[0] = @subject.opponents_unit.random_target
      end
      show_animation(target, item.pre_animation)
    end
    @subject.use_item(item)
    refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Re-opened at @Roninator2's request.

Typo corrected in script

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/animation-skill-on-enemy-but-damage-on-actor.148245/