Get skill's target and user name?

BlueMage

Slime Lv99
Veteran
Joined
Apr 13, 2019
Messages
116
Reaction score
148
First Language
English
Primarily Uses
RMVX
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
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,002
Reaction score
7,018
First Language
German
Primarily Uses
RMMV
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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,056
Reaction score
5,681
First Language
Indonesian
Primarily Uses
RMVXA
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.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,081
Reaction score
1,036
First Language
Spanish
Primarily Uses
RMVXA
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.
 
Last edited:

BlueMage

Slime Lv99
Veteran
Joined
Apr 13, 2019
Messages
116
Reaction score
148
First Language
English
Primarily Uses
RMVX
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 :o

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 =)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

tfw, I found one of my skill ability in my game is not worth picking and had to plan to buff it. But my players seemed to use it without complaining. Now, idk if I should buff it or leave it as is.
I have recently discovered a Limit breaker for RPGmaker VXA, needless to say this changes everything.also I really like the changes this website has made.
It seems that my favorite anime page finally kicked the bucket... :,c
work in progres c:

Forum statistics

Threads
97,768
Messages
946,830
Members
128,977
Latest member
SorcererRed
Top