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

[转载发布] FG7 - Simple Auto State Removal

[复制链接]
累计送礼:
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:47:08 | 显示全部楼层 |阅读模式
    Simple Auto State Removal
    By: FamilyGamer7​


    Introduction
                            Quick and easy script snippet that will remove all current states on the actor once a new state is added on.               
    Click to expand...


    Features
                            The actor(s) will only ever have 1 state added at one time with this script. Preventing multiple states on any given actor.               
    Click to expand...


    Screenshot(s)
                            - Not Needed -               
    Click to expand...


    Script
    Spoiler: FG7 - Simple Auto State Removal
                    Ruby:       
    1. #==============================================================================
    2. # Title: Simple Auto State Removal
    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 ability to turn off/on script effect anytime in game (script call)
    11. # 1.2 => Fixed error with certain states when clearing all states
    12. #==============================================================================
    13. # ** Description |
    14. # ----------------
    15. # Quick and easy script snippet that will remove all current states on the
    16. # actor once a new state is added on. The actor(s) will only ever have 1 state
    17. # added at one time with this script.
    18. #==============================================================================
    19. # ** Terms of Use |
    20. # -----------------
    21. # * Free to use in non-commercial projects and commercial projects
    22. # * Feel free to modify and improve the script. Credit is still required.
    23. # * Credit FamilyGamer7
    24. #==============================================================================
    25. # ** Usage |
    26. # ----------
    27. # * Plug & Play
    28. # -----------------------------------------------------------------------------
    29. # By default, the script has the auto state removal as turned ON. But, to turn
    30. # off/on the auto state removal, see the script calls below.
    31. #
    32. # To turn OFF auto state removal:
    33. # - $game_system.auto_state_removal_off = true
    34. #
    35. # To turn ON auto state removal:
    36. # - $game_system.auto_state_removal_off = false
    37. #==============================================================================
    38. #==============================================================================
    39. # ** Module: FG7::Auto_State_Removal
    40. #------------------------------------------------------------------------------
    41. #  This modules creates a static variable to be used within the script.
    42. #==============================================================================
    43. module FG7
    44.   module Auto_State_Removal
    45. #==============================================================================
    46. # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
    47. #==============================================================================
    48.     # Sets the value for the $game_switch used for the auto state removal
    49.     Auto_State_Removal_Switch = 311
    50.    
    51. #==============================================================================
    52. # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
    53. #==============================================================================
    54.   end
    55. end
    56. #==============================================================================
    57. # ** Game_System
    58. #------------------------------------------------------------------------------
    59. #  This class handles system data. It saves the disable state of saving and
    60. # menus. Instances of this class are referenced by $game_system.
    61. #==============================================================================
    62. class Game_System
    63.   #--------------------------------------------------------------------------
    64.   # * New Method: auto_state_removal_off (Flag to turn on/off during game)
    65.   #--------------------------------------------------------------------------
    66.   def auto_state_removal_off=(string)
    67.     @auto_state_removal_off = string
    68.     $game_switches[FG7::Auto_State_Removal::Auto_State_Removal_Switch] = @auto_state_removal_off
    69.   end
    70. end
    71. #==============================================================================
    72. # ** Game_Battler
    73. #------------------------------------------------------------------------------
    74. #  A battler class with methods for sprites and actions added. This class
    75. # is used as a super class of the Game_Actor class and Game_Enemy class.
    76. #==============================================================================
    77. class Game_Battler < Game_BattlerBase
    78.   #--------------------------------------------------------------------------
    79.   # * Alias Method: Add New State
    80.   #--------------------------------------------------------------------------
    81.   alias :fg7_auto_state_removal_add_new_state :add_new_state
    82.   def add_new_state(state_id)
    83.     # Removea any current state when adding a new state
    84.     clear_states if $game_switches[FG7::Auto_State_Removal::Auto_State_Removal_Switch] == false
    85.     # Calls original method
    86.     fg7_auto_state_removal_add_new_state(state_id)
    87.   end
    88. 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-auto-state-removal.144761/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    简体中文
    繁體中文
    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.113750 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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