Get skill's target and user name?

Hi guys.
What is the script snippet to get target's name & user's name,
assume that i will run it from a Common Event which has been assigned for skillX
doesn't exist by default.

common evvents attached to skills are all executed at the end of the battleturn, after every skill action has its damage formula processed. And the engine only stores the last skill and skill target, it does not keep in mind which skills were used previously.

what you need to do is store some marker with the skill effects and damage formula and then have the common event look for which actor and enemy have those markers. Something like invisible target states that do nothing or similiar.
Use damage formula, save it in the variable.
Code:
v[99] = a.name; v[100] = b.name; <ur damage formula>
Then use those variables in the common event.
EDITED

you want the actors, not the item, but the actors are grabbed *from* the item, which is the object that handles the process.
that requires a method to save those, separately, added *to* the item skill, to perform the save at process time.

here:
Code:
class Scene_ItemBase < Scene_MenuBase
attr_reader :last_target
attr_reader :last_user

alias orig_use_item use_item
alias orig_start start

def start
 orig_start
 @last_target = nil
 @last_user = nil
end

def use_item
 orig_use_item
 @last_target = item_target_actors
 @last_user = user
end
end

(I *THINK*)

access with last_target and last_user
turns out that the item itself doesn't store the target, that's done by the scene handling the item, but there's item skills and item usable items, which are handled by different scenes, so I had to go to the scene immediately above.
Use damage formula, save it in the variable.
Code:
v[99] = a.name; v[100] = b.name; <ur damage formula>
Then use those variables in the common event.
Now that's really a simple way, thank you 😮

EDITED

you want the actors, not the item, but the actors are grabbed *from* the item, which is the object that handles the process.
that requires a method to save those, separately, added *to* the item skill, to perform the save at process time.

here:
Code:
class Scene_ItemBase < Scene_MenuBase
attr_reader :last_target
attr_reader :last_user

alias orig_use_item use_item
alias orig_start start

def start
 orig_start
 @last_target = nil
 @last_user = nil
end

def use_item
 orig_use_item
 @last_target = item_target_actors
 @last_user = user
end
end

(I *THINK*)

access with last_target and last_user
turns out that the item itself doesn't store the target, that's done by the scene handling the item, but there's item skills and item usable items, which are handled by different scenes, so I had to go to the scene immediately above.
It's great to know this too, thank you =)

Original thread: https://forums.rpgmakerweb.com/threads/get-skills-target-and-user-name.109817/