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

[转载发布] Incapacitate States XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    4462

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 前天 15:25 | 显示全部楼层 |阅读模式
    Incapacitate States XP

    by

    Gidan90​


    This script allows setup states that makes the character to be set as dead even if not actually dead, an example is a petrification state.

    Features
    - If all party members are hit by this state, it’s game over.
    - If all enemies are hit by this state the battle ends, and you not receive any experience points, items or money.
    v. 1.0.1
    - You can choose if obtain or not exp and gil when all foes are incapacitated.
    - You can choose if change or not battler color when incapacitated.


    How to Use
    Copy the script into the script editor below the default scripts but above Main. Follow the instructions and configuration guidance within the script itself.


    Script
    Spoiler: Script
                    Ruby:        
    1. #-------------------------------------------------------------------------------
    2. # Gidan90 - Incapacitate States XP
    3. #-------------------------------------------------------------------------------
    4. # Description:
    5. # This script allows setup states that makes the character to be set as dead
    6. # even if not actually dead, an example is a petrification state.
    7. # Features:
    8. # v. 1.0.0
    9. # - If all party members are hit by this state, it’s game over.
    10. # - If all enemies are hit by this state the battle ends, and
    11. #   you not receive any experience points, items or money.
    12. # - Enemy or party members color tone changed when incapacitated
    13. #   status is applied.
    14. # v. 1.0.1
    15. # - Aliased Sprite_Battler method for more compatibilities.
    16. # - You can choose if obtain or not exp and gil when all foes are incapacitated.
    17. # - You can choose if change or not battler color when incapacitated.
    18. #-------------------------------------------------------------------------------
    19. # * This script was made with the default battle system in mind. Custom battle
    20. #   scripts will most likely not work with this script without edits.
    21. # * Changes made to Game_Party, Game_Troop, Game_Battler, Scene_Battle
    22. #   and Sprite_Battler.
    23. #-------------------------------------------------------------------------------
    24. module Gidan
    25.   module IncapacitateStates
    26.     # ID from database of incapacitate states.
    27.     PETRIFY_STATE = 18  # Petrify State.
    28.     #CUSTOM_STATE = 19  # Rename it and add your custom state to line 90 and 268.
    29.    
    30.     # Option (TRUE/FALSE)
    31.     OBT_EXP = false # Set true to obtain exp and gil when all foes are incapacitated.
    32.     INC_TONE = true # Set false if you don't want to change battler color tone when incapacitated.
    33.   end
    34. end
    35. class Game_Party
    36.   #--------------------------------------------------------------------------
    37.   # * Get Array of Living Members
    38.   #--------------------------------------------------------------------------
    39.   def alive_members
    40.     @actors.select{|member| member.alive?}
    41.   end
    42.   #--------------------------------------------------------------------------
    43.   # * Determine Everyone is Incapacitated
    44.   #--------------------------------------------------------------------------
    45.   def all_incapacitate?
    46.     # If an actor is in the party not incapacitate
    47.     for actor in self.alive_members
    48.       unless actor.incapacitate?
    49.         # End Method
    50.         return false
    51.       end
    52.     end
    53.     # All members incapacitate
    54.     return true
    55.   end
    56. end
    57. class Game_Troop
    58.   #--------------------------------------------------------------------------
    59.   # * Get Array of Living Members
    60.   #--------------------------------------------------------------------------
    61.   def alive_members
    62.     @enemies.select{|member| member.alive?}
    63.   end
    64.   #--------------------------------------------------------------------------
    65.   # * Determine Everyone is Incapacitated
    66.   #--------------------------------------------------------------------------
    67.   def all_incapacitate?
    68.     # If an enemy is in the party not incapacitate
    69.     for enemy in self.alive_members
    70.       unless enemy.incapacitate?
    71.         # End Method
    72.         return false
    73.       end
    74.     end
    75.     # All members incapacitate
    76.     return true
    77.   end
    78. end
    79. class Game_Battler
    80.   include Gidan::IncapacitateStates
    81.   #--------------------------------------------------------------------------
    82.   # * Get State ID of Incapacitate
    83.   #--------------------------------------------------------------------------
    84.   def incapacitate_state?
    85.     state?(PETRIFY_STATE) # or
    86.     #state?(CUSTOM_STATE) # Add here your custom states.
    87.   end
    88.   #--------------------------------------------------------------------------
    89.   # * Check Incapacitate State
    90.   #--------------------------------------------------------------------------
    91.   def incapacitate?
    92.     return (incapacitate_state?)
    93.   end
    94.   #--------------------------------------------------------------------------
    95.   # * Get State ID of K.O.
    96.   #--------------------------------------------------------------------------
    97.   def death_state?
    98.     state?(1)
    99.   end
    100.   #--------------------------------------------------------------------------
    101.   # * Determine Survival
    102.   #--------------------------------------------------------------------------
    103.   def alive?
    104.     return (not @hidden and !death_state?)
    105.   end
    106.   #--------------------------------------------------------------------------
    107.   # * Add State
    108.   #     state_id : state ID
    109.   #     force    : forcefully added flag (used to deal with auto state)
    110.   #--------------------------------------------------------------------------
    111.   alias incapacitate_add_state add_state
    112.   def add_state(state_id, force = false)
    113.       # If incapacitate
    114.       if incapacitate? and !dead?
    115.         # End Method
    116.         return
    117.       end
    118.     incapacitate_add_state(state_id, force = false)
    119.   end
    120. end
    121. class Scene_Battle
    122.   include Gidan::IncapacitateStates
    123.   #--------------------------------------------------------------------------
    124.   # * Determine Battle Win/Loss Results
    125.   #--------------------------------------------------------------------------
    126.   def judge
    127.     # If all dead determinant is true, if all incapacitate determinant is true
    128.     # or number of members in party is 0
    129.     if $game_party.all_dead? or $game_party.all_incapacitate? or $game_party.actors.size == 0
    130.       # If possible to lose
    131.       if $game_temp.battle_can_lose
    132.         # Return to BGM before battle starts
    133.         $game_system.bgm_play($game_temp.map_bgm)
    134.         # Battle ends
    135.         battle_end(2)
    136.         # Return true
    137.         return true
    138.       end
    139.       # Set game over flag
    140.       $game_temp.gameover = true
    141.       # Return true
    142.       return true
    143.     end
    144.     # Return false if even all enemies are incapacitated
    145.     if $game_troop.all_incapacitate?
    146.       start_phase5
    147.       return true
    148.     end
    149.     # Return false if even 1 enemy exists
    150.     for enemy in $game_troop.enemies
    151.       if enemy.exist?
    152.         return false
    153.       end
    154.     end
    155.     # Start after battle phase (win)
    156.     start_phase5
    157.     # Return true
    158.     return true
    159.   end
    160.   #--------------------------------------------------------------------------
    161.   # * Start After Battle Phase
    162.   #--------------------------------------------------------------------------
    163.   def start_phase5
    164.     # Shift to phase 5
    165.     @phase = 5
    166.     # Play battle end ME
    167.     $game_system.me_play($game_system.battle_end_me)
    168.     # Return to BGM before battle started
    169.     $game_system.bgm_play($game_temp.map_bgm)
    170.     # Initialize EXP, amount of gold, and treasure
    171.     exp = 0
    172.     gold = 0
    173.     treasures = []
    174.     # Loop
    175.     for enemy in $game_troop.enemies
    176.       # If EXP_RECEIVE is true
    177.       if OBT_EXP
    178.         # If enemy is not hidden
    179.         unless enemy.hidden
    180.           # Add EXP and amount of gold obtained
    181.           exp += enemy.exp
    182.           gold += enemy.gold
    183.           # Determine if treasure appears
    184.           if rand(100) < enemy.treasure_prob
    185.             if enemy.item_id > 0
    186.               treasures.push($data_items[enemy.item_id])
    187.             end
    188.             if enemy.weapon_id > 0
    189.               treasures.push($data_weapons[enemy.weapon_id])
    190.             end
    191.             if enemy.armor_id > 0
    192.               treasures.push($data_armors[enemy.armor_id])
    193.             end
    194.           end
    195.         end
    196.       else
    197.         # If enemy is not hidden or incapacitate
    198.         unless enemy.hidden or enemy.incapacitate?
    199.           # Add EXP and amount of gold obtained
    200.           exp += enemy.exp
    201.           gold += enemy.gold
    202.           # Determine if treasure appears
    203.           if rand(100) < enemy.treasure_prob
    204.             if enemy.item_id > 0
    205.               treasures.push($data_items[enemy.item_id])
    206.             end
    207.             if enemy.weapon_id > 0
    208.               treasures.push($data_weapons[enemy.weapon_id])
    209.             end
    210.             if enemy.armor_id > 0
    211.               treasures.push($data_armors[enemy.armor_id])
    212.             end
    213.           end
    214.         end
    215.       end
    216.     end
    217.     # Treasure is limited to a maximum of 6 items
    218.     treasures = treasures[0..5]
    219.     # Obtaining EXP
    220.     for i in 0...$game_party.actors.size
    221.       actor = $game_party.actors[i]
    222.       if actor.cant_get_exp? == false
    223.         last_level = actor.level
    224.         actor.exp += exp
    225.         if actor.level > last_level
    226.           @status_window.level_up(i)
    227.         end
    228.       end
    229.     end
    230.     # Obtaining gold
    231.     $game_party.gain_gold(gold)
    232.     # Obtaining treasure
    233.     for item in treasures
    234.       case item
    235.       when RPG::Item
    236.         $game_party.gain_item(item.id, 1)
    237.       when RPG::Weapon
    238.         $game_party.gain_weapon(item.id, 1)
    239.       when RPG::Armor
    240.         $game_party.gain_armor(item.id, 1)
    241.       end
    242.     end
    243.     # Make battle result window
    244.     @result_window = Window_BattleResult.new(exp, gold, treasures)
    245.     # Set wait count
    246.     @phase5_wait_count = 100
    247.   end
    248. end
    249. class Sprite_Battler < RPG::Sprite
    250.   include Gidan::IncapacitateStates
    251.   #--------------------------------------------------------------------------
    252.   # * Frame Update
    253.   #--------------------------------------------------------------------------
    254.   alias tone_change_update update
    255.   def update
    256.     tone_change_update
    257.     # If visible
    258.     if @battler_visible and INC_TONE
    259.       # Incapacitate state set color tone
    260.       if @battler.state?(PETRIFY_STATE) and @battler.damage == nil
    261.         self.tone.set(0, 0, 0, 255)
    262.       #elsif @battler.state?(CUSTOM_STATE) and @battler.damage == nil
    263.         #self.tone.set(0, 80, 255, 0) #self.tone.set(0, 0, 0, 255)
    264.       else
    265.         self.tone.set(0, 0, 0, 0) unless @battler.incapacitate?
    266.       end
    267.     end
    268.   end
    269. end
    复制代码


    Demo
    DEMO

    Credits and Thanks
    - Kyonides for exp suggestion

    License
    You can use it for both commercial and non-commercial games!


    本贴来自国际rpgmaker官方论坛作者:Gidan90处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/incapacitate-states-xp.144835/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 16:55 , Processed in 0.103287 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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