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

[转载发布] FG7 - Simple Magic System

[复制链接]
累计送礼:
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 19:44:43 | 显示全部楼层 |阅读模式
    Simple Magic System
    By: FamilyGamer7

    Introduction
                            Easy way to build onto the existing magic system VX Ace engine uses. This script introduces the concept of magic items that are consumable which add skilltype(s) onto the actor and the ability to remove the skilltype(s). This is all done through the Magic Item Shop window (Add/Remove). This is all controlled by "states".               
    Click to expand...


    Features
                            The ability to limit the Skilltype magic amount on all actors and ability to access a magic item shop to add or remove the assigned magic on an actor. Many more features inside script header + explanation....               
    Click to expand...


    Screenshots

















    Click to expand...


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


    Script
    Spoiler: FG7 - Simple Magic System
                    Ruby:       
    1. #==============================================================================
    2. # Title: Simple Magic System
    3. # Author: FamilyGamer7 (FG7)
    4. # Version: 1.7
    5. # Engine: RPG Maker VX Ace
    6. #==============================================================================
    7. # ** Change Log |
    8. # ---------------
    9. # 1.0 => Created script
    10. # 1.1 => Added Skilltype limit for all actors
    11. # 1.2 => Added in cost to remove skilltype on actor (optional)
    12. # 1.3 => Added in cost when adding magic item on actor (optional)
    13. # 1.4 => Added in shop-like effect (Disables magic consumption & skill removal)
    14. # 1.5 => Rewrote script geared towards shop-like effect for efficiency
    15. #        (You can no longer add or remove magic outside of shop script call)
    16. # 1.6 => Complete overhaul to script that builds on v1.5 with a true shop feel
    17. # 1.7 => Entire script has been aliased for compatibility purposes
    18. #==============================================================================
    19. # ** Description |
    20. # ----------------
    21. # Easy way to build onto the existing magic system VX Ace engine uses. This
    22. # script introduces the concept of magic items that are consumable which add
    23. # skilltype(s) onto the actor and the ability to remove the skilltype(s). This
    24. # is all done through the Magic Item Shop window (Add/Remove).
    25. #
    26. # * This is all controlled by "states".
    27. #==============================================================================
    28. # ** Terms of Use |
    29. # -----------------
    30. # * Free to use in non-commercial projects and commercial projects
    31. # * Feel free to modify and improve the script. Credit is still required.
    32. # * Credit FamilyGamer7
    33. #==============================================================================
    34. # ** Usage |
    35. # ----------
    36. # * NOT Plug & Play (See "Setup" section to properly use this script)
    37. #==============================================================================
    38. # ** Setup |
    39. # ---------
    40. # - See Demo for a better representation/understanding on how the script works.
    41. #
    42. # This script does require a small setup up front. The most important thing to
    43. # note is the skilltype/state/item id number will all need to be the same for
    44. # this script to function properly (Ideally keep the naming consistent as well).
    45. #
    46. #   - Ex: Fire / skilltype id = 50
    47. #   - Ex: Fire / item id = 50
    48. #   - Ex: SMS: Fire / state id = 50
    49. #     (Note: The "state" name needs to have "SMS:" before the state name)
    50. #
    51. # * Note: Since all of the id's are the same, this allows the script to do all
    52. #         of the heavy lifting when adding and removing the skilltype per actor.
    53. #
    54. # -----------------------------------------------------------------------------
    55. #
    56. # For the "Magic Item" setup:
    57. #
    58. # - A magic item is simply just a normal item that is "consumable" and with an
    59. #   added state on it. Using the example of a [SMS: Fire] state that has been
    60. #   already made, the illustration below is how yours should look on the effects
    61. #   box.
    62. #
    63. # Effects
    64. #  -----------------------------------
    65. #  | Kind        | Content           |
    66. #  -----------------------------------
    67. #  | Add State     [SMS: Fire] 100%  |
    68. #  -----------------------------------
    69. #  |                                 |
    70. #  -----------------------------------
    71. #  |                                 |
    72. #  -----------------------------------
    73. #
    74. #   General Settings:
    75. #   - Item Type: Normal
    76. #   - Consume: Yes
    77. #   - Scope: One Ally
    78. #   - Occasion: Only from the Menu
    79. #
    80. # -----------------------------------------------------------------------------
    81. #
    82. # For the magic "State" setup:
    83. #
    84. # - A magic "state" is essentially a duplicate of the skilltype that you add
    85. #   the skilltype through the features box area. Using the example of a [Fire]
    86. #   skilltype that has been already made, the illustration below is how yours
    87. #   should look look on the features box.
    88. #
    89. #   * Note: As stated above, the "state" name needs to have "SMS:" before the
    90. #     state name. See example below how the state name should look.
    91. #     - Ex: SMS: Fire
    92. #
    93. # Features
    94. #  --------------------------------
    95. #  | Kind             | Content   |
    96. #  --------------------------------
    97. #  | Add Skill Type     [Fire]    |
    98. #  --------------------------------
    99. #  |                              |
    100. #  --------------------------------
    101. #  |                              |
    102. #  --------------------------------
    103. #
    104. # For the state icons, you can choose to have icons that show by the actor or
    105. # leave it blank. The choose is yours depending upon your game. If you choose to
    106. # allow state icons, then be sure to set priority to "100" on state for visual
    107. # purposes. This script is designed with the state icons in mind.
    108. #
    109. # * The rest of the setup is your "normal" attach skill(s) to your newly created
    110. #   skilltype and ensure the actor can learn those skills at a certain level.
    111. #
    112. # -----------------------------------------------------------------------------
    113. #
    114. # When you want to add or remove a magic item from an actor, you will need to
    115. # do a script call to enter a shop-like effect mode. This can easily be done by
    116. # following below.
    117. #
    118. # Script calls:
    119. #
    120. # - To add/embed new magic items on actor:
    121. #     $game_system.call_simple_magic_system_embed
    122. #
    123. # - To remove magic items on actor:
    124. #     $game_system.call_simple_magic_system_remove
    125. #
    126. #==============================================================================
    127. # ** Script Intention |
    128. # --------------------
    129. # This script tries to emulate a magic system where you place a magic item into
    130. # a character slot - without the slot factor. Since we are just building on top
    131. # of the existing default magic system, a slot concept does not exist.
    132. #
    133. # This script also takes inspiration from Suikoden 2's magic rune system.
    134. #==============================================================================
    135. #==============================================================================
    136. # ** Module: FG7::Simple_Magic_System
    137. #------------------------------------------------------------------------------
    138. #  This modules creates a static variable to be used within the script.
    139. #==============================================================================
    140. module FG7
    141.   module Simple_Magic_System
    142. #==============================================================================
    143. # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
    144. #==============================================================================
    145.     # --------------------------------------
    146.     # REQUIRED - Game Switch Configuration |
    147.     # --------------------------------------
    148.     # Sets the value for the $game_switch used for the simple magic system
    149.     # This is to give the system a shop-like effect when using a script call
    150.     # (- REQUIRED -)
    151.     Simple_Magic_System_Shop_Effect_Switch = 40
    152.     # Sets the value for the $game_switch used for the simple magic system
    153.     # (- REQUIRED -)
    154.     Simple_Magic_System_Switch = 41
    155.    
    156.     # Sets the value for the magic item icon index that is used for the script
    157.     # (Please ensure no other item uses this item icon index number)
    158.     # (- REQUIRED -)
    159.     Magic_Item_Icon_Match = 359
    160.    
    161.     # ---------------------------------------------
    162.     # Optional - Magic Limit & Cost Configuration |
    163.     # ---------------------------------------------
    164.    
    165.     # Sets the value for the total magic items that can be applied to an actor
    166.     # (This is in the shop-like effect script call)
    167.     Skilltype_Magic_Limit = 3
    168.    
    169.     # Sets the value for how much it cost to add/remove magic item on actor
    170.     # (This is in the shop-like effect script call)
    171.     Cost_To_Add_And_Remove_Amount = 1000
    172.    
    173.     # --------------------------------------
    174.     # Optional - Text String Configuration |
    175.     # --------------------------------------
    176.    
    177.     # Sets the text string when magic item limit on actor has been reached
    178.     Magic_Limit_Reached = "Magic item limit has been reached."
    179.    
    180.     # Sets the text string when not enough currency is available for magic removal
    181.     # (This is used if Skilltype switch is set to "True")
    182.     Not_Enough_Currency = "Not enough currency to add/remove magic."
    183.    
    184.     # Sets the text string when an already existing magic item is on actor
    185.     Existing_Magic_Embedded = "Already have existing magic embedded."
    186.    
    187.     # -------------------------------------------
    188.     # Optional - Scene Title Text Configuration |
    189.     # -------------------------------------------
    190.    
    191.     # Sets the text string for the title text of the scene (For add/embed)
    192.     Magic_Item_Shop_Add_Title = "Magic Item - Add"
    193.    
    194.     # Sets the text string for the title text of the scene (For remove)
    195.     Magic_Item_Shop_Remove_Title = "Magic Item - Remove"
    196.    
    197. #==============================================================================
    198. # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
    199. #==============================================================================
    200.   end
    201. end
    202. #==============================================================================
    203. # ** Game_System
    204. #------------------------------------------------------------------------------
    205. #  This class handles system data. It saves the disable state of saving and
    206. # menus. Instances of this class are referenced by $game_system.
    207. #==============================================================================
    208. class Game_System
    209.   #--------------------------------------------------------------------------
    210.   # * New Method: Checks Magic Shop-Like Effect Switch Is "On" (True)
    211.   #--------------------------------------------------------------------------
    212.   def check_magic_shop_switch
    213.     $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Shop_Effect_Switch] == true
    214.   end
    215.   #--------------------------------------------------------------------------
    216.   # * New Method: Checks If Current Currency Is Lower Than Magic Cost Amount
    217.   #--------------------------------------------------------------------------
    218.   def check_currency_compare
    219.     $game_party.gold < FG7::Simple_Magic_System::Cost_To_Add_And_Remove_Amount
    220.   end
    221.   #--------------------------------------------------------------------------
    222.   # * New Method: simple_magic_system_embed (Calls Item scene with game switch)
    223.   #--------------------------------------------------------------------------
    224.   def call_simple_magic_system_embed
    225.     $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Shop_Effect_Switch] = true
    226.     SceneManager.call(Scene_Item)
    227.   end
    228.   #--------------------------------------------------------------------------
    229.   # * New Method: simple_magic_system_remove (Calls Skill scene with game switch)
    230.   #--------------------------------------------------------------------------
    231.   def call_simple_magic_system_remove
    232.     $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Shop_Effect_Switch] = true
    233.     SceneManager.call(Scene_Skill)
    234.   end
    235. end
    236. #==============================================================================
    237. # ** Game_Battler
    238. #------------------------------------------------------------------------------
    239. #  A battler class with methods for sprites and actions added. This class
    240. # is used as a super class of the Game_Actor class and Game_Enemy class.
    241. #==============================================================================
    242. class Game_Battler < Game_BattlerBase
    243.   #--------------------------------------------------------------------------
    244.   # * Alias Method: Remove State
    245.   #--------------------------------------------------------------------------
    246.   alias :fg7_simple_magic_system_remove_state :remove_state
    247.   def remove_state(state_id)
    248.     fg7_simple_magic_system_remove_state(state_id)
    249.     # When state (magic) is removed - add back into inventory
    250.     # (Odd issue where item 1 in the database is added - Worked around issue)
    251.     $game_party.gain_item($data_items[state_id], 1) && $game_party.gain_item($data_items[1], -1) if $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] == true
    252.   end
    253. end
    254. #==============================================================================
    255. # ** Window_Base
    256. #------------------------------------------------------------------------------
    257. #  This is a super class of all windows within the game.
    258. #==============================================================================
    259. class Window_Base < Window
    260.   #--------------------------------------------------------------------------
    261.   # * Alias Method: Draw Face Graphic
    262.   #     enabled : Enabled flag. When false, draw semi-transparently.
    263.   #--------------------------------------------------------------------------
    264.   alias :fg7_simple_magic_system_draw_face :draw_face
    265.   def draw_face(face_name, face_index, x, y, enabled = true)
    266.     # Checks if magic shop-like effect is turned on
    267.     if $game_system.check_magic_shop_switch
    268.       bitmap = Cache.face(face_name)
    269.       # Adjust face height to fit in add/remove shop scene windows
    270.       rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 60)
    271.       contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    272.       bitmap.dispose
    273.     else
    274.       fg7_simple_magic_system_draw_face(face_name, face_index, x, y, enabled)
    275.     end
    276.   end
    277.   #--------------------------------------------------------------------------
    278.   # * Alias Method: Draw Name
    279.   #--------------------------------------------------------------------------
    280.   alias :fg7_simple_magic_system_draw_actor_name :draw_actor_name
    281.   def draw_actor_name(actor, x, y, width = 112)
    282.     # Checks if magic shop-like effect is turned on
    283.     if $game_system.check_magic_shop_switch
    284.       change_color(hp_color(actor))
    285.       # Adjusted the actor name up in add/remove shop scene windows
    286.       draw_text(x, y - 8, width, line_height, actor.name)
    287.     else
    288.       fg7_simple_magic_system_draw_actor_name(actor, x, y, width)
    289.     end
    290.   end
    291.   #--------------------------------------------------------------------------
    292.   # * Alias Method: Draw Level
    293.   #--------------------------------------------------------------------------
    294.   alias :fg7_simple_magic_system_draw_actor_level :draw_actor_level
    295.   def draw_actor_level(actor, x, y)
    296.     # Checks if magic shop-like effect is turned on
    297.     if $game_system.check_magic_shop_switch
    298.       # Draws no level parameter at all
    299.     else
    300.       fg7_simple_magic_system_draw_actor_level(actor, x, y)
    301.     end
    302.   end
    303.   #--------------------------------------------------------------------------
    304.   # * Alias Method: Draw State and Buff/Debuff Icons
    305.   #--------------------------------------------------------------------------
    306.   alias :fg7_simple_magic_system_draw_actor_icons :draw_actor_icons
    307.   def draw_actor_icons(actor, x, y, width = 96)
    308.     # Checks if magic shop-like effect is turned on
    309.     if $game_system.check_magic_shop_switch
    310.       # Remove Buff/Debuff Icons from showing
    311.       icons = (actor.state_icons)[0, width / 24]
    312.       icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y - 30) }
    313.     else
    314.       fg7_simple_magic_system_draw_actor_icons(actor, x, y, width)
    315.     end
    316.   end
    317. end
    318. #==============================================================================
    319. # ** Window_SMS_Title
    320. #------------------------------------------------------------------------------
    321. #  Window to show the title of the current scene - Item or Skill.
    322. #==============================================================================
    323. class Window_SMS_Title < Window_Base
    324.   #--------------------------------------------------------------------------
    325.   # * Object Initialization
    326.   #--------------------------------------------------------------------------
    327.   def initialize(x, y, width, height)
    328.     super
    329.     self.openness = 255
    330.     refresh
    331.   end
    332.   #--------------------------------------------------------------------------
    333.   # * Refresh (With additonal Information - Title Text)
    334.   #--------------------------------------------------------------------------
    335.   def refresh
    336.     change_color(system_color)
    337.     draw_text(x - 6, y - 22, 200, 50, "Shop:")
    338.     # Checks if in Item Scene - Magic Shop
    339.     if SceneManager.scene_is?(Scene_Item)
    340.       change_color(text_color(0))
    341.       draw_text(x + 50, y - 22, 200, 50, FG7::Simple_Magic_System::Magic_Item_Shop_Add_Title)
    342.     # Checks if in Skill Scene - Magic Shop
    343.     elsif SceneManager.scene_is?(Scene_Skill)
    344.       change_color(text_color(0))
    345.       draw_text(x + 50, y - 22, 200, 50, FG7::Simple_Magic_System::Magic_Item_Shop_Remove_Title)
    346.     end
    347.   end
    348.   #--------------------------------------------------------------------------
    349.   # * Open Window
    350.   #--------------------------------------------------------------------------
    351.   def open
    352.     refresh
    353.     super
    354.   end
    355. end
    356. #==============================================================================
    357. # ** Window_Help
    358. #------------------------------------------------------------------------------
    359. #  This window shows skill and item explanations along with actor status.
    360. #==============================================================================
    361. class Window_Help < Window_Base
    362.   #--------------------------------------------------------------------------
    363.   # * Added Method: Get Window Width
    364.   #--------------------------------------------------------------------------
    365.   def contents_width
    366.     # Checks if magic shop-like effect is turned on
    367.     if $game_system.check_magic_shop_switch
    368.       Graphics.width - 50
    369.     else
    370.       Graphics.width - 35
    371.     end
    372.   end
    373. end
    374. #==============================================================================
    375. # ** Window_MenuStatus
    376. #------------------------------------------------------------------------------
    377. #  This window displays party member status on the menu screen.
    378. #==============================================================================
    379. class Window_MenuStatus < Window_Selectable
    380.   #--------------------------------------------------------------------------
    381.   # * Alias Method: Get Window Height
    382.   #--------------------------------------------------------------------------
    383.   alias :fg7_simple_magic_system_window_height :window_height
    384.   def window_height
    385.     # Checks if magic shop-like effect is turned on
    386.     if $game_system.check_magic_shop_switch
    387.       Graphics.height - 144
    388.     else
    389.       fg7_simple_magic_system_window_height
    390.     end
    391.   end
    392.   #--------------------------------------------------------------------------
    393.   # * Alias Method: Get Window Width
    394.   #--------------------------------------------------------------------------
    395.   alias :fg7_simple_magic_system_window_width :window_width
    396.   def window_width
    397.     # Checks if magic shop-like effect is turned on
    398.     if $game_system.check_magic_shop_switch
    399.       Graphics.width - 310
    400.     else
    401.       fg7_simple_magic_system_window_width
    402.     end
    403.   end
    404. end
    405. #==============================================================================
    406. # ** Window_ItemCategory
    407. #------------------------------------------------------------------------------
    408. #  This window is for selecting a category of normal items and equipment
    409. # on the item screen or shop screen.
    410. #==============================================================================
    411. class Window_ItemCategory < Window_HorzCommand
    412.   #--------------------------------------------------------------------------
    413.   # * Alias Method: Create Command List
    414.   #--------------------------------------------------------------------------
    415.   alias :fg7_simple_magic_system_make_command_list :make_command_list
    416.   def make_command_list
    417.     # Checks if magic shop-like effect is turned on
    418.     if $game_system.check_magic_shop_switch
    419.       add_command(Vocab::item,     :item)
    420.     else
    421.       fg7_simple_magic_system_make_command_list
    422.     end
    423.   end
    424. end
    425. #==============================================================================
    426. # ** Window_ItemList
    427. #------------------------------------------------------------------------------
    428. #  This window displays a list of party items on the item screen.
    429. #==============================================================================
    430. class Window_ItemList < Window_Selectable
    431.   #--------------------------------------------------------------------------
    432.   # * Alias Method: Get Digit Count
    433.   #--------------------------------------------------------------------------
    434.   alias :fg7_simple_magic_system_col_max :col_max
    435.   def col_max
    436.     # Checks if magic shop-like effect is turned on
    437.     if $game_system.check_magic_shop_switch
    438.       return 1
    439.     else
    440.       fg7_simple_magic_system_col_max
    441.     end
    442.   end
    443.   #--------------------------------------------------------------------------
    444.   # * Alias Method: Include in Item List?
    445.   #--------------------------------------------------------------------------
    446.   alias :fg7_simple_magic_system_include? :include?
    447.   def include?(item)
    448.     # Checks if magic shop-like effect is turned on
    449.     if $game_system.check_magic_shop_switch
    450.       return item.is_a?(RPG::Item) && item.icon_index == FG7::Simple_Magic_System::Magic_Item_Icon_Match && !item.key_item?
    451.     else
    452.       fg7_simple_magic_system_include?(item)
    453.     end
    454.   end
    455. end
    456. #==============================================================================
    457. # ** Window_SkillList
    458. #------------------------------------------------------------------------------
    459. #  This window is for displaying a list of available skills on the skill window.
    460. #==============================================================================
    461. class Window_SkillList < Window_Selectable
    462.   #--------------------------------------------------------------------------
    463.   # * Alias Method: Get Digit Count
    464.   #--------------------------------------------------------------------------
    465.   alias :fg7_simple_magic_system_col_max :col_max
    466.   def col_max
    467.     # Checks if magic shop-like effect is turned on
    468.     if $game_system.check_magic_shop_switch
    469.       return 1
    470.     else
    471.       fg7_simple_magic_system_col_max
    472.     end
    473.   end
    474.   #--------------------------------------------------------------------------
    475.   # * Alias Method: Get Activation State of Selection Item
    476.   #--------------------------------------------------------------------------
    477.   alias :fg7_simple_magic_system_current_item_enabled? :current_item_enabled?
    478.   def current_item_enabled?
    479.     # Checks if magic shop-like effect is turned on
    480.     if $game_system.check_magic_shop_switch && SceneManager.scene_is?(Scene_Skill)
    481.       # Ensures the skill(s) are not selectable within the magic item remove
    482.     else
    483.       fg7_simple_magic_system_current_item_enabled?
    484.     end
    485.   end
    486.   #--------------------------------------------------------------------------
    487.   # * Alias Method: Display Skill in Active State?
    488.   #--------------------------------------------------------------------------
    489.   alias :fg7_simple_magic_system_enable? :enable?
    490.   def enable?(item)
    491.     if $game_system.check_magic_shop_switch && SceneManager.scene_is?(Scene_Skill)
    492.       # Ensures the skill(s) are inactive looking within the magic item remove
    493.     else
    494.       fg7_simple_magic_system_enable?(item)
    495.     end
    496.   end
    497. end
    498. #==============================================================================
    499. # ** Window_SkillCommand
    500. #------------------------------------------------------------------------------
    501. #  This window is for selecting commands (special attacks, magic, etc.) on the
    502. # skill screen.
    503. #==============================================================================
    504. class Window_SkillCommand < Window_Command
    505.   #--------------------------------------------------------------------------
    506.   # * Alias Method: Get Window Width
    507.   #--------------------------------------------------------------------------
    508.   alias :fg7_simple_magic_system_window_width :window_width
    509.   def window_width
    510.     # Checks if magic shop-like effect is turned on
    511.     if $game_system.check_magic_shop_switch
    512.       Graphics.width - 254
    513.     else
    514.       fg7_simple_magic_system_window_width
    515.     end
    516.   end
    517.   #--------------------------------------------------------------------------
    518.   # * New Method: Grabs current skilltype id command
    519.   #--------------------------------------------------------------------------
    520.   def current_selection
    521.     select(current_ext)
    522.   end
    523. end
    524. #==============================================================================
    525. # ** Window_SkillSMSCommand
    526. #------------------------------------------------------------------------------
    527. #  This window is for selecting skilltype command on the skill screen.
    528. #==============================================================================
    529. class Window_SkillSMSCommand < Window_Command
    530.   #--------------------------------------------------------------------------
    531.   # * Object Initialization
    532.   #--------------------------------------------------------------------------
    533.   def initialize(x, y)
    534.     super(x, y)
    535.   end
    536.   #--------------------------------------------------------------------------
    537.   # * Get Window Width
    538.   #--------------------------------------------------------------------------
    539.   def window_width
    540.     return 160
    541.   end
    542.   #--------------------------------------------------------------------------
    543.   # * Get Number of Lines to Show
    544.   #--------------------------------------------------------------------------
    545.   def visible_line_number
    546.     return 4
    547.   end
    548.   #--------------------------------------------------------------------------
    549.   # * Get Item Height
    550.   #--------------------------------------------------------------------------
    551.   def item_height
    552.     32
    553.   end
    554.   #--------------------------------------------------------------------------
    555.   # * Get Digit Count
    556.   #--------------------------------------------------------------------------
    557.   def col_max
    558.     return 1
    559.   end
    560.   #--------------------------------------------------------------------------
    561.   # * Create Command List
    562.   #--------------------------------------------------------------------------
    563.   def make_command_list
    564.     add_command("View", :view)
    565.     add_command("Remove", :remove)
    566.     add_command("Cancel", :cancel)
    567.   end
    568. end
    569. #==============================================================================
    570. # ** Window_BattleStatus
    571. #------------------------------------------------------------------------------
    572. #  This window is for displaying the status of party members on the battle
    573. # screen.
    574. #==============================================================================
    575. class Window_BattleStatus < Window_Selectable
    576.   #--------------------------------------------------------------------------
    577.   # * Alias Method: Draw Basic Area
    578.   # (Techincally an alias method - but really just an override method)
    579.   #--------------------------------------------------------------------------
    580.   alias :fg7_simple_magic_system_draw_basic_area :draw_basic_area
    581.   def draw_basic_area(rect, actor)
    582.     # Checks if magic shop-like effect is turned on
    583.     if SceneManager.scene_is?(Scene_Battle)
    584.       draw_actor_name(actor, rect.x + 0, rect.y, 100)
    585.       # Adjust the state icons to display 1 more than usual
    586.       draw_actor_icons(actor, rect.x + 84, rect.y, rect.width - 64)
    587.     else
    588.       fg7_simple_magic_system_draw_basic_area
    589.     end
    590.   end
    591. end
    592. #==============================================================================
    593. # ** Scene_ItemBase
    594. #------------------------------------------------------------------------------
    595. #  This class performs common processing for the item screen and skill screen.
    596. #==============================================================================
    597. class Scene_ItemBase < Scene_MenuBase
    598.   #--------------------------------------------------------------------------
    599.   # * New Method: Checks If Current Actor Skillytpe Limit Has Been Reached
    600.   #--------------------------------------------------------------------------
    601.   def check_skilltype_limit
    602.     $game_party.members[@actor_window.select_for_item(item)].states.collect { |state| state.name }.to_s.count(':') == FG7::Simple_Magic_System::Skilltype_Magic_Limit
    603.   end
    604.   #--------------------------------------------------------------------------
    605.   # * New Method: Checks If Current Magic Item Equals Script Icon Match
    606.   #--------------------------------------------------------------------------
    607.   def check_magic_item_icon
    608.     item.icon_index == FG7::Simple_Magic_System::Magic_Item_Icon_Match
    609.   end
    610.   #--------------------------------------------------------------------------
    611.   # * Alias Method: Create Actor Window
    612.   #--------------------------------------------------------------------------
    613.   alias :fg7_simple_magic_system_create_actor_window :create_actor_window
    614.   def create_actor_window
    615.     # Checks if magic shop-like effect is turned on
    616.     if $game_system.check_magic_shop_switch && SceneManager.scene_is?(Scene_Item)
    617.       x_width = 250
    618.       @actor_window = Window_MenuActor.new
    619.       @actor_window.set_handler(:ok,     method(:on_actor_ok))
    620.       @actor_window.set_handler(:cancel, method(:on_actor_cancel))
    621.       @actor_window.x = 10
    622.       @actor_window.y = Graphics.height - x_width - 108
    623.       @actor_window.show
    624.       @actor_window.refresh
    625.     else
    626.       fg7_simple_magic_system_create_actor_window
    627.     end
    628.   end
    629.   #--------------------------------------------------------------------------
    630.   # * Alias Method: Actor [Cancel]
    631.   #--------------------------------------------------------------------------
    632.   alias :fg7_simple_magic_system_on_actor_cancel :on_actor_cancel
    633.   def on_actor_cancel
    634.     # Checks if magic shop-like effect is turned on
    635.     if $game_system.check_magic_shop_switch
    636.       @actor_window.unselect
    637.       activate_item_window
    638.       # Properly handles what the default game engine does not
    639.       # (Moves item slection up by 1 if item selection is nil)
    640.       @item_window.select(0) if item == nil
    641.     else
    642.       fg7_simple_magic_system_on_actor_cancel
    643.     end
    644.   end
    645.   #--------------------------------------------------------------------------
    646.   # * Alias Method: Confirm Item
    647.   #--------------------------------------------------------------------------
    648.   alias :fg7_simple_magic_system_determine_item :determine_item
    649.   def determine_item
    650.     # Checks if magic shop-like effect is turned on
    651.     if $game_system.check_magic_shop_switch
    652.       if item.for_friend?
    653.         @actor_window.show.activate
    654.         @actor_window.select_for_item(item)
    655.       else
    656.         use_item
    657.         activate_item_window
    658.       end
    659.     else
    660.       fg7_simple_magic_system_determine_item
    661.     end
    662.   end
    663.   #--------------------------------------------------------------------------
    664.   # * Alias Method: Actor [OK]
    665.   #--------------------------------------------------------------------------
    666.   alias :fg7_simple_magic_system_on_actor_ok :on_actor_ok
    667.   def on_actor_ok
    668.     # Checks if magic shop-like effect is turned on
    669.     if $game_system.check_magic_shop_switch
    670.       # Checks if item is not usable and matches magic item icon
    671.       if !item_usable? && check_magic_item_icon
    672.         Sound.play_buzzer
    673.         @help_window.contents.clear
    674.         @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Existing_Magic_Embedded)
    675.       # Checks is item is usable and matches magic item icon and if skilltype limit is reached
    676.       elsif item_usable? && check_magic_item_icon && check_skilltype_limit
    677.         Sound.play_buzzer
    678.         @help_window.contents.clear
    679.         @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Magic_Limit_Reached)
    680.       # Checks if item is usable and matches magic item icon and if enough currency
    681.       elsif item_usable? && check_magic_item_icon && $game_system.check_currency_compare
    682.         Sound.play_buzzer
    683.         @help_window.contents.clear
    684.         @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Not_Enough_Currency)
    685.       # If checks above are not met - use item
    686.       else
    687.         use_item
    688.         # Checks if magic item icon matches + magic shop-like effect and reduces current currency
    689.         if item.icon_index == FG7::Simple_Magic_System::Magic_Item_Icon_Match && $game_system.check_magic_shop_switch
    690.           $game_party.lose_gold(FG7::Simple_Magic_System::Cost_To_Add_And_Remove_Amount)
    691.           @gold_window.refresh
    692.           @help_window.contents.clear
    693.           @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Cost_To_Add_And_Remove_Amount.to_s + Vocab::currency_unit + " has been removed")
    694.         end
    695.       end
    696.     # Checks if magic shop-like effect is turned off
    697.     elsif !$game_system.check_magic_shop_switch && check_magic_item_icon
    698.       # Checks if magic item icon matches && if skilltype limit is not reached
    699.       if check_magic_item_icon && !check_skilltype_limit
    700.         Sound.play_buzzer
    701.       else
    702.         use_item
    703.       end
    704.     # If all conditions not met - run original condition (For normal items)
    705.     else
    706.       fg7_simple_magic_system_on_actor_ok
    707.     end
    708.     # Refreshes actor window if/when state icons are present
    709.     @actor_window.refresh
    710.   end
    711.   #--------------------------------------------------------------------------
    712.   # * New Method: Grabs current total skilltype(s) added on actor
    713.   #--------------------------------------------------------------------------
    714.   def current_selection
    715.     select(current_ext)
    716.   end
    717. end
    718. #==============================================================================
    719. # ** Scene_Item
    720. #------------------------------------------------------------------------------
    721. #  This class performs the item screen processing.
    722. #==============================================================================
    723. class Scene_Item < Scene_ItemBase
    724.   #--------------------------------------------------------------------------
    725.   # * Alias Method: Start Processing
    726.   #--------------------------------------------------------------------------
    727.   alias :fg7_simple_magic_system_start :start
    728.   def start
    729.     fg7_simple_magic_system_start
    730.     # Checks if magic shop-like effect is turned on
    731.     if $game_system.check_magic_shop_switch
    732.       create_gold_window
    733.       create_scene_title_window
    734.     end
    735.   end
    736.   #--------------------------------------------------------------------------
    737.   # * New Method: Create Scene Title Window
    738.   #--------------------------------------------------------------------------
    739.   def create_scene_title_window
    740.     @scene_title_window = Window_SMS_Title.new(10, 10, 363, 48)
    741.   end
    742.   #--------------------------------------------------------------------------
    743.   # * Alias Method: Create Category Window
    744.   #--------------------------------------------------------------------------
    745.   alias :fg7_simple_magic_system_create_category_window :create_category_window
    746.   def create_category_window
    747.     fg7_simple_magic_system_create_category_window
    748.     # Checks if magic shop-like effect is turned on
    749.     if $game_system.check_magic_shop_switch
    750.       @category_window.hide
    751.       @category_window.deactivate
    752.     end
    753.   end
    754.   #--------------------------------------------------------------------------
    755.   # * Alias Method: Create Item Window
    756.   #--------------------------------------------------------------------------
    757.   alias :fg7_simple_magic_system_create_item_window :create_item_window
    758.   def create_item_window
    759.     fg7_simple_magic_system_create_item_window
    760.     # Checks if magic shop-like effect is turned on
    761.     if $game_system.check_magic_shop_switch
    762.       x_width = 250
    763.       @item_window.x += x_width - 6
    764.       @item_window.width = Graphics.width - x_width - 4
    765.       @item_window.height = Graphics.height - x_width + 106
    766.       @item_window.y = Graphics.height - x_width - 108
    767.       @item_window.activate.select(0)
    768.       @item_window.refresh
    769.     end
    770.   end
    771.   #--------------------------------------------------------------------------
    772.   # * Alias Method: Create Help Window
    773.   #--------------------------------------------------------------------------
    774.   alias :fg7_simple_magic_system_create_help_window :create_help_window
    775.   def create_help_window
    776.     fg7_simple_magic_system_create_help_window
    777.     # Checks if magic shop-like effect is turned on
    778.     if $game_system.check_magic_shop_switch
    779.       x_width = 250
    780.       @help_window.x = 10
    781.       @help_window.y = x_width + 80
    782.       @help_window.height = Graphics.height - x_width - 90
    783.       @help_window.width = Graphics.width - 20
    784.       @help_window.refresh
    785.     end
    786.   end
    787.   #--------------------------------------------------------------------------
    788.   # * Added Method: Create Gold Window
    789.   #--------------------------------------------------------------------------
    790.   def create_gold_window
    791.     x_width = 250
    792.     spacer = 123
    793.     @gold_window = Window_Gold.new
    794.     @gold_window.width = Graphics.width - x_width - spacer - 10
    795.     @gold_window.x += x_width + spacer
    796.     @gold_window.y = 10
    797.   end
    798.   #--------------------------------------------------------------------------
    799.   # * Alias Method: Return to Calling Scene
    800.   #--------------------------------------------------------------------------
    801.   alias :fg7_simple_magic_system_return_scene :return_scene
    802.   def return_scene
    803.     fg7_simple_magic_system_return_scene
    804.     $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Shop_Effect_Switch] = false
    805.   end
    806. end
    807. #==============================================================================
    808. # ** Scene_Skill
    809. #------------------------------------------------------------------------------
    810. #  This class performs skill screen processing. Skills are handled as items for
    811. # the sake of process sharing.
    812. #==============================================================================
    813. class Scene_Skill < Scene_ItemBase
    814.   #--------------------------------------------------------------------------
    815.   # * Alias Method: Start Processing
    816.   #--------------------------------------------------------------------------
    817.   alias :fg7_simple_magic_system_start :start
    818.   def start
    819.     fg7_simple_magic_system_start
    820.     # Checks if magic shop-like effect is turned on
    821.     if $game_system.check_magic_shop_switch
    822.       create_skill_sms_command_window
    823.       create_actor_status_window
    824.       create_gold_window
    825.       create_scene_title_window
    826.     end
    827.   end
    828.   #--------------------------------------------------------------------------
    829.   # * New Method: Create Scene Title Window
    830.   #--------------------------------------------------------------------------
    831.   def create_scene_title_window
    832.     @scene_title_window = Window_SMS_Title.new(10, 10, 363, 48)
    833.   end
    834.   #--------------------------------------------------------------------------
    835.   # * Added Method: Create Status Window
    836.   #--------------------------------------------------------------------------
    837.   def create_actor_status_window
    838.     x_width = 250
    839.     x = 10
    840.     y = Graphics.height - x_width - 108
    841.     @actor_status_window = Window_MenuStatus.new(x, y)
    842.     @actor_status_window.show
    843.     @actor_status_window.select_last
    844.     @actor_status_window.show
    845.     @actor_status_window.refresh
    846.   end
    847.   #--------------------------------------------------------------------------
    848.   # * Alias Method: Create Command Window
    849.   #--------------------------------------------------------------------------
    850.   alias :fg7_simple_magic_system_create_command_window :create_command_window
    851.   def create_command_window
    852.     fg7_simple_magic_system_create_command_window
    853.     # Checks if magic shop-like effect is turned on
    854.     if $game_system.check_magic_shop_switch
    855.       x_width = 250
    856.       @command_window.width = Graphics.width - x_width - 4
    857.       @command_window.x += x_width - 6
    858.       @command_window.y -= 18
    859.       @command_window.refresh
    860.     end
    861.   end
    862.   #--------------------------------------------------------------------------
    863.   # * New Method: Window_SkillSMSCommand - Command Window
    864.   #--------------------------------------------------------------------------
    865.   def create_skill_sms_command_window
    866.     wy = @help_window.height
    867.     @skill_sms_command_window = Window_SkillSMSCommand.new(0, wy)
    868.     @skill_sms_command_window.deactivate
    869.     @skill_sms_command_window.hide
    870.     @skill_sms_command_window.set_handler(:view, method(:skill_view))
    871.     @skill_sms_command_window.set_handler(:remove, method(:skill_remove))
    872.     @skill_sms_command_window.set_handler(:cancel, method(:skill_cancel))
    873.     # Checks if magic shop-like effect is turned on
    874.     if $game_system.check_magic_shop_switch
    875.       x_width = 250
    876.       @skill_sms_command_window.width = Graphics.width - x_width - 4
    877.       @skill_sms_command_window.x += x_width - 6
    878.       @skill_sms_command_window.y -= 18
    879.       @skill_sms_command_window.refresh
    880.     end
    881.   end
    882.   #--------------------------------------------------------------------------
    883.   # * Alias Method: Create Status Window
    884.   #--------------------------------------------------------------------------
    885.   alias :fg7_simple_magic_system_create_status_window :create_status_window
    886.   def create_status_window
    887.     fg7_simple_magic_system_create_status_window
    888.     # Checks if magic shop-like effect is turned on
    889.     if $game_system.check_magic_shop_switch
    890.       @status_window.hide
    891.     end
    892.   end
    893.   #--------------------------------------------------------------------------
    894.   # * Alias Method: Create Help Window
    895.   #--------------------------------------------------------------------------
    896.   alias :fg7_simple_magic_system_create_help_window :create_help_window
    897.   def create_help_window
    898.     fg7_simple_magic_system_create_help_window
    899.     # Checks if magic shop-like effect is turned on
    900.     if $game_system.check_magic_shop_switch
    901.       x_width = 250
    902.       @help_window.x = 10
    903.       @help_window.y = x_width + 80
    904.       @help_window.height = Graphics.height - x_width - 90
    905.       @help_window.width = Graphics.width - 20
    906.       @help_window.refresh
    907.     end
    908.   end
    909.   #--------------------------------------------------------------------------
    910.   # * Alias Method: Create Item Window
    911.   #--------------------------------------------------------------------------
    912.   alias :fg7_simple_magic_system_create_item_window :create_item_window
    913.   def create_item_window
    914.     fg7_simple_magic_system_create_item_window
    915.     # Checks if magic shop-like effect is turned on
    916.     if $game_system.check_magic_shop_switch
    917.       x_width = 250
    918.       @item_window.x += x_width - 6
    919.       @item_window.width = Graphics.width - x_width - 4
    920.       @item_window.height = Graphics.height - x_width - 14
    921.       @item_window.y = Graphics.height - x_width + 12
    922.       @item_window.refresh
    923.     end
    924.   end
    925.   #--------------------------------------------------------------------------
    926.   # * Added Method: Create Gold Window
    927.   #--------------------------------------------------------------------------
    928.   def create_gold_window
    929.     x_width = 250
    930.     spacer = 123
    931.     @gold_window = Window_Gold.new
    932.     @gold_window.width = Graphics.width - x_width - spacer - 10
    933.     @gold_window.x += x_width + spacer
    934.     @gold_window.y = 10
    935.   end
    936.   #--------------------------------------------------------------------------
    937.   # * New Method: Skill [View]
    938.   #--------------------------------------------------------------------------
    939.   def skill_view
    940.     @item_window.activate
    941.     @item_window.select_last
    942.   end
    943.   #--------------------------------------------------------------------------
    944.   # * New Method: Skill [Remove]
    945.   #--------------------------------------------------------------------------
    946.   def skill_remove
    947.     # Checks current gold amount vs amount of gold to lose per module
    948.     if $game_system.check_currency_compare == false
    949.       RPG::SE.stop
    950.       # Lose gold if flag is set "true"
    951.       $game_party.lose_gold(FG7::Simple_Magic_System::Cost_To_Add_And_Remove_Amount)
    952.       # Remove Skill Type (Skill State - Both have same ID)
    953.       $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = true
    954.       @actor.remove_state(@command_window.current_selection)
    955.       $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = false
    956.       # Reposition hover selection + plays use item sound
    957.       @command_window.select(0)
    958.       Sound.play_use_item
    959.       @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Cost_To_Add_And_Remove_Amount.to_s + Vocab::currency_unit + " has been removed")
    960.       # Reactivates correct command window(s)
    961.       @skill_sms_command_window.deactivate
    962.       @skill_sms_command_window.hide
    963.       @command_window.activate
    964.       @command_window.show
    965.     # Play buzzer sound + add text to help window when switch is not met
    966.     else
    967.       RPG::SE.stop
    968.       @skill_sms_command_window.activate
    969.       @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Not_Enough_Currency)
    970.       Sound.play_buzzer
    971.     end
    972.     # Refresh windows
    973.     @gold_window.refresh
    974.     @actor_status_window.refresh
    975.     @status_window.refresh
    976.     @command_window.refresh
    977.     @item_window.refresh
    978.   end
    979.   #--------------------------------------------------------------------------
    980.   # * New Method: Skill [Cancel]
    981.   #--------------------------------------------------------------------------
    982.   def skill_cancel
    983.     @help_window.draw_text_ex(4, 0, "") # Resets text for help window = blank
    984.     @help_window.refresh
    985.     @skill_sms_command_window.deactivate
    986.     @skill_sms_command_window.hide
    987.     @item_window.deactivate
    988.     @item_window.unselect
    989.     @command_window.select(0)
    990.     @command_window.activate
    991.     @command_window.show
    992.   end
    993.   #--------------------------------------------------------------------------
    994.   # * Alias Method: Item [Cancel]
    995.   #--------------------------------------------------------------------------
    996.   alias :fg7_simple_magic_system_on_item_cancel :on_item_cancel
    997.   def on_item_cancel
    998.     # Checks if magic shop-like effect is turned on
    999.     if $game_system.check_magic_shop_switch
    1000.       @skill_sms_command_window.deactivate
    1001.       @skill_sms_command_window.hide
    1002.       @item_window.unselect
    1003.       @command_window.select(0)
    1004.       @command_window.activate
    1005.       @command_window.show
    1006.     else
    1007.       fg7_simple_magic_system_on_item_cancel
    1008.     end
    1009.   end
    1010.   #--------------------------------------------------------------------------
    1011.   # * Alias Method: [Skill] Command
    1012.   #--------------------------------------------------------------------------
    1013.   alias :fg7_simple_magic_system_command_skill :command_skill
    1014.   def command_skill
    1015.     # Checks if magic shop-like effect is turned on
    1016.     if $game_system.check_magic_shop_switch
    1017.       @help_window.draw_text_ex(4, 0, "") # Resets text for help window = blank
    1018.       @command_window.deactivate
    1019.       @command_window.hide
    1020.       @skill_sms_command_window.activate
    1021.       @skill_sms_command_window.show
    1022.       @help_window.refresh
    1023.     else
    1024.       fg7_simple_magic_system_command_skill
    1025.     end
    1026.   end
    1027.   #--------------------------------------------------------------------------
    1028.   # * Alias Method: Change Actors
    1029.   #--------------------------------------------------------------------------
    1030.   alias :fg7_simple_magic_system_on_actor_change :on_actor_change
    1031.   def on_actor_change
    1032.     # Checks if magic shop-like effect is turned on
    1033.     if $game_system.check_magic_shop_switch
    1034.       @help_window.draw_text_ex(4, 0, "") # Resets text for help window = blank
    1035.       @help_window.refresh
    1036.       @actor_status_window.select_last
    1037.       @actor_status_window.refresh
    1038.       @command_window.actor = @actor
    1039.       @status_window.actor = @actor
    1040.       @item_window.actor = @actor
    1041.       @command_window.activate
    1042.     else
    1043.       fg7_simple_magic_system_on_actor_change
    1044.     end
    1045.   end
    1046.   #--------------------------------------------------------------------------
    1047.   # * Alias Method: Return to Calling Scene
    1048.   #--------------------------------------------------------------------------
    1049.   alias :fg7_simple_magic_system_return_scene :return_scene
    1050.   def return_scene
    1051.     fg7_simple_magic_system_return_scene
    1052.     $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Shop_Effect_Switch] = false
    1053.   end
    1054. end
    复制代码

    Spoiler: OLDER: FG7 - Simple Magic System v1.2
                    Ruby:       
    1. #==============================================================================
    2. # Title: Simple Magic System
    3. # Author: FamilyGamer7 (FG7)
    4. # Version: 1.2
    5. # Engine: RPG Maker VX Ace
    6. #==============================================================================
    7. # ** Change Log |
    8. # ---------------
    9. # 1.0 => Created script
    10. # 1.1 => Added Skilltype limit for all actors
    11. # 1.2 => Added in cost to remove skilltype on actor (optional)
    12. #==============================================================================
    13. # ** Description |
    14. # ----------------
    15. # Easy way to build onto the existing magic system VX Ace engine uses. This
    16. # script introduces the concept of magic items that are consumable which add
    17. # skilltype(s) onto the actor and the ability to remove the skilltype(s) on
    18. # the skill window. This is all controlled by "states".
    19. #==============================================================================
    20. # ** Terms of Use |
    21. # -----------------
    22. # * Free to use in non-commercial projects and commercial projects
    23. # * Feel free to modify and improve the script. Credit is still required.
    24. # * Credit FamilyGamer7
    25. #==============================================================================
    26. # ** Usage |
    27. # ----------
    28. # * NOT Plug & Play (See "Setup" section to properly use this script)
    29. #==============================================================================
    30. # ** Setup |
    31. # ---------
    32. # - See Demo for a better representation/understanding on how the script works.
    33. #
    34. # This script does require a small setup up front. The most important thing to
    35. # note is the skilltype/state/item id number will all need to be the same for
    36. # this script to function properly (Ideally keep the naming consistent as well).
    37. #
    38. #   - Ex: Fire / skilltype id = 50
    39. #   - Ex: Fire / item id = 50
    40. #   - Ex: SMS: Fire / state id = 50
    41. #     (Note: The "state" name needs to have "SMS:" before the state name)
    42. #
    43. # * Note: Since all of the id's are the same, this allows the script to do all
    44. #         of the heavy lifting when adding and removing the skilltype per actor.
    45. #
    46. # -----------------------------------------------------------------------------
    47. #
    48. # For the "Magic Item" setup:
    49. #
    50. # - A magic item is simply just a normal item that is "consumable" and with an
    51. #   added state on it. Using the example of a [SMS: Fire] state that has been
    52. #   already made, the illustration below is how yours should look on the effects
    53. #   box.
    54. #
    55. # Effects
    56. #  -----------------------------------
    57. #  | Kind        | Content           |
    58. #  -----------------------------------
    59. #  | Add State     [SMS: Fire] 100%  |
    60. #  -----------------------------------
    61. #  |                                 |
    62. #  -----------------------------------
    63. #  |                                 |
    64. #  -----------------------------------
    65. #
    66. #   General Settings:
    67. #   - Item Type: Normal
    68. #   - Consume: Yes
    69. #   - Scope: One Ally
    70. #   - Occasion: Only from the Menu
    71. #
    72. # -----------------------------------------------------------------------------
    73. #
    74. # For the magic "State" setup:
    75. #
    76. # - A magic "state" is essentially a duplicate of the skilltype that you add
    77. #   the skilltype through the features box area. Using the example of a [Fire]
    78. #   skilltype that has been already made, the illustration below is how yours
    79. #   should look look on the features box.
    80. #
    81. #   * Note: As stated above, the "state" name needs to have "SMS:" before the
    82. #     state name. See example below how the state name should look.
    83. #     - Ex: SMS: Fire
    84. #
    85. # Features
    86. #  --------------------------------
    87. #  | Kind             | Content   |
    88. #  --------------------------------
    89. #  | Add Skill Type     [Fire]    |
    90. #  --------------------------------
    91. #  |                              |
    92. #  --------------------------------
    93. #  |                              |
    94. #  --------------------------------
    95. #
    96. # For the state icons, you can choose to have icons that show by the actor or
    97. # leave it blank. The choose is yours depending upon your game.
    98. #
    99. # * The rest of the setup is your "normal" attach skill(s) to your newly created
    100. #   skilltype and ensure the actor can learn those skills at a certain level.
    101. #
    102. #==============================================================================
    103. # ** Script Intention |
    104. # --------------------
    105. # This script tries to emulate a magic system where you place a magic item into
    106. # a character slot - without the slot factor. Since we are just building on top
    107. # of the existing default magic system, a slot concept does not exist.
    108. #==============================================================================
    109. #==============================================================================
    110. # ** Module: FG7::Simple_Magic_System
    111. #------------------------------------------------------------------------------
    112. #  This modules creates a static variable to be used within the script.
    113. #==============================================================================
    114. module FG7
    115.   module Simple_Magic_System
    116. #==============================================================================
    117. # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
    118. #==============================================================================
    119.     # Sets the value for the $game_switch used for the simple magic system
    120.     # (- REQUIRED -)
    121.     Simple_Magic_System_Switch = 33
    122.   
    123.     # Sets the value for the magic item icon index that is used for the script
    124.     # (Please ensure no other item uses this item icon index number)
    125.     # (- REQUIRED -)
    126.     Magic_Item_Icon_Match = 359
    127.   
    128.     # Sets the value for the total magic items that can be applied to an actor
    129.     Skilltype_Magic_Limit = 3
    130.   
    131.     # Sets the switch to add the ability to remove "gold" on skilltype removal
    132.     # (Default is false)
    133.     Cost_To_Remove_Skilltype_Switch = false
    134.   
    135.     # Sets the value for how much it cost to remove a skilltype from actor
    136.     # (This is used if Skilltype switch is set to "True")
    137.     Cost_To_Remove_Skilltype = 1000
    138.   
    139.     # Sets the text string when not enough currency is available for magic removal
    140.     # (This is used if Skilltype switch is set to "True")
    141.     Not_Enough_Currency = "Not enough currency to remove magic."
    142.   
    143. #==============================================================================
    144. # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
    145. #==============================================================================
    146.   end
    147. end
    148. #==============================================================================
    149. # ** Game_Battler
    150. #------------------------------------------------------------------------------
    151. #  A battler class with methods for sprites and actions added. This class
    152. # is used as a super class of the Game_Actor class and Game_Enemy class.
    153. #==============================================================================
    154. class Game_Battler < Game_BattlerBase
    155.   #--------------------------------------------------------------------------
    156.   # * Alias Method: Remove State
    157.   #--------------------------------------------------------------------------
    158.   alias :fg7_simple_magic_system_remove_state :remove_state
    159.   def remove_state(state_id)
    160.     fg7_simple_magic_system_remove_state(state_id)
    161.     # When state (magic) is removed - add back into inventory
    162.     # (Odd issue where item 1 in the database is added - Worked around issue)
    163.     $game_party.gain_item($data_items[state_id], 1) && $game_party.gain_item($data_items[1], -1) if $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] == true
    164.   end
    165. end
    166. #==============================================================================
    167. # ** Window_SkillCommand
    168. #------------------------------------------------------------------------------
    169. #  This window is for selecting commands (special attacks, magic, etc.) on the
    170. # skill screen.
    171. #==============================================================================
    172. class Window_SkillCommand < Window_Command
    173.   #--------------------------------------------------------------------------
    174.   # * New Method: Grabs current skilltype id command
    175.   #--------------------------------------------------------------------------
    176.   def current_selection
    177.     select(current_ext)
    178.   end
    179. end
    180. #==============================================================================
    181. # ** Window_SkillSMSCommand
    182. #------------------------------------------------------------------------------
    183. #  This window is for selecting skilltype command on the skill screen.
    184. #==============================================================================
    185. class Window_SkillSMSCommand < Window_Command
    186.   #--------------------------------------------------------------------------
    187.   # * Object Initialization
    188.   #--------------------------------------------------------------------------
    189.   def initialize(x, y)
    190.     super(x, y)
    191.   end
    192.   #--------------------------------------------------------------------------
    193.   # * Get Window Width
    194.   #--------------------------------------------------------------------------
    195.   def window_width
    196.     return 160
    197.   end
    198.   #--------------------------------------------------------------------------
    199.   # * Get Number of Lines to Show
    200.   #--------------------------------------------------------------------------
    201.   def visible_line_number
    202.     return 4
    203.   end
    204.   #--------------------------------------------------------------------------
    205.   # * Get Item Height
    206.   #--------------------------------------------------------------------------
    207.   def item_height
    208.     32
    209.   end
    210.   #--------------------------------------------------------------------------
    211.   # * Get Digit Count
    212.   #--------------------------------------------------------------------------
    213.   def col_max
    214.     return 1
    215.   end
    216.   #--------------------------------------------------------------------------
    217.   # * Create Command List
    218.   #--------------------------------------------------------------------------
    219.   def make_command_list
    220.     add_command("View", :view)
    221.     add_command("Remove", :remove)
    222.     add_command("Cancel", :cancel)
    223.   end
    224. end
    225. #==============================================================================
    226. # ** Scene_ItemBase
    227. #------------------------------------------------------------------------------
    228. #  This class performs common processing for the item screen and skill screen.
    229. #==============================================================================
    230. class Scene_ItemBase < Scene_MenuBase
    231.   #--------------------------------------------------------------------------
    232.   # * Override Method: Actor [OK]
    233.   #--------------------------------------------------------------------------
    234.   def on_actor_ok
    235.     # Checks for new skilltype/state on selected actor
    236.     if item_usable? && item.icon_index == FG7::Simple_Magic_System::Magic_Item_Icon_Match && $game_party.members[@actor_window.select_for_item(item)].states.collect { |state| state.name }.to_s.count(':') == FG7::Simple_Magic_System::Skilltype_Magic_Limit
    237.       Sound.play_buzzer
    238.     # Perform the normal check for item usage consumption
    239.     elsif item_usable?
    240.       use_item
    241.     else
    242.       Sound.play_buzzer
    243.     end
    244.     @actor_window.refresh
    245.   end
    246.   #--------------------------------------------------------------------------
    247.   # * New Method: Grabs current total skilltype(s) added on actor
    248.   #--------------------------------------------------------------------------
    249.   def current_selection
    250.     select(current_ext)
    251.   end
    252. end
    253. #==============================================================================
    254. # ** Scene_Skill
    255. #------------------------------------------------------------------------------
    256. #  This class performs skill screen processing. Skills are handled as items for
    257. # the sake of process sharing.
    258. #==============================================================================
    259. class Scene_Skill < Scene_ItemBase
    260.   #--------------------------------------------------------------------------
    261.   # * Alias Method: Start Processing
    262.   #--------------------------------------------------------------------------
    263.   alias :fg7_simple_magic_system_start :start
    264.   def start
    265.     fg7_simple_magic_system_start
    266.     create_skill_sms_command_window
    267.   end
    268.   #--------------------------------------------------------------------------
    269.   # * New Method: Window_SkillSMSCommand - Command Window
    270.   #--------------------------------------------------------------------------
    271.   def create_skill_sms_command_window
    272.     wy = @help_window.height
    273.     @skill_sms_command_window = Window_SkillSMSCommand.new(0, wy)
    274.     @skill_sms_command_window.deactivate
    275.     @skill_sms_command_window.hide
    276.     @skill_sms_command_window.set_handler(:view, method(:skill_view))
    277.     @skill_sms_command_window.set_handler(:remove, method(:skill_remove))
    278.     @skill_sms_command_window.set_handler(:cancel, method(:skill_cancel))
    279.   end
    280.   #--------------------------------------------------------------------------
    281.   # * New Method: Skill [View]
    282.   #--------------------------------------------------------------------------
    283.   def skill_view
    284.     @item_window.activate
    285.     @item_window.select_last
    286.   end
    287.   #--------------------------------------------------------------------------
    288.   # * New Method: Skill [Remove]
    289.   #--------------------------------------------------------------------------
    290.   def skill_remove
    291.     # Checks Skilltype switch if "true"
    292.     if FG7::Simple_Magic_System::Cost_To_Remove_Skilltype_Switch == true
    293.       # Checks current gold amount vs amount of gold to lose per module
    294.       if $game_party.gold > $game_party.lose_gold(FG7::Simple_Magic_System::Cost_To_Remove_Skilltype)
    295.         RPG::SE.stop
    296.         # Lose gold if flag is set "true"
    297.         $game_party.lose_gold(FG7::Simple_Magic_System::Cost_To_Remove_Skilltype) if FG7::Simple_Magic_System::Cost_To_Remove_Skilltype_Switch == true
    298.         # Remove Skill Type (Skill State - Both have same ID)
    299.         $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = true
    300.         @actor.remove_state(@command_window.current_selection)
    301.         $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = false
    302.         # Reposition hover selection + plays use item sound
    303.         @command_window.select(0)
    304.         Sound.play_use_item
    305.         @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Cost_To_Remove_Skilltype.to_s + Vocab::currency_unit + " has been removed")
    306.         # Reactivates correct command window(s)
    307.         @skill_sms_command_window.deactivate
    308.         @skill_sms_command_window.hide
    309.         @command_window.activate
    310.         @command_window.show
    311.       # Play buzzer sound + add text to help window when switch is not met
    312.       else
    313.         RPG::SE.stop
    314.         @skill_sms_command_window.activate
    315.         @help_window.draw_text_ex(4, 0, FG7::Simple_Magic_System::Not_Enough_Currency)
    316.         Sound.play_buzzer
    317.       end
    318.     else
    319.       RPG::SE.stop
    320.       # Remove Skill Type (Skill State - Both have same ID)
    321.       $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = true
    322.       @actor.remove_state(@command_window.current_selection)
    323.       $game_switches[FG7::Simple_Magic_System::Simple_Magic_System_Switch] = false
    324.       # Reposition hover selection + plays use item sound
    325.       @command_window.select(0)
    326.       Sound.play_use_item
    327.       # Reactivates correct command window(s)
    328.       @skill_sms_command_window.deactivate
    329.       @skill_sms_command_window.hide
    330.       @command_window.activate
    331.       @command_window.show
    332.     end
    333.     # Refresh windows
    334.     @status_window.refresh
    335.     @command_window.refresh
    336.     @item_window.refresh
    337.   end
    338.   #--------------------------------------------------------------------------
    339.   # * New Method: Skill [Cancel]
    340.   #--------------------------------------------------------------------------
    341.   def skill_cancel
    342.     @help_window.draw_text_ex(4, 0, "") # Resets text for help window = blank
    343.     @help_window.refresh
    344.     @skill_sms_command_window.deactivate
    345.     @skill_sms_command_window.hide
    346.     @item_window.deactivate
    347.     @item_window.unselect
    348.     @command_window.select(0)
    349.     @command_window.activate
    350.     @command_window.show
    351.   end
    352.   #--------------------------------------------------------------------------
    353.   # * Override Method: Item [Cancel]
    354.   #--------------------------------------------------------------------------
    355.   def on_item_cancel
    356.     @skill_sms_command_window.deactivate
    357.     @skill_sms_command_window.hide
    358.     @item_window.unselect
    359.     @command_window.select(0)
    360.     @command_window.activate
    361.     @command_window.show
    362.   end
    363.   #--------------------------------------------------------------------------
    364.   # * Override Method: [Skill] Command
    365.   #--------------------------------------------------------------------------
    366.   def command_skill
    367.     @help_window.draw_text_ex(4, 0, "") # Resets text for help window = blank
    368.     @command_window.deactivate
    369.     @command_window.hide
    370.     @skill_sms_command_window.activate
    371.     @skill_sms_command_window.show
    372.     @help_window.refresh
    373.   end
    374. 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-simple-magic-system.144848/

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

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

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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