设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 135|回复: 0

[转载发布] The_Sarah - [v1.2.1] Final Fantasy style Throw Script

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 14:33:31 | 显示全部楼层 |阅读模式
    Well folks, here it is!

    This one took quite a bit of extra effort but I was right in thinking it'd be in my wheelhouse after learning about making Sub Commands for my main game project.


    FFIX Style Throw Script
    version 1.2.1

    by The_Sarah


    Introduction
    A final fantasy styled Throw script!
    The user can create their Throw skill in the Database (with whatever Damage Formula they want to use) and then use Notetags to decide who has the skill and how much damage individual items will do when thrown.

    ---------------------
    Patch Notes
    - Update 2-
    Version 1.2 is done!
    i) This one fixes a bug that would happen if you had two characters throwing the same item in a turn.
    ii) This one also finishes aliasing all methods so the script should hopefully work with any number of other scripts.
    iii) This one also removes the bug to do with empty enemy names.
    iv) This is (hopefully) that last bug-fixing/neat-making script update, any future updates should either be me adding additional Damage Related Notetags (or other requests) or adding in planned features (like ally-targeting and chance of item pick-up).
    v) Version 1.1 has been removed and replaced with Version 1.2.
    vi) Pastebin Link removed as site seems to be having issues, future code drops will be done with this Forum's code and spoiler insertion methods.
    vii) Updated to 1.2.1, some finishing touches made on aliasing and some if and case statements rephrased.

    -Update 1-
    Version 1.1 is done!
    i) This one makes it easier to assign characters the Throw skill (via notetags now) and cleans up a lot of the code.
    ii) It also adds in some aliases and fixes a couple bugs.
    iii) It also adds some people to the special thanks section

    iv) As there were a few bugs in the original 1.0 version of the script, I will remove that version and only have version 1.1 available on this thread from now on.

    ---------------------

    Script Features
    .

    With this script, you can make any number of characters (who are Game Actors in the Database) able to use the "Throw" skill.

    The Throw skill (by default) is found underneath any chosen character's SPECIAL/MAGIC command and above that character's GUARD command when in battle.

    The skill will open a unique Throwable Object Window.
    - This window will then show the player a list of any Items, Weapons or Armour that they have in their inventory that you (the game maker) have decided can be thrown in your game.

    The player can then pick from this list and throw the object at an enemy.

    The object thrown will decrease in the party's inventory by 1.

    Any damage a thrown object does is calculated based on whatever YOU wrote in your "Throw" Skill's damage formula (in the Database), as well as whatever Notetag you have assigned to the Item/Weapon/Armour thrown.


    How to Use
    Copy and paste the Script into a slot above Main Process and below Materials in your Script Editor.
    .​

    Then follow these 5 steps:

    Step 1) Create a "Throw" skill in your Database like you normally would for any custom skill.

    Step 2) In the Editable Region in the script (just below the Script Intro), change the number 185 to the number of your Throw skill's id in the Database.

    Step 3) For any character you want to be able to use the Throw skill, simply add a notetag saying (without the speech marks) "<Throw>" .
    - Add this <Throw> notetag in the relevant character's Note Box (in the Game Actors section of the Database).

    Step 4) For any items, weapons or armour in your game that you would like to be throwable:

    i ) You must write a Notetag in their Note Box sections in the Database.

    ii ) A full list of the notetags you can write, as well as information on what they each do, can be found below "Features" in the Script Intro section of the Script.

    iii) This list is found in the section named "~ NOTETAGS KEY ~".

    Step 5) Enjoy the script! Maybe leave a like on this forum thread post?



    The Script
    (click the spoiler button and copy paste this section)​


    Spoiler: Ruby Code
                    Ruby:       
    1. #------------------------------------------------------------------------------#
    2. =begin
    3.                           "FFIX Style" Throw Script
    4.                                 by The_Sarah
    5.                                   (v1.2.1)
    6.                  
    7. --                                                                            --
    8.                              ~~~ REQUIREMENTS ~~~
    9.                      
    10.                                     None
    11.                            
    12. --                                                                            --
    13.                               ~~~ HOW TO USE ~~~
    14. Step 1) Create a "Throw" skill in your Database like you normally would.
    15. Step 2) In the Editable Region below, change the number 185 to the number
    16.          of your Throw skill's id in the Database.
    17. Step 3) For any character you want to be able to use the Throw skill, simply
    18.          add a notetag saying "<Throw>" (without the speechmarks).
    19.           - Add this <Throw> notetag in the relevant character's Note Box (in
    20.             the Game Actors section of the Database).
    21. Step 4) For any items, weapons or armour in your inventory that you would
    22.          like to be throwable:
    23.          i) You must write a Notetag in their Note Box sections in the Database.
    24.         ii) A FULL LIST of the notetags you can write, as well as information
    25.             on what they each do, can be found below.
    26.    
    27.        iii) This list is found under the "~ NOTETAGS KEY ~" section of this
    28.             script intro (just below FEATURES).
    29.    
    30. Step 5) Enjoy the script!
    31.          Maybe leave a like on my RPG Maker Forum Thread page? :P
    32. --                                                                            --
    33.                               ~~~ FEATURES ~~~
    34.                        
    35.    With this script, you can make any number of characters (who are Game Actors)
    36.    in your game able to use the "Throw" skill.
    37.    The Throw skill is a skill that (by default) is found underneath any chosen
    38.    character's SKILL command and above that character's GUARD command when in
    39.    battle.
    40.    This skill will open a unique Throwable Item Window.
    41.     - This window will then show the player a list of any Items, Weapons or
    42.       Armour that they have in their inventory that you (the game maker) have
    43.       decided are throwable in your game.
    44.    The player can then pick from this list and throw the object at an enemy.
    45.    The object thrown will decrease in the party's inventory by 1.
    46.    Any damage a thrown object does is calculated on whatever you wrote in
    47.    your "Throw" skill's damage formula (in the Database), as well as whatever
    48.    Notetag you have assigned to the Item/Weapon/Armour thrown.
    49. --                                                                            --
    50.                             ~~~ NOTETAGS KEY ~~~
    51.    The following section is a list of every Notetag you can put into the Note
    52.    Box of an Item, Weapon or Armour in the game's Database to make them
    53.    throwable.
    54.    The list also includes information on what each Notetag does to the damage
    55.    of your Throw skill.
    56.    Please note, each variant on the Notetag applies a different effect to
    57.    YOUR existing Throw skill's Damage Formula.
    58.    So make sure to have already created a Throw Skill in the Database as well :)
    59. ________________________________________________________________________________
    60.    Notetag             Effect           |    Notetag             Effect
    61.   <throwheal>  = Throws for 1x healing  | <throwhalf>   = Throws for half damage
    62.   <throwdmg0>  = Throws for 0   damage  | <throwdmg>    = Throws for 1x  damage
    63.   <throwdmg1>  = Throws for 1x  damage  | <throwdmg2>   = Throws for 2x  damage
    64.   <throwdmg3>  = Throws for 3x  damage  | <throwdmg4>   = Throws for 4x  damage
    65.   <throwdmg5>  = Throws for 5x  damage  | <throwdmg6>   = Throws for 6x  damage
    66.   <throwdmg7>  = Throws for 7x  damage  | <throwdmg8>   = Throws for 8x  damage
    67.   <throwdmg9>  = Throws for 9x  damage  | <throwdmg10>  = Throws for 10x damage
    68.   <throwdmg11> = Throws for 11x damage  | <throwdmg12>  = Throws for 12x damage
    69.   <throwdmg13> = Throws for 13x damage  | <throwdmg14>  = Throws for 14x damage
    70.   <throwdmg15> = Throws for 15x damage  | <throwdmg16>  = Throws for 16x damage
    71.   <throwdmg17> = Throws for 17x damage  | <throwdmg18>  = Throws for 18x damage
    72.   <throwdmg19> = Throws for 19x damage  | <throwdmg20>  = Throws for 20x damage
    73.   <throwdmg21> = Throws for 21x damage  | <throwdmg22>  = Throws for 22x damage
    74.   <throwdmg23> = Throws for 23x damage  | <throwdmg24>  = Throws for 24x damage
    75.   <throwdmg25> = Throws for 25x damage  | <throwdmg50>  = Throws for 50x damage
    76.   <throwdmg75> = Throws for 75x damage  | <throwdmg100> = Throws for 100x damage
    77.   <throwdmg250> = Throws for 250x damage| <throwdmg500> = Throws for 500x damage
    78.   <throwdmg750> = Throws for 750x damage|
    79.   <throwdmg1000> = Throws for 1000x damage
    80.   <throwdmg2500> = Throws for 2500x damage
    81.   <throwdmg5000> = Throws for 5000x damage
    82.   <throwdmg7500> = Throws for 7500x damage
    83.   <throwdmg10000> = Throws for 10000x damage
    84. ________________________________________________________________________________
    85. --                                                                            --
    86.                             ~~~ TERMS OF USE ~~~
    87.                   
    88.     If you share a game with this script in it (freely OR commercially), you
    89.                          MUST credit me in the game.
    90.                Ideally like this: "Throw Script by The_Sarah"
    91.     Or like this if you edited the script: "Original Throw Script by The_Sarah"
    92.     Other than that, this script is free to download and use or edit in any
    93.                     game or project (free or commercial).
    94.                   
    95. --                                                                            --
    96.                               ~~~ REQUESTS ~~~
    97.    If you would like me to add more damage variants via additional notetags,
    98.    please request so in the RPG Maker Forum Thread I made to originally host
    99.    this Script.
    100.    I will reply to all requests when I have the time (which shouldn't be too
    101.    long to be honest) and do my best to accomodate them.
    102. --                                                                            --
    103.                                 ~~~ BUGS ~~~
    104.                            No current known issues.
    105.       
    106. --                                                                            --
    107.                            ~~~ SPECIAL THANKS ~~~
    108.      * The_Sarah (aka me) for being awesome and making this script :O
    109.      * TheoAllen (RPG Maker Forum user) for initially helping me with
    110.        figuring out the make_damage_value method.
    111.      * Kyonides  (RPG Maker Forum user) for helping with Module Instance
    112.        variables and Regex.
    113.      * A-Moonless-Night (RPG Maker Forum user) for Aliasing help as well as
    114.        helping me to finally understand how to grab specific parts within a
    115.        Regex string.
    116.      * LockeZ Ninja Throw (Script) for helping me figure out how to decrease
    117.        items when thrown.
    118. --                                                                            --
    119.                                 ~~~ OUTRO ~~~
    120.    And that's it!
    121.    This is my second ever public script (and definitely the biggest public one
    122.    I've made so far) and as a result it has many areas I'm sure can be cleaned
    123.    up (looking at you "include?").
    124.    But the community on the RPG Maker Forum has been mostly friendly so far, so
    125.    I'm happy to allow anyone who wants to look at it and give me tips to do so
    126.    (if they feel so kind).
    127.    Have wonderful lives everyone.
    128.    Be kind to eachother.
    129.    Don't be ____ist or ___phobic towards others, remember we're all human!
    130.                     Let's make wonderful games together!
    131.                                                             - The_Sarah
    132. =end
    133. #------------------------------------------------------------------------------#
    134. #=begin
    135. module TheSarahThrow
    136. #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~#
    137. #                 ~~~~----# - EDITABLE REGION - #----~~~~                      #
    138. #                               IMPORTANT                                      #
    139. # Change the number in this section to the number of your Throw skill in the
    140. # Database (default 185):
    141.                 THROW_SKILL_ID      =      185         # Your Throw skill ID
    142. #                    ~~# - END OF EDITABLE REGION - #~~                        #
    143.             
    144. #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~#
    145. end # End of TheSarahThrow module
    146. #------------------------------------------------------------------------------#
    147. #                                The Script                                    #
    148. #------------------------------------------------------------------------------#
    149. #------------------------------------------------------------------------------#
    150. #                               Game Classes                                   #
    151. #==============================================================================
    152. # * Exisiting Class
    153. # ** Game_Action
    154. #------------------------------------------------------------------------------
    155. #  This class handles battle actions. This class is used within the
    156. #  Game_Battler class.
    157. #==============================================================================
    158. class Game_Action
    159.   #--------------------------------------------------------------------------
    160.   # * New Method
    161.   # ** Set Throw action
    162.   #--------------------------------------------------------------------------
    163.   def set_throw_action
    164.     if BattleManager.actor.thrown_item != 0
    165.       set_skill(subject.throw_skill_id)
    166.       self
    167.     else
    168.       next_action
    169.     end
    170.   end
    171. end # End of Game_Action class
    172. #==============================================================================
    173. # * Existing Class
    174. # ** Game_BattlerBase
    175. #------------------------------------------------------------------------------
    176. #  This base class handles battlers. It mainly contains methods for calculating
    177. #  parameters. It is used as a super class of the Game_Battler class.
    178. #==============================================================================
    179. class Game_BattlerBase
    180.   #--------------------------------------------------------------------------
    181.   # * New Method
    182.   # ** Set Throw Skill ID
    183.   #--------------------------------------------------------------------------
    184.   def throw_skill_id
    185.     return TheSarahThrow::THROW_SKILL_ID
    186.   end
    187. end # End of Game_BattlerBase class
    188. #==============================================================================
    189. # * Existing Class
    190. # ** Game_Battler
    191. #------------------------------------------------------------------------------
    192. #  A battler class with methods for sprites and actions added. This class
    193. # is used as a super class of the Game_Actor class and Game_Enemy class.
    194. #==============================================================================
    195. class Game_Battler < Game_BattlerBase
    196.   #--------------------------------------------------------------------------
    197.   # * Existing Method
    198.   # ** Calculate Damage (aliased)
    199.   #--------------------------------------------------------------------------
    200.   alias thesarah_throwscript_gamebattler_makedmgval        make_damage_value
    201.   def make_damage_value(user, item)
    202.     if item.id == TheSarahThrow::THROW_SKILL_ID && user.is_a?(Game_Actor) && user.has_throw
    203.       return thesarah_custom_damage_method(user, item)
    204.     end
    205.     thesarah_throwscript_gamebattler_makedmgval(user, item)
    206.   end
    207.   #--------------------------------------------------------------------------
    208.   # * New Method
    209.   # ** Calculate Damage when Throw is used
    210.   #--------------------------------------------------------------------------
    211.   def thesarah_custom_damage_method(user, item)
    212.     value = item.damage.eval(user, self, $game_variables)
    213.     case user.thrown_item_notetag
    214.     when /<throwdmg\s*(\d+)>/i
    215.         value *= $1.to_i
    216.     end
    217.     if user.thrown_item_category == "Nothing to throw"
    218.       value *= 0
    219.       Audio.se_play("Audio/SE/Miss", 80, 100)
    220.     end
    221.     value *= 0.5 if user.thrown_item_notetag[/throwhalf/i]
    222.     value *= -1  if user.thrown_item_notetag[/throwheal/i]
    223.     user.reset_thrown_item()
    224.     value *= item_element_rate(user, item)
    225.     value *= pdr if item.physical?
    226.     value *= mdr if item.magical?
    227.     value *= rec if item.damage.recover?
    228.     value = apply_critical(value) if @result.critical
    229.     value = apply_variance(value, item.damage.variance)
    230.     value = apply_guard(value)
    231.     @result.make_damage(value.to_i, item)
    232.   end
    233. end # End of Game_Battler class
    234. #==============================================================================
    235. # * Existing Class
    236. # ** Game_Actor
    237. #------------------------------------------------------------------------------
    238. #  This class handles actors. It is used within the Game_Actors class
    239. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
    240. #==============================================================================
    241. class Game_Actor < Game_Battler
    242.   #--------------------------------------------------------------------------
    243.   # * Public Instance Variables
    244.   #--------------------------------------------------------------------------
    245.   attr_accessor :has_throw              # Checks if Actor has Throw command
    246.   attr_accessor :thrown_item            # Checks Thrown Item ID
    247.   attr_accessor :thrown_item_notetag    # Checks Thrown Item Notetag
    248.   attr_accessor :thrown_item_category   # Checks Thrown Item Type/Category
    249.   #--------------------------------------------------------------------------
    250.   # * New Method
    251.   # ** Reset Thrown Item
    252.   #--------------------------------------------------------------------------
    253.   def reset_thrown_item
    254.     @thrown_item = 0
    255.     @thrown_item_notetag = ""
    256.     @thrown_item_category = ""
    257.   end
    258.   #--------------------------------------------------------------------------
    259.   # * Existing Method
    260.   # ** Setup (aliased)
    261.   #--------------------------------------------------------------------------
    262.   alias thesarah_throwscript_gameactor_setup          setup
    263.   def setup(actor_id)
    264.     thesarah_throwscript_gameactor_setup(actor_id)  # Calls original Method
    265.     @has_throw = true if actor.note[/<Throw>/i];    # p(actor.note)
    266.   end
    267.   #--------------------------------------------------------------------------
    268.   # * Existing Method (from Game_Battler)
    269.   # ** Use Skill/Item (aliased)
    270.   #--------------------------------------------------------------------------
    271.   alias thesarah_throwscript_gameactor_useitem              use_item
    272.   def use_item(item)
    273.     case @thrown_item_category
    274.     when "Armour"
    275.       if $game_party.has_item?($data_armors[@thrown_item])
    276.           $game_party.lose_item($data_armors[@thrown_item], 1)
    277.       else
    278.           @thrown_item_category = "Nothing to throw"
    279.       end
    280.     when "Weapon"
    281.       if $game_party.has_item?($data_weapons[@thrown_item])
    282.           $game_party.lose_item($data_weapons[@thrown_item], 1)
    283.       else
    284.           @thrown_item_category = "Nothing to throw"
    285.       end
    286.     when  "Item"
    287.       if $game_party.has_item?($data_items[@thrown_item])
    288.           $game_party.lose_item($data_items[@thrown_item], 1)
    289.       else
    290.           @thrown_item_category = "Nothing to throw"
    291.       end
    292.     end
    293.     thesarah_throwscript_gameactor_useitem(item)    # calls original method
    294.   end
    295. end # End of Game_Actor class
    296. #------------------------------------------------------------------------------#
    297. #                              Window Classes                                  #
    298. #==============================================================================
    299. # * Existing Class
    300. # ** Window_ActorCommand
    301. #------------------------------------------------------------------------------
    302. #  This window is for selecting an actor's action on the battle screen.
    303. #==============================================================================
    304. class Window_ActorCommand < Window_Command
    305.   #--------------------------------------------------------------------------
    306.   # * Existing Method  
    307.   # ** Create Command List (aliased)  
    308.   #--------------------------------------------------------------------------
    309.   alias thesarah_throwscript_winactorcmd_makecmdlist      make_command_list
    310.   def make_command_list
    311.     return unless @actor
    312.     if BattleManager.actor.has_throw == true
    313.       return thesarah_throwadded_make_command_list
    314.     end
    315.     thesarah_throwscript_winactorcmd_makecmdlist
    316.   end
    317.   #--------------------------------------------------------------------------
    318.   # * New Method                        | To change skill order, edit where the
    319.   # ** Create Command List with [Throw] | "add_throw_command" goes below.
    320.   #--------------------------------------------------------------------------
    321.   def thesarah_throwadded_make_command_list
    322.     return unless @actor
    323.     add_attack_command
    324.     add_skill_commands
    325.     add_throw_command
    326.     add_guard_command
    327.     add_item_command
    328.   end
    329.   #--------------------------------------------------------------------------
    330.   # * New Method
    331.   # ** Add defined Throw Command to List
    332.   #--------------------------------------------------------------------------
    333.   def add_throw_command
    334.   add_command("Throw", :throw)
    335.   end
    336. end # End of Window_ActorCommand class
    337. #==============================================================================
    338. # * New Class
    339. # ** Window_BattleEnemy_Throw         (alternate version of Window_BattleEnemy)
    340. #------------------------------------------------------------------------------
    341. #  Window for selecting the enemy who is the action target on the battle
    342. #  screen (after selecting item to throw).
    343. #==============================================================================
    344. class Window_BattleEnemy_Throw < Window_Selectable
    345.   #--------------------------------------------------------------------------
    346.   # * Object Initialization
    347.   #--------------------------------------------------------------------------
    348.   def initialize(info_viewport)
    349.     super(0, info_viewport.rect.y, window_width, fitting_height(4))
    350.     refresh
    351.     self.visible = false
    352.     @info_viewport = info_viewport
    353.   end
    354.   #--------------------------------------------------------------------------
    355.   # * Get Window Width
    356.   #--------------------------------------------------------------------------
    357.   def window_width
    358.     Graphics.width - 128
    359.   end
    360.   #--------------------------------------------------------------------------
    361.   # * Get Digit Count
    362.   #--------------------------------------------------------------------------
    363.   def col_max
    364.     return 2
    365.   end
    366.   #--------------------------------------------------------------------------
    367.   # * Get Number of Items
    368.   #--------------------------------------------------------------------------
    369.   def item_max
    370.     $game_troop.alive_members.size
    371.   end
    372.   #--------------------------------------------------------------------------
    373.   # * Get Enemy Object
    374.   #--------------------------------------------------------------------------
    375.   def enemy
    376.     $game_troop.alive_members[@index]
    377.   end
    378.   #--------------------------------------------------------------------------
    379.   # * Draw Item
    380.   #--------------------------------------------------------------------------
    381.   def draw_item(index)
    382.     change_color(normal_color)
    383.     name = $game_troop.alive_members[index].name
    384.     draw_text(item_rect_for_text(index), name)
    385.   end
    386.   #--------------------------------------------------------------------------
    387.   # * Show Window
    388.   #--------------------------------------------------------------------------
    389.   def show
    390.     if @info_viewport
    391.       width_remain = Graphics.width - width
    392.       self.x = width_remain
    393.       @info_viewport.rect.width = width_remain
    394.       select(0)
    395.     end
    396.     super
    397.   end
    398.   #--------------------------------------------------------------------------
    399.   # * Hide Window
    400.   #--------------------------------------------------------------------------
    401.   def hide
    402.     @info_viewport.rect.width = Graphics.width if @info_viewport
    403.     super
    404.   end
    405. end # End of Window_BattleEnemy_Throw class
    406. #==============================================================================
    407. # * New Class
    408. # ** Window_ThrowItem                 (alternate version of Window_BattleItem)
    409. #------------------------------------------------------------------------------
    410. #  This class is for selecting items to use in the "Throw Item" Window.
    411. #==============================================================================
    412. class Window_ThrowItem < Window_ItemList
    413.   #--------------------------------------------------------------------------
    414.   # * Object Initialization
    415.   #--------------------------------------------------------------------------
    416.   def initialize(help_window, info_viewport)
    417.     y = help_window.height
    418.     super(0, y, Graphics.width, info_viewport.rect.y - y)
    419.     self.visible = false
    420.     @help_window = help_window
    421.     @info_viewport = info_viewport
    422.   end
    423.   #--------------------------------------------------------------------------
    424.   # * Include in Item List?
    425.   # Note to Refractors - You wouldn't believe what this used to look like.
    426.   #--------------------------------------------------------------------------
    427.   def include?(item)
    428.     return true if item.is_a?(RPG::Item) && item.note[/<throwheal>/i]
    429.     return true if item.is_a?(RPG::Item) && item.note[/<throwhalf>/i]
    430.     return true if item.is_a?(RPG::Item) && item.note[/throwdmg/i]
    431.     return true if item.is_a?(RPG::Weapon) && item.note[/<throwheal>/i]
    432.     return true if item.is_a?(RPG::Weapon) && item.note[/<throwhalf>/i]
    433.     return true if item.is_a?(RPG::Weapon) && item.note[/throwdmg/i]
    434.     return true if item.is_a?(RPG::Armor) && item.note[/<throwheal>/i]
    435.     return true if item.is_a?(RPG::Armor) && item.note[/<throwhalf>/i]
    436.     return true if item.is_a?(RPG::Armor) && item.note[/throwdmg/i]
    437.   end
    438.   #--------------------------------------------------------------------------
    439.   # * Display in Enabled State?
    440.   #--------------------------------------------------------------------------
    441.   def enable?(item)
    442.     true
    443.   end
    444.   #--------------------------------------------------------------------------
    445.   # * Show Window
    446.   #--------------------------------------------------------------------------
    447.   def show
    448.     select_last
    449.     @help_window.show
    450.     super
    451.   end
    452.   #--------------------------------------------------------------------------
    453.   # * Hide Window
    454.   #--------------------------------------------------------------------------
    455.   def hide
    456.     @help_window.hide
    457.     super
    458.   end
    459. end # End of Window_ThrowItem class
    460. #------------------------------------------------------------------------------#
    461. #                               Scene Classes                                  #
    462. #==============================================================================
    463. # * Existing Class
    464. # ** Scene_Battle
    465. #------------------------------------------------------------------------------
    466. #  This class performs battle screen processing.
    467. #  Basically it manages what happens in a battle.
    468. #==============================================================================
    469. class Scene_Battle < Scene_Base
    470.   #--------------------------------------------------------------------------
    471.   # * Existing Method
    472.   # ** Create All Windows (aliased)
    473.   #--------------------------------------------------------------------------
    474.   alias thesarah_throwscript_scenebattle_createallwinds     create_all_windows
    475.   def create_all_windows
    476.     thesarah_throwscript_scenebattle_createallwinds
    477.     create_throwitem_window      
    478.     create_enemy_throw_window   
    479.   end
    480.   #--------------------------------------------------------------------------
    481.   # * Existing Method
    482.   # ** Create Actor Commands Window (aliased)
    483.   #--------------------------------------------------------------------------
    484.   alias thesarah_throwscript_scenebattle_createactorcmdwin  create_actor_command_window
    485.   def create_actor_command_window
    486.     thesarah_throwscript_scenebattle_createactorcmdwin
    487.     @actor_command_window.set_handler(:throw,  method(:command_throwitem))
    488.   end
    489.   #--------------------------------------------------------------------------
    490.   # * New Method
    491.   # ** [Throw Item] Command
    492.   #--------------------------------------------------------------------------
    493.   def command_throwitem
    494.     @throwitem_window.refresh
    495.     @throwitem_window.show.activate
    496.   end
    497.   #--------------------------------------------------------------------------
    498.   # * New Method
    499.   # ** Create Throw Item Window
    500.   #--------------------------------------------------------------------------
    501.   def create_throwitem_window
    502.     @throwitem_window = Window_ThrowItem.new(@help_window, @info_viewport)
    503.     @throwitem_window.set_handler(:ok,     method(:on_throwitem_ok))
    504.     @throwitem_window.set_handler(:cancel, method(:on_throwitem_cancel))
    505.   end
    506.   #--------------------------------------------------------------------------
    507.   # * New Method
    508.   # ** Throw Item [OK]
    509.   #--------------------------------------------------------------------------
    510.   def on_throwitem_ok
    511.     @throwitem = @throwitem_window.item
    512.     if @throwitem == nil
    513.       @throwitem_window.hide
    514.       Audio.se_play("Audio/SE/Buzzer1", 80, 100)
    515.       @actor_command_window.activate
    516.     else
    517.         BattleManager.actor.input.set_item(@throwitem.id)
    518.         BattleManager.actor.thrown_item          = @throwitem.id
    519.         BattleManager.actor.thrown_item_notetag  = @throwitem.note
    520.         if @throwitem.is_a?(RPG::Armor)
    521.              BattleManager.actor.thrown_item_category = "Armour"
    522.      elsif @throwitem.is_a?(RPG::Weapon)
    523.              BattleManager.actor.thrown_item_category = "Weapon"
    524.      elsif @throwitem.is_a?(RPG::Item)
    525.              BattleManager.actor.thrown_item_category = "Item"
    526.         end
    527.         @throwitem_window.hide
    528.         select_throw_enemy_selection
    529.     end
    530.     $game_party.last_item.object = @throwitem
    531.   end
    532.   #--------------------------------------------------------------------------
    533.   # * New Method
    534.   # ** Throw Item [Cancel]
    535.   #--------------------------------------------------------------------------
    536.   def on_throwitem_cancel
    537.     @throwitem_window.hide
    538.     @actor_command_window.activate
    539.   end
    540.   #--------------------------------------------------------------------------
    541.   # * New Method
    542.   # ** Create Enemy Throw Window
    543.   #--------------------------------------------------------------------------
    544.   def create_enemy_throw_window
    545.     @enemy_window_throw = Window_BattleEnemy_Throw.new(@info_viewport)
    546.     @enemy_window_throw.set_handler(:ok,     method(:on_enemy_throw_ok))
    547.     @enemy_window_throw.set_handler(:cancel, method(:on_enemy_throw_cancel))
    548.   end
    549.   #--------------------------------------------------------------------------
    550.   # * New Method
    551.   # ** Start Throw Enemy Selection
    552.   #--------------------------------------------------------------------------
    553.   def select_throw_enemy_selection
    554.     @enemy_window_throw.refresh
    555.     @enemy_window_throw.show.activate
    556.   end
    557.   #--------------------------------------------------------------------------
    558.   # * New Method
    559.   # ** Enemy [OK] (after picking an item to throw)
    560.   #--------------------------------------------------------------------------
    561.   def on_enemy_throw_ok
    562.     BattleManager.actor.input.target_index = @enemy_window_throw.enemy.index
    563.     @skill_window.hide
    564.     @item_window.hide
    565.     @enemy_window_throw.hide
    566.     @throwitem_window.hide
    567.     BattleManager.actor.input.set_throw_action
    568.     next_command
    569.   end
    570.   #--------------------------------------------------------------------------
    571.   # * New Method
    572.   # ** Enemy [Cancel] (after picking an item to throw)
    573.   #--------------------------------------------------------------------------
    574.   def on_enemy_throw_cancel
    575.     @enemy_window_throw.hide
    576.     BattleManager.actor.reset_thrown_item
    577.     case @actor_command_window.current_symbol
    578.     when :throw
    579.       @throwitem_window.show.activate
    580.     end
    581.   end
    582.   #--------------------------------------------------------------------------
    583.   # * Existing Method
    584.   # ** Actor [OK] (aliased)
    585.   #--------------------------------------------------------------------------
    586.   alias thesarah_throwscript_scenebattle_onactorok        on_actor_ok
    587.   def on_actor_ok
    588.     thesarah_throwscript_scenebattle_onactorok
    589.     @throwitem_window.hide
    590.   end
    591.   #--------------------------------------------------------------------------
    592.   # * Existing Method
    593.   # ** Actor [Cancel] (aliased)
    594.   #--------------------------------------------------------------------------
    595.   alias thesarah_throwscript_scenebattle_onactorcancel    on_actor_cancel
    596.   def on_actor_cancel
    597.     thesarah_throwscript_scenebattle_onactorcancel
    598.       case @actor_command_window.current_symbol
    599.       when :throwitem              
    600.         @throwitem_window.show.activate
    601.       end
    602.   end
    603. end # End of Scene_Battle class
    604. #------------------------------------------------------------------------------#
    605.                               # End of Script #
    606. #------------------------------------------------------------------------------#
    607. #------------------------------------------------------------------------------#
    608. #------------------------------------------------------------------------------#
    609. #=end
    复制代码



    Screenshots
    .​

    1)

    2)


    3)

    4)


    5)




    FAQ

    .
    Q: Can you add more notetag damage options?

    A: Yes I can! Simply ask on this forum thread for what you'd like and I'll do what I can when I have the time (which honestly shouldn't be too long a wait lol).


    Credit and Thanks
    .
    The_Sarah (aka me) for being awesome and writing this script

    .
    Also:​


    * TheoAllen (RPG Maker Forum user) for initially helping me with figuring out the make_damage_value method.

    * Kyonides (RPG Maker Forum user) for helping with Module Instance Variables and Regex.

    * A-Moonless-Night (RPG Maker Forum user) for helping me with Aliasing and to finally understand how to grab specific parts within a Regex string.

    * LockeZ Ninja Throw (Script) for helping me figure out how to decrease items when thrown.

    * Any future refractors or nice people who give me tips on future versions of the script

    * And all of you who download the script and use it! Because sharing is fun



    Author's Notes
    .
    Future versions will come out on the same page as this one.
    Planned additions to the script include ally-targeting and adding in a random chance of picking up items you've thrown at the end of each battle.
    Any requests for extra Note Tag options will also be realised in future versions.


    Terms of Use
    .
    (1) When sharing this script online, please link to this original Forum Thread page.​

    ..
    (2) If you share a game with this script in it (freely or commercially), you MUST credit me in the game.
    i ) Ideally like this: "Throw Script by The_Sarah"
    ii ) If you edited it then like this: "Original Throw Script by The_Sarah"​

    ..
    (3) Other than that, this script is free to download and use or edit in any game or project (free or commercial).


    Love and Peace everyone!
    Love AND Peace!​




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

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 10:25 , Processed in 0.136470 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表