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

[转载发布] FG7 - Easy Weapon Upgrade

[复制链接]
累计送礼:
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 21:00:43 | 显示全部楼层 |阅读模式
    Easy Weapon Upgrade
    By: FamilyGamer7

    Introduction
                            The easiest way to implement an Weapon Upgrade System while providing many features for flexibility and customization.               
    Click to expand...


    Features
                            Creates a working weapon upgrade system scene without having to define an actual weapon level through other forms of scripting implementations. This script gives the ability to customize almost everything in the scene and the purpose is to be super user friendly and customize to your liking (for your game). *To script call the WPN Upgrade scene: SceneManager.call(Scene_WeaponUpgrade)
    Click to expand...


    Screenshots









    Click to expand...



    Demo
                            Provided as an "attachment" for reference purposes (The setup).               
    Click to expand...


    Script
    Spoiler: FG7 - Easy Weapon Upgrade
                    Ruby:       
    1. #==============================================================================
    2. # Title: Easy Weapon Upgrade
    3. # Author: FamilyGamer7 (FG7)
    4. # Version: 1.0
    5. # Engine: RPG Maker VX Ace
    6. #==============================================================================
    7. # ** Change Log |
    8. # ---------------
    9. # 1.0 => Created Script
    10. #==============================================================================
    11. # ** Description |
    12. # ----------------
    13. # The easiest way to implement an Weapon Upgrade System while providing many
    14. # features for flexbility and customization.
    15. #==============================================================================
    16. # ** Terms of Use |
    17. # -----------------
    18. # * Free to use in non-commercial projects and commercial projects
    19. # * Feel free to modify and improve the script. Credit is still required.
    20. # * Credit FamilyGamer7
    21. #==============================================================================
    22. # ** Setup - Required |
    23. # --------------------
    24. # This script works by simply appending a starting value of "1" on the end of
    25. # the weapon name. This makes the script simple without having to define a
    26. # "level" for the weapon as this value acts as a level indicator.
    27. #
    28. # For each actor weapon, you will need need to append the correct setup for the
    29. # script to properly work. If the weapon name is.. Hand Ax, see examples below.
    30. #
    31. # - Acceptable actor weapon name setup in the game database
    32. # EX: Hand Ax 1
    33. # EX: Hand Ax Lv. 1
    34. # Ex: Hand Ax Lv.1
    35. # EX: Hand Ax Lvl. 1
    36. # Ex: Hand Ax Lvl.1
    37. #
    38. # The script will automatically replace the weapon number value that is
    39. # appended on the weapon name and increase by a value of 1.
    40. #
    41. # *** PLEASE ENSURE THE WEAPON PRICE IS SET TO "0" IN THE GAME DATABASE ***
    42. # (You can set a price on the WPN, but incremental upgrade will not work as intended)
    43. #
    44. # To script call the WPN Upgrade scene: SceneManager.call(Scene_WeaponUpgrade)
    45. #
    46. # * All fine tuning will need to be done in the Module section below.
    47. #==============================================================================
    48. # ** WARNING! |
    49. # ------------
    50. # This script leverages the game database "price" on the actor weapon to help
    51. # perform the weapon upgrade. It is NOT intended to be used in a game where
    52. # you buy and sell weapons as this will affect the script in a negative way.
    53. #==============================================================================
    54. # ** Note(s) |
    55. # -----------
    56. # Even though this script was designed for actors to have a weapon equipped at
    57. # all times, logic as been added to check if the actor has a weapon equipped
    58. # or not to prevent errors being thrown. Enjoy!
    59. #==============================================================================
    60. #==============================================================================
    61. # ** Module: FG7::Easy_Weapon_Upgrade
    62. #------------------------------------------------------------------------------
    63. #  This modules creates a static variable to be used within the script.
    64. #==============================================================================
    65. module FG7
    66.   module Easy_Weapon_Upgrade
    67.   
    68. #==============================================================================
    69. # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
    70. #==============================================================================
    71.     #  --------------------------------
    72.     # | Game Variable(s) Configuration |
    73.     #  --------------------------------
    74.     # |       !!!! REQUIRED !!!!       |
    75.     #  --------------------------------
    76.     # Sets the game variable value for the cost to upgrade
    77.     # (Choose any unused $game_variable to run this script)
    78.     Game_Variable = 10
    79.     # Sets the game variable value for the WPN level #
    80.     # (Choose any unused $game_variable to run this script)
    81.     Game_Variable2 = 11
    82.     # Sets/flips the game switch if no WPN is equipped
    83.     # (Choose any unused $game_switch to run this script)
    84.     Game_Switch = 12
    85.     #  ------------------------------
    86.     # | Weapon Upgrade Configuration |
    87.     #  ------------------------------
    88.     # Sets the incremental value once you start upgrading the WPN
    89.     # (This value is added each time you upgrade)
    90.     WPN_Incremental_Value = 1200
    91.     # Sets the +attack paramater value when upgrading WPN level ech time
    92.     WPN_Attack_Value = 5
    93.     # Sets the max level every actor can reach when upgrading the WPN
    94.     # (There is technically no limit to the max upgrade level for Weapons)
    95.     WPN_Level_Max = 15
    96.     #  --------------------------
    97.     # | Additional Configuration |
    98.     #  --------------------------
    99.     # Sets the name for the Level parameter on the WPN
    100.     WPN_Level_Text = "WLVL"
    101.     # Sets the name for the weapon attack paramater on the WPN
    102.     WPN_Level_Attack_Text = "WATK"
    103.     # Sets the text when you do not have enough currency to upgrade actor WPN
    104.     Not_Enough_Currency = "Not Enough Currency!"
    105.     # Sets the text indicating before the currency value for the WPN upgrade
    106.     WPN_Upgrade_Text = "Upgrade Cost:"
    107.     # Sets the text when you have reach the Max WPN level upgrade
    108.     WPN_Maxed_Out_Text = "Currently Maxed Out!"
    109.     # Sets the text when you have reach the Max WPN level upgrade
    110.     WPN_Not_Equipped = " No Weapon Equipped!"
    111.                   
    112.     # Sets whether to show the actor face on the weapon upgrade window
    113.     Show_Actor_Face = true
    114.     #  --------------------------------------
    115.     # | WPN - Window Positioning Configuration |
    116.     #  --------------------------------------
    117.     # Sets the "X" coordinate of the windows
    118.     X_Horizontal = 203
    119.     # Sets the "Y" coordinate of the windows
    120.     Y_Vertical = 139
    121.     #  ------------------------------
    122.     # | Title - Window Configuration |
    123.     #  ------------------------------------------
    124.     # |  !!!! ONLY WORKS IF SET TO "TRUE" !!!!   |
    125.     #  ------------------------------------------
    126.     # Sets the title window on the weapon upgrade scene
    127.     Show_Title_Window = true
    128.     # Sets the text on the title window on the weapon upgrade scene
    129.     Show_Title_Window_Text = "Blacksmith"
    130.     # Sets the "X" coordinate of the windows
    131.     Title_X_Horizontal = 10
    132.     # Sets the "Y" coordinate of the windows
    133.     Title_Y_Vertical = 12
    134.     # Sets the "Width" of the title window
    135.     Title_Width = 137
    136.     # Sets the "Height" of the title window
    137.     Title_Height = 50
    138.   
    139. #==============================================================================
    140. # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
    141. #==============================================================================
    142.   end
    143. end
    144. #==============================================================================
    145. # ** Window_Gold
    146. #------------------------------------------------------------------------------
    147. #  This window displays the party's gold.
    148. #==============================================================================
    149. class Window_Gold < Window_Base
    150.   #--------------------------------------------------------------------------
    151.   # * Get Window Width
    152.   #--------------------------------------------------------------------------
    153.   alias :fg7_easy_weapon_upgrade_window_width :window_width
    154.   def window_width
    155.     if SceneManager.scene_is?(Scene_WeaponUpgrade)
    156.       return 126
    157.     end
    158.     fg7_easy_weapon_upgrade_window_width
    159.   end
    160.   #--------------------------------------------------------------------------
    161.   # * Refresh
    162.   #--------------------------------------------------------------------------
    163.   alias :fg7_easy_weapon_upgrade_refresh :refresh
    164.   def refresh
    165.     fg7_easy_weapon_upgrade_refresh
    166.     if SceneManager.scene_is?(Scene_WeaponUpgrade)
    167.       contents.clear
    168.       draw_currency_value(value, currency_unit, 1, 0, contents.width - 8)
    169.     end
    170.   end
    171. end
    172. #==============================================================================
    173. # ** Window_WeaponStatus
    174. #------------------------------------------------------------------------------
    175. #  This window displays all the information on the actor for weapon upgrading.
    176. #==============================================================================
    177. class Window_WeaponStatus < Window_Selectable
    178.   #--------------------------------------------------------------------------
    179.   # * Object Initialization
    180.   #--------------------------------------------------------------------------
    181.   def initialize(actor)
    182.     super(0, 0, Graphics.width, Graphics.height)
    183.     self.opacity = 0
    184.     @actor = actor
    185.     refresh
    186.   end
    187.   #--------------------------------------------------------------------------
    188.   # * Set Actor
    189.   #--------------------------------------------------------------------------
    190.   def actor=(actor)
    191.     return if @actor == actor
    192.     @actor = actor
    193.     refresh
    194.   end
    195.   #--------------------------------------------------------------------------
    196.   # * Refresh
    197.   #--------------------------------------------------------------------------
    198.   def refresh
    199.     contents.clear
    200.     # Draws actor face
    201.     draw_actor_face(@actor, 138, 25) if FG7::Easy_Weapon_Upgrade::Show_Actor_Face == true
    202.     # Draws actor name
    203.     draw_actor_name(@actor, 12, 110)
    204.     # Draws pre-defined text for the scene
    205.     change_color(text_color(4))
    206.     draw_text(12, 122, 100, 50, FG7::Easy_Weapon_Upgrade::WPN_Level_Text)
    207.     draw_text(130, 122, 100, 50, FG7::Easy_Weapon_Upgrade::WPN_Level_Attack_Text)
    208.     # Creates static variables for "draw_text" of the upgrade cost
    209.     cost_x = -65; cost_y = 195
    210.     # Checks if an actor weapon is equipped (Flip $game_switch if not)
    211.     if @actor.weapons[0] == nil
    212.       $game_variables[FG7::Easy_Weapon_Upgrade::Game_Switch] = false
    213.       change_color(text_color(0))
    214.       draw_text(12, 145, 800, 50, "----------")
    215.       draw_text(-64, 122, 300, 50, "--", 2)
    216.       draw_text(-189, 122, 300, 50, "--", 2)
    217.       draw_text(cost_x - 13, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::WPN_Not_Equipped, 2)
    218.     # Since actor weapon is equipped - show all information for upgrading
    219.     else
    220.       $game_variables[FG7::Easy_Weapon_Upgrade::Game_Switch] = true
    221.       # Actor Weapon - Name (Removes all numbers from name and Lv.)
    222.       change_color(text_color(0))
    223.       draw_text(12, 145, 800, 50, @actor.weapons[0].name.tr("0-9", "").tr("Lv.", "").tr("Lvl.", "").strip)
    224.       # Actor Weapon - Level (Removes all non-digits from name)
    225.       change_color(text_color(0))
    226.       draw_text(-189, 122, 300, 50, @actor.weapons[0].name.tr("^0-9", ""), 2)
    227.       # Actor Weapon Attack stat
    228.       draw_text(-64, 122, 300, 50, @actor.weapons[0].params[2], 2)
    229.       change_color(text_color(14))
    230.       # Draws WPN database price (that is +value on the WPN upgrade)
    231.       change_color(text_color(0))
    232.       if $game_party.gold < @actor.weapons[0].price + FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value
    233.         draw_text(cost_x - 11, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::Not_Enough_Currency, 2)
    234.       elsif @actor.weapons[0].name.gsub(/[^0-9]/, '') == "1"
    235.         draw_text(cost_x - 91, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::WPN_Upgrade_Text, 2)
    236.         draw_text(cost_x, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value.to_s + Vocab::currency_unit, 2)
    237.       elsif @actor.weapons[0].name.gsub(/[^0-9]/, '').to_i == FG7::Easy_Weapon_Upgrade::WPN_Level_Max.to_i
    238.         draw_text(cost_x - 13, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::WPN_Maxed_Out_Text , 2)
    239.       else
    240.         draw_text(cost_x - 91, cost_y, 300, 50, FG7::Easy_Weapon_Upgrade::WPN_Upgrade_Text, 2)
    241.         draw_text(cost_x, cost_y, 300, 50, (@actor.weapons[0].price + FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value).to_s + Vocab::currency_unit, 2)
    242.       end
    243.       # Sets the actor WPN level into a variable (To disable upgrade button)
    244.       $game_variables[FG7::Easy_Weapon_Upgrade::Game_Variable2] = @actor.weapons[0].name.gsub(/[^0-9]/, '')
    245.       # Sets the actor WPN price into a variable (To disable upgrade button)
    246.       $game_variables[FG7::Easy_Weapon_Upgrade::Game_Variable] = @actor.weapons[0].price + FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value
    247.     end
    248.   end
    249. end
    250. #==============================================================================
    251. # ** Window_WeaponCommand
    252. #------------------------------------------------------------------------------
    253. #  This window is the weapon upgrade command for the scene.
    254. #==============================================================================
    255. class Window_WeaponCommand < Window_Command
    256.   #--------------------------------------------------------------------------
    257.   # * Object Initialization
    258.   #--------------------------------------------------------------------------
    259.   def initialize
    260.     super(0, 0)
    261.   end
    262.   #--------------------------------------------------------------------------
    263.   # * Get Digit Count
    264.   #--------------------------------------------------------------------------
    265.   def col_max
    266.     return 1
    267.   end
    268.   #--------------------------------------------------------------------------
    269.   # * Create Command List
    270.   #--------------------------------------------------------------------------
    271.   def make_command_list
    272.     add_command("Upgrade", :upgrade, no_gold_or_wpn_max_level_or_no_wpn_equipped)
    273.     add_command("Change", :change, no_extra_party_members)
    274.     add_command("Cancel", :cancel)
    275.   end
    276.   #--------------------------------------------------------------------------
    277.   # * Disabled - No Gold or WPN mac level
    278.   #--------------------------------------------------------------------------
    279.   def no_gold_or_wpn_max_level_or_no_wpn_equipped
    280.     return true if $game_variables[FG7::Easy_Weapon_Upgrade::Game_Variable2].to_i != FG7::Easy_Weapon_Upgrade::WPN_Level_Max.to_i && $game_party.gold > $game_variables[FG7::Easy_Weapon_Upgrade::Game_Variable].to_i && $game_variables[FG7::Easy_Weapon_Upgrade::Game_Switch] == true
    281.   end
    282.   #--------------------------------------------------------------------------
    283.   # * Disabled - No Additional/Extra Party Members
    284.   #--------------------------------------------------------------------------
    285.   def no_extra_party_members
    286.     return true if $game_party.members.size > 1
    287.   end
    288. end
    289. #==============================================================================
    290. # ** Window_WeaponUpgradeConfirm
    291. #------------------------------------------------------------------------------
    292. #  This window is a confirm window when upgrading your actor weapon level.
    293. #==============================================================================
    294. class Window_WeaponUpgradeConfirm < Window_Command
    295.   #--------------------------------------------------------------------------
    296.   # * Added Method: Object Initialization
    297.   #--------------------------------------------------------------------------
    298.   def initialize
    299.     super(0, 0)
    300.     self.opacity = 0
    301.     self.openness = 255
    302.   end
    303.   #--------------------------------------------------------------------------
    304.   # * Added Method: Get Digit Count
    305.   #--------------------------------------------------------------------------
    306.   def col_max
    307.     return 1
    308.   end
    309.   #--------------------------------------------------------------------------
    310.   # * Added Method: Create Command List
    311.   #--------------------------------------------------------------------------
    312.   def make_command_list
    313.     add_command("Yes", :yes)
    314.     add_command("No", :no)
    315.   end
    316. end
    317. #==============================================================================
    318. # ** Window_UpgradeText
    319. #------------------------------------------------------------------------------
    320. #  Window class created for the single custom single window usage.
    321. #==============================================================================
    322. class Window_UpgradeText < Window_Base
    323.   #--------------------------------------------------------------------------
    324.   # * Defines the Window used - Used for upgrade & title text
    325.   #--------------------------------------------------------------------------
    326.   def initialize(x, y, width, height, title)
    327.   super(x, y, width, height)
    328.     draw_text(4, 0, contents.width + 30, line_height, title)
    329.   end
    330. end
    331. #==============================================================================
    332. # ** Scene_MenuBase
    333. #------------------------------------------------------------------------------
    334. #  This class performs basic processing related to the menu screen.
    335. #==============================================================================
    336. class Scene_MenuBase < Scene_Base
    337.   #--------------------------------------------------------------------------
    338.   # * Creates Single Text Window - Used for upgrade text background window
    339.   #--------------------------------------------------------------------------
    340.   def create_upgrade_text_window(x, y, width, height, title)
    341.     @upgrade_text_window = Window_UpgradeText.new(x, y, width, height, title)
    342.   end
    343.   #--------------------------------------------------------------------------
    344.   # * Creates Single Text Window - Used for upgrade title window
    345.   #--------------------------------------------------------------------------
    346.   def create_upgrade_title_window(x, y, width, height, title)
    347.     @upgrade_title_window = Window_UpgradeText.new(x, y, width, height, title)
    348.   end
    349. end
    350. #==============================================================================
    351. # ** Scene_WeaponUpgrade
    352. #------------------------------------------------------------------------------
    353. #  This class scene performs the upgrading of the weapon level.
    354. #==============================================================================
    355. class Scene_WeaponUpgrade < Scene_MenuBase
    356.   #--------------------------------------------------------------------------
    357.   # * Start Processing
    358.   #--------------------------------------------------------------------------
    359.   def start
    360.     super
    361.     create_upgrade_cost_window
    362.     create_gold_window
    363.     create_weapon_status_bg_window
    364.     create_weapon_status_window
    365.     create_weapon_status_command_window
    366.     create_upgrade_title_window(FG7::Easy_Weapon_Upgrade::Title_X_Horizontal, FG7::Easy_Weapon_Upgrade::Title_Y_Vertical, FG7::Easy_Weapon_Upgrade::Title_Width, FG7::Easy_Weapon_Upgrade::Title_Height, FG7::Easy_Weapon_Upgrade::Show_Title_Window_Text) if FG7::Easy_Weapon_Upgrade::Show_Title_Window == true
    367.     create_upgrade_text_window(9999, FG7::Easy_Weapon_Upgrade::Y_Vertical, 126, 96, "Upgrade?")
    368.     create_weapon_upgrade_confirm_window
    369.   end
    370.   #--------------------------------------------------------------------------
    371.   # * Create Cost For Weapon Upgrade Window
    372.   #--------------------------------------------------------------------------
    373.   def create_upgrade_cost_window
    374.     x = FG7::Easy_Weapon_Upgrade::X_Horizontal
    375.     y = FG7::Easy_Weapon_Upgrade::Y_Vertical + 96
    376.     width = 266
    377.     height = 48
    378.     @upgrade_cost_window = Window_Base.new(x, y, width, height)
    379.     @upgrade_cost_window.show
    380.   end
    381.   #--------------------------------------------------------------------------
    382.   # * Create Weapon Status Window
    383.   #--------------------------------------------------------------------------
    384.   def create_weapon_status_window
    385.     @weapon_status_window = Window_WeaponStatus.new(@actor)
    386.     @weapon_status_window.x = FG7::Easy_Weapon_Upgrade::X_Horizontal - 1
    387.     @weapon_status_window.y = FG7::Easy_Weapon_Upgrade::Y_Vertical - 111
    388.     @weapon_status_window.width = 800
    389.     @weapon_status_window.height = 430
    390.   end
    391.   #--------------------------------------------------------------------------
    392.   # * Create Weapon Status Background Window
    393.   #--------------------------------------------------------------------------
    394.   def create_weapon_status_bg_window
    395.     x = FG7::Easy_Weapon_Upgrade::X_Horizontal
    396.     y = FG7::Easy_Weapon_Upgrade::Y_Vertical
    397.     width = 266
    398.     height = 96
    399.     @status_weapon_actor_bg_window = Window_Base.new(x, y, width, height)
    400.     @status_weapon_actor_bg_window.show
    401.   end
    402.   #--------------------------------------------------------------------------
    403.   # * Create Command Window
    404.   #--------------------------------------------------------------------------
    405.   def create_weapon_status_command_window
    406.     @weapon_status_command_window = Window_WeaponCommand.new
    407.     @weapon_status_command_window.x = FG7::Easy_Weapon_Upgrade::X_Horizontal - 126
    408.     @weapon_status_command_window.y = FG7::Easy_Weapon_Upgrade::Y_Vertical
    409.     @weapon_status_command_window.width = 126
    410.     @weapon_status_command_window.height = 96
    411.     @weapon_status_command_window.activate
    412.     @weapon_status_command_window.set_handler(:upgrade, method(:upgrade_weapon))
    413.     @weapon_status_command_window.set_handler(:change, method(:next_actor))
    414.     @weapon_status_command_window.set_handler(:pagedown, method(:next_actor))
    415.     @weapon_status_command_window.set_handler(:pageup, method(:prev_actor))
    416.     @weapon_status_command_window.set_handler(:cancel,   method(:return_scene))
    417.     @weapon_status_command_window.refresh
    418.   end
    419.   #--------------------------------------------------------------------------
    420.   # * Create Weapon Upgrade Confirm Window
    421.   #--------------------------------------------------------------------------
    422.   def create_weapon_upgrade_confirm_window
    423.     @weapon_upgrade_confirm_window = Window_WeaponUpgradeConfirm.new
    424.     @weapon_upgrade_confirm_window.x = FG7::Easy_Weapon_Upgrade::X_Horizontal - 126
    425.     @weapon_upgrade_confirm_window.y = FG7::Easy_Weapon_Upgrade::Y_Vertical + 24
    426.     @weapon_upgrade_confirm_window.width = 126
    427.     @weapon_upgrade_confirm_window.height = 84
    428.     @weapon_upgrade_confirm_window.hide.deactivate
    429.     @weapon_upgrade_confirm_window.set_handler(:yes,    method(:upgrade_weapon_confirm))
    430.     @weapon_upgrade_confirm_window.set_handler(:no,     method(:upgrade_weapon_confirm_cancel))
    431.     @weapon_upgrade_confirm_window.set_handler(:cancel, method(:upgrade_weapon_confirm_cancel))
    432.     @weapon_upgrade_confirm_window.refresh
    433.   end
    434.   #--------------------------------------------------------------------------
    435.   # * Added Method: Create Gold Window
    436.   #--------------------------------------------------------------------------
    437.   def create_gold_window
    438.     @gold_window = Window_Gold.new
    439.     @gold_window.x = FG7::Easy_Weapon_Upgrade::X_Horizontal - 126
    440.     @gold_window.y = FG7::Easy_Weapon_Upgrade::Y_Vertical + 96
    441.     @gold_window.width = 126
    442.   end
    443.   #--------------------------------------------------------------------------
    444.   # * Upgrade Weapon
    445.   #--------------------------------------------------------------------------
    446.   def upgrade_weapon
    447.     @weapon_status_command_window.hide
    448.     @upgrade_text_window.x = FG7::Easy_Weapon_Upgrade::X_Horizontal - 126
    449.     @weapon_upgrade_confirm_window.show.activate.select(0)
    450.   end
    451.   #--------------------------------------------------------------------------
    452.   # * Upgrade Weapon - Confirm
    453.   #--------------------------------------------------------------------------
    454.   def upgrade_weapon_confirm
    455.     # Grabs the current weapon level number
    456.     @Current_WPN_Level = @actor.weapons[0].name.gsub(/[^0-9]/, '')
    457.     # Adds the current level weapon number and counts +1 on it
    458.     @New_WPN_Level = @Current_WPN_Level.to_i + 1
    459.     # Strips out the number from the actor weapon name
    460.     @actor.weapons[0].name = @actor.weapons[0].name.tr("0-9", "")
    461.     # Renames the actor weapon to resemble a new level from upgrading
    462.     @actor.weapons[0].name = @actor.weapons[0].name + @New_WPN_Level.to_s
    463.     # Added the paramater back together with a +value
    464.     @actor.weapons[0].params[2] = @actor.weapons[0].params[2] + FG7::Easy_Weapon_Upgrade::WPN_Attack_Value
    465.     # Checks for actor weapon level and adds incremental value on each upgrade
    466.     if @actor.weapons[0].name.gsub(/[^0-9]/, '') == "1"
    467.       @actor.weapons[0].price = FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value
    468.     else
    469.       @actor.weapons[0].price = @actor.weapons[0].price + FG7::Easy_Weapon_Upgrade::WPN_Incremental_Value
    470.     end
    471.     # Lose gold for upgrading weapon
    472.     $game_party.lose_gold(@actor.weapons[0].price)
    473.     # Creates hammer sharpening sound that the weapon has been upgraded
    474.     20.times { Graphics.update }
    475.     RPG::SE.new("Hammer").play
    476.     20.times { Graphics.update }
    477.     RPG::SE.new("Hammer").play
    478.     20.times { Graphics.update }
    479.     RPG::SE.new("Decision2").play
    480.     # Refresh and update scenes
    481.     @weapon_upgrade_confirm_window.hide.deactivate
    482.     @upgrade_text_window.x = 9999
    483.     @weapon_status_window.refresh
    484.     @gold_window.refresh
    485.     @weapon_status_command_window.refresh
    486.     @weapon_status_command_window.show.activate
    487.     @weapon_status_command_window.select(0)
    488.   end
    489.   #--------------------------------------------------------------------------
    490.   # * Upgrade Weapon - Confirm Cancel
    491.   #--------------------------------------------------------------------------
    492.   def upgrade_weapon_confirm_cancel
    493.     @weapon_upgrade_confirm_window.hide.deactivate
    494.     @upgrade_text_window.x = 9999
    495.     @weapon_status_command_window.show.activate
    496.     @weapon_status_command_window.select(0)
    497.   end
    498.   #--------------------------------------------------------------------------
    499.   # * Change Actors
    500.   #--------------------------------------------------------------------------
    501.   def on_actor_change
    502.     @weapon_status_window.actor = @actor
    503.     @weapon_status_window.refresh
    504.     @weapon_status_command_window.refresh
    505.     @weapon_status_command_window.activate
    506.   end
    507. end
    复制代码


    How to Use
                            Add this script in the script editor under in the "Materials" section and above "Main Process".
    The instructions and setup for the script are held within the script header itself. No need to repeat here.               
    Click to expand...


    Terms of Use
                            - Free to use in non-commercial projects and commercial projects
    - Feel free to modify and improve the script. Credit is still required.
    - Credit FamilyGamer7               
    Click to expand...




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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 08:31 , Processed in 0.122145 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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