Get skill's target and user name?

BlueMage

Slime Lv99
Veteran
Joined
Apr 13, 2019
Messages
116
Reaction score
149
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
31,370
Reaction score
7,678
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,594
Reaction score
6,525
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,248
Reaction score
1,252
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
149
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

Are we allowed to post about non-RPG Maker games? And, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top