Recognize actor ID number by querying the conditions

Hello everybody! Happy New Year 2021!

Since I'm new here and this is my first entry, I apologize in advance if I should express something imprecisely.

I have a question about my project. I'm using the RMVXA and I'm looking for a way to query the ID number of an actor using a condition query after the same actor has defeated an opponent. A query that defines the ID of the actor who carried out the last action would also suffice.

I plan certain weapons and equipment, the value of which depends on the number of opponents defeated.

I would be happy if someone could help me.
basically for any complex check you'll need two commands instead of only the conditional branch:
first you use control variable to load the data you want from its game data section into the variable, then conditional branch checking the variable value you got.

"last action" is not as easy because it depends on where you check this and for what. And you might have to use a script as the engine itself doesn't provide such info directly (or remembers it at all)
basically for any complex check you'll need two commands instead of only the conditional branch:
first you use control variable to load the data you want from its game data section into the variable, then conditional branch checking the variable value you got.

"last action" is not as easy because it depends on where you check this and for what. And you might have to use a script as the engine itself doesn't provide such info directly (or remembers it at all)
Yes, in the meantime I have long since realized that it exceeds the possibilities of the RMVXA.

I have already looked in a few forums for scripts that could support this project, but couldn't find anything.
have already looked in a few forums for scripts that could support this project, but couldn't find anything.
Tsukihime wrote several scripts that would help, but I don't remember which one did what. Check her blog
I don't understand your requirement.
Do you want to get the last actor ID that killed the last enemy?

How are you going to use this query for? Where exactly? Do you want to use this in a certain script? or eventing?
Tsukihime wrote several scripts that would help, but I don't remember which one did what. Check her blog
All right, I'll have a look!

The point is to note the ID number of the actor who defeated the last opponent as a variable. Basically, I want some kind of kill counter for each character.

I thought about trying it on a Ruby Script branch in a conditional query. This should then be called up via a common event that is activated every time an opponent is defeated.
Kill counter is easy. A simple snippet should suffice.
Code:
class Game_Battler
  attr_writer :kill_counter
  def kill_counter
    @kill_counter ||= 0
  end
 
  alias ex_damage execute_damage
  def execute_damage(user)
    ex_damage(user)
    if self.enemy? && hp == 0
      user.kill_counter += 1
    end
  end
end
And using script call
Code:
$game_actors[1].kill_counter
You get the number.

You can assign it to the variable using a script call.
Kill counter is easy. A simple snippet should suffice.
Code:
class Game_Battler
  attr_writer :kill_counter
  def kill_counter
    @kill_counter ||= 0
  end
 
  alias ex_damage execute_damage
  def execute_damage(user)
    ex_damage(user)
    if self.enemy? && hp == 0
      user.kill_counter += 1
    end
  end
end
And using script call
Code:
$game_actors[1].kill_counter
You get the number.

You can assign it to the variable using a script call.
Thank you very much, that was exactly what I needed!

I simply changed the corresponding variables with the script call. As a permanent trigger after every kill, I just use Yanfly's Death Common Event Script on every opponent. The order must be written for each individual opponent, but that shouldn't be so problematic.

By the way:
Usually I don't work with script calls, but of course I didn't see any other way with this method, since the RMVXA's engine doesn't support this.
I assume that your problem is mostly solved by now?
I assume that your problem is mostly solved by now?
For the most part, yes.

As long as you know how, there is of course always a solution

Original thread: https://forums.rpgmakerweb.com/threads/recognize-actor-id-number-by-querying-the-conditions.131660/