じ☆ve冰风 发表于 2026-8-2 17:02:39

The_Sarah - [v1.0] Show Target Names

Hey all!

Here's my next release!



Show Target Names
by The_Sarah


Introduction

.
This script provides more freedom for writing skill "use message"s for skills in the Database.
It does this by giving you the ability to have single-target skills include the target's name, rather than just the user's name (which it is by default).
.
.
---------------------
Patch Notes
.
None as of yet
.
---------------------
.
.
Features
.
Original script made by me (The_Sarah).
Initially requested by Ticomanel
.
   With this script, you will be able to make any chosen single-target skills show both the user's
name AND the target's name when writing out their "use message"s in the Database.
.
This is accomplished through the use of the notetag "<callname>" in your chosen skills.
And the replacement of where your target's name would go with the single word "targetname".
.
.
.
How to Use
Place the script below materials and above main in the Script Editor.

Then follow these steps:
.​
Step 1) Add the "<callname>" note tag (without the speech marks) to the notebox of any single-target skill you wish to consider applying this script's effects to.

Step 2) Make sure the skill you added <callname> to is a single-target skill.
This version of the script does not currently interact with multi-target or self-target skills.

Step 3) In your skill's Database section, write out how you want your skill to be shown being used "on-use" in the normal boxes provided.
Make sure to replace the name of the target with the word (no spaces or speech marks): "targetname"

Examples: (user) "attacks targetname!"
                   (user) "punches targetname square in the jaw!"
                   (user) "is so sexy that targetname falls head over heels and takes damage!"

Step 4) Enjoy the script!
Maybe leave a like on my RPG Maker Forum Thread page?



Script
Show Target Names by The_Sarah
Spoiler: Click this box to get Script                Ruby:       
#------------------------------------------------------------------------------#
=begin

                        Show Target Names Script

                              by The_Sarah
                                 (v1.0)
               
--                                                                            --

                           ~~~ REQUIREMENTS ~~~
                     
                                    None

                           
--                                                                            --

                        ~~~ IMPORTANT TO KNOW ~~~
               
   This version of the script currently only affects single-target skills.


--                                                                            --

                              ~~~ HOW TO USE ~~~

                     
Step 1) Add the "<callname>" note tag (without the speech marks) to any skill
         you wish to consider applying this script's effects to.


Step 2) Make sure the skill you added <callname> to is a single-target skill.

         As this version of the script does not currently interact well with
         multi-target or self-target skills.


Step 3) In your skill's Database section, write out how you want your skill
         to be written on-use in the normal boxes.

         Make sure to replace the name of the target with the word
         (with no spaces) "targetname".

         Examples: (user) "attacks targetname!"
                   (user) "punches targetname square in the jaw!"
                   (user) "is so sexy that targetname falls onto the ground!"


Step 4) Enjoy the script!
         Maybe leave a like on my RPG Maker Forum Thread page? :P


--                                                                            --

                              ~~~ FEATURES ~~~
                     
   With this script, you will be able to make any chosen single-target skills
   show both the user's name AND the target's name when writing out their
   "use messages" in the Database.
                     

--                                                                            --

                            ~~~ NOTETAGS KEY ~~~

"<callname>"- Written in the chosen skills' note boxes. Applies this script
               to those skills.
      
"targetname"- Written in the chosen skills' "use messages" boxes. Allows
               you to have more freedom in writing your "use skill" messages.
      

--                                                                            --


                            ~~~ TERMS OF USE ~~~

                  
    If you share a game with this script in it (freely or commercially), you
    must credit me in the game.

      Ideally like this: "Show Target Names script by The_Sarah"

      Of like this if you edit the script yourself:
                         "Original Show Target Names script by The_Sarah"
                  
               
    Other than that, this script is free to download and use or edit in any
    game or project you desire (free or commercial).
                  

--                                                                            --

                              ~~~ REQUESTS ~~~

                     
   If you would like me to add more functionality to this script, such as
   multi-targeting, please request so in the RPG Maker Forum Thread I made
   to originally host this Script.


   I will reply to all requests when I have the time (which shouldn't be too
   long to be honest) and do my best to accomodate them.


--                                                                            --

                              ~~~ BUGS ~~~

                           No current known issues.

      
--                                                                            --

                           ~~~ SPECIAL THANKS ~~~

   * The_Sarah (aka me) for being awesome and making this script :D

   * RPG Maker Forum user Ticomanel for requesting it / the idea.


--                                                                            --

                              ~~~ OUTRO ~~~

   And that's it!

   This is only my third public script so it might be a little messy
   (especially in its early versions), but hope it helps those interested in
   something like this.

   Have wonderful lives everyone.
   Be kind to eachother.
   Remember we're all human!

                  Let's make wonderful games together!

                                                            - The_Sarah

=end
#------------------------------------------------------------------------------#
#=begin


#------------------------------------------------------------------------------#
#                              The Script                                    #
#------------------------------------------------------------------------------#

#==============================================================================
# ** New Module: The_Sarah's Target Log
#==============================================================================
module TheSarahTargetLog
class << self
    attr_accessor   :skill_target_name
end
end

#==============================================================================
# ** Window_BattleLog
#------------------------------------------------------------------------------
#This window is for displaying battle progress. No frame is displayed, but it
# is handled as a window for convenience.
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# * Aliased Method: Display Skill/Item Use
#--------------------------------------------------------------------------
alias thesarah_targetlog_windowbattlelog_displayuseitem    display_use_item
def display_use_item(subject, item)
    if item.is_a?(RPG::Skill)
      if item.note[/<callname>/i] && item.message1 || item.message2
      item.message1 = item.message1.gsub("targetname", TheSarahTargetLog::skill_target_name)
      item.message2 = item.message2.gsub("targetname", TheSarahTargetLog::skill_target_name)
      thesarah_targetlog_windowbattlelog_displayuseitem(subject, item) # calls original method
      item.message1 = item.message1.gsub(TheSarahTargetLog::skill_target_name, "targetname")
      item.message2 = item.message2.gsub(TheSarahTargetLog::skill_target_name, "targetname")

      elsif item.note[/<callname>/i] && !item.message1 && !item.message2
      thesarah_targetlog_windowbattlelog_displayuseitem(subject, item) # calls original method
      item.message1 = item.message1.gsub(TheSarahTargetLog::skill_target_name, "targetname")
      item.message2 = item.message2.gsub(TheSarahTargetLog::skill_target_name, "targetname")

      else# skill has no relevant name notes
      thesarah_targetlog_windowbattlelog_displayuseitem(subject, item) # calls original method
      end
    else# item is not a skill
      thesarah_targetlog_windowbattlelog_displayuseitem(subject, item) # calls original method
    end
end # end of method

end # end of Window_BattleLog class

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Aliased Method: Use Skill/Item
#--------------------------------------------------------------------------
alias thesarah_targetlog_scenebattle_useitem            use_item
def use_item
    item = @subject.current_action.item
    if item.is_a?(RPG::Skill) && item.note[/<callname>/i]
      return the_sarahs_custom_use_item_method
    end
    thesarah_targetlog_scenebattle_useitem# calls original method
end
#--------------------------------------------------------------------------
# * New Method: The_Sarah's Custom Use_Item Method
#--------------------------------------------------------------------------
def the_sarahs_custom_use_item_method
    item = @subject.current_action.item
    targets = @subject.current_action.make_targets.compact
    targets.each {|target| get_target_info(target) }

    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
end
#--------------------------------------------------------------------------
# * New Method: Get Target Info
#--------------------------------------------------------------------------
def get_target_info(target)
    TheSarahTargetLog::skill_target_name = target.name
end


end # end of Scene_Battle class


#=end
#------------------------------------------------------------------------------#
#                            End of the Script                                 #
#------------------------------------------------------------------------------#


.
Credit and Thanks
Me, aka The_Sarah for making the script.
Ticomanel for the idea.
.
.
Terms of use​

1) Users must link to this forum post when sharing the script elsewhere.
2) Users must credit The_Sarah when sharing free games with others that have this script in them.
3) Users must credit The_Sarah when using the script in a game selling commercially.
4) If Users have edited the script, credit must still be provided to The_Sarah for the original script.
5) Other than that, there is no cost and it is free to use wherever
.

And that's it!
Enjoy, everyone!

.
.
Screenshots
(forgive the media play bar in the screenshots, captured them in gif form first)​
001 - Without the script ~~~~~~~~~~~~~~~~ 002 - With the Script ~~~~~~~~~~~~~~~~~~



https://forums.rpgmakerweb.com/attachments/002-brenda-attacks-jpg.156851/

003 - With the Script (pre-damage) ~~~~~~~~004 - With the Script (customised further)~~~

https://forums.rpgmakerweb.com/attachments/003-slime-b-attacks-jpg.156852/





本贴来自国际rpgmaker官方论坛作者:The_Sarah处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/the_sarah-v1-0-show-target-names.125902/
页: [1]
查看完整版本: The_Sarah - [v1.0] Show Target Names