DannyJS1 0 Posted December 24, 2021 Essentially, I have a character that can go into a temporary powered state, but I want a game over if they die during it. I've attempted to search for something that does this, but to no avail. I tried using a permanent state script with a conditional branch, but that didn't work either. Asking for a request here, as I just can't find anything that gives a script or tutorial that does this. Share this post Link to post Share on other sites
roninator2 256 Posted December 24, 2021 Two things Gamesfreak keep state on death script #============================================================================== # # ▼ Gamesfreak13563 - Stop State Removal on Death # -- Last Updated: 2012.4.29 # #============================================================================== # ▼ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script allows you to set states that won't disappear upon actor death. # The states will act as usual when the actor is dead, including counting down. # #============================================================================== #============================================================================== # ■ Options #============================================================================== module GF module STOP_STATES #State IDs that you would like to persist through death. EXCLUDED_STATES = [20] end #STOP_STATES end #GF #============================================================================== # ▼ Do not edit past this point. #============================================================================== #========================================================================== # ■ Game_BattlerBase #========================================================================== class Game_BattlerBase def clear_states_GF for state in $data_states next if state.nil? erase_state(state.id) unless GF::STOP_STATES::EXCLUDED_STATES.include?(state.id) end end end #========================================================================== # ■ Game_Battler #========================================================================== class Game_Battler < Game_BattlerBase def die @hp = 0 clear_states_GF clear_buffs end end and module R2_State_GameOver State = 4 end class Game_Actor < Game_Battler def perform_collapse_effect if $game_party.in_battle @sprite_effect_type = :collapse Sound.play_actor_collapse end actbat = nil $game_party.battle_members.each do |act| if actor.id == act.id actbat = $game_actors[act.id] end end if actbat != nil SceneManager.goto(Scene_Gameover) if actbat.dead? && actbat.state?(R2_State_GameOver::State) end end end change the state number Share this post Link to post Share on other sites
DannyJS1 0 Posted December 25, 2021 2 hours ago, roninator2 said: Two things Gamesfreak keep state on death script #============================================================================== # # ▼ Gamesfreak13563 - Stop State Removal on Death # -- Last Updated: 2012.4.29 # #============================================================================== # ▼ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script allows you to set states that won't disappear upon actor death. # The states will act as usual when the actor is dead, including counting down. # #============================================================================== #============================================================================== # ■ Options #============================================================================== module GF module STOP_STATES #State IDs that you would like to persist through death. EXCLUDED_STATES = [20] end #STOP_STATES end #GF #============================================================================== # ▼ Do not edit past this point. #============================================================================== #========================================================================== # ■ Game_BattlerBase #========================================================================== class Game_BattlerBase def clear_states_GF for state in $data_states next if state.nil? erase_state(state.id) unless GF::STOP_STATES::EXCLUDED_STATES.include?(state.id) end end end #========================================================================== # ■ Game_Battler #========================================================================== class Game_Battler < Game_BattlerBase def die @hp = 0 clear_states_GF clear_buffs end end and module R2_State_GameOver State = 4 end class Game_Actor < Game_Battler def perform_collapse_effect if $game_party.in_battle @sprite_effect_type = :collapse Sound.play_actor_collapse end actbat = nil $game_party.battle_members.each do |act| if actor.id == act.id actbat = $game_actors[act.id] end end if actbat != nil SceneManager.goto(Scene_Gameover) if actbat.dead? && actbat.state?(R2_State_GameOver::State) end end end change the state number Awesome, that totally worked! Although I would like to put a message on screen and a different Game Over screen before the Game Over sequence starts, any way to do that? I do have some scripts that allow me to change the Game Over graphic in-game, specifically Zerbu Engine - Change or Randomize Game Over Graphic. Share this post Link to post Share on other sites
roninator2 256 Posted December 25, 2021 Look for game over scripts. I think I wrote one that showed a message on the game over. Let me see... Ah, this is for a herb recover, but I can make something for you that will show a message because the call to game over with the previous code is different. https://forums.rpgmakerweb.com/index.php?threads/event-before-game-over.130993/#post-1146044 Share this post Link to post Share on other sites
DannyJS1 0 Posted December 25, 2021 45 minutes ago, roninator2 said: Look for game over scripts. I think I wrote one that showed a message on the game over. Let me see... Ah, this is for a herb recover, but I can make something for you that will show a message because the call to game over with the previous code is different. https://forums.rpgmakerweb.com/index.php?threads/event-before-game-over.130993/#post-1146044 Yeah, if you can maybe try that I'd appreciate it. Essentially I just want a message to appear saying the character succumbed to the dark power. I would like to also have the game over screen be different, but I think I may have found a script that lets me have that happen. Share this post Link to post Share on other sites
roninator2 256 Posted December 25, 2021 (edited) Try this Set the message. module R2_State_GameOver State = 4 Message = "died in a frenzie." Act_Name = true # use actor name in message end class Game_Actor < Game_Battler attr_reader :message_window def perform_collapse_effect if $game_party.in_battle @sprite_effect_type = :collapse Sound.play_actor_collapse end actbat = nil actname = nil dthmsg = nil @msgcnt = 0 if @msgcnt == nil $game_party.battle_members.each do |act| if actor.id == act.id actbat = $game_actors[act.id] actname = actor.name dthmsg = R2_State_GameOver::Message dthmsg = "#{actname} " + R2_State_GameOver::Message if R2_State_GameOver::Act_Name == true @msgcnt += 1 end end if actbat != nil if actbat.dead? && actbat.state?(R2_State_GameOver::State) $game_message.add(sprintf(dthmsg, actname)) if @msgcnt == 1 BattleManager.wait_for_message SceneManager.goto(Scene_Gameover) end end end end Edited December 27, 2021 by roninator2 corrected code Share this post Link to post Share on other sites
DannyJS1 0 Posted December 27, 2021 On 12/25/2021 at 4:07 PM, roninator2 said: Try this Set the message. module R2_State_GameOver State = 4 Message = "died in a frenzie." Act_Name = true # use actor name in message end class Game_Actor < Game_Battler attr_reader :message_window def perform_collapse_effect if $game_party.in_battle @sprite_effect_type = :collapse Sound.play_actor_collapse end actbat = nil actname = nil dthmsg = nil @msgcnt = 0 if @msgcnt == nil $game_party.battle_members.each do |act| if actor.id == act.id actbat = $game_actors[act.id] actname = actor.name dthmsg = R2_State_GameOver::Message dthmsg = "#{actname} " + R2_State_GameOver::Message if R2_State_GameOver::Act_Name == true @msgcnt += 1 end end if actbat != nil $game_message.add(sprintf(dthmsg, actname)) if @msgcnt == 1 BattleManager.wait_for_message SceneManager.goto(Scene_Gameover) if actbat.dead? && actbat.state?(R2_State_GameOver::State) end end end Hmm, that only seems to work when he dies normally. Also, I've been doing more tests and it looks like the Game Over on state death only works sometimes. Not exactly sure what is going on... Share this post Link to post Share on other sites
roninator2 256 Posted December 27, 2021 True, I forgot to test without the state. Updated the code above. Share this post Link to post Share on other sites
DannyJS1 0 Posted December 28, 2021 (edited) 13 hours ago, roninator2 said: True, I forgot to test without the state. Updated the code above. Unfortunately, now it's not working at all, even if I put the state on the first turn in battle and the character falls, the state is still on the screen but nothing happens. The state number is 55 and I made sure to change the necessary values, but now it's just not working... I haven't changed any other states and it doesn't do anything besides giving an attack and defense buff. Not exactly sure what is going on. Edited December 28, 2021 by DannyJS1 More details Share this post Link to post Share on other sites
roninator2 256 Posted December 28, 2021 Did you remove Gamefreaks Stop State removal script? Share this post Link to post Share on other sites
DannyJS1 0 Posted December 29, 2021 6 hours ago, roninator2 said: Did you remove Gamefreaks Stop State removal script? Yeah, I did. Tried one or the other separately, even changed state IDs, but nothing seems to work now. I even went back and re-added the first ones you posted, but that's not working either. I haven't added any other scripts besides those. Share this post Link to post Share on other sites
roninator2 256 Posted December 29, 2021 I tested it again with both scripts. (they are both needed) and it worked fine. Share this post Link to post Share on other sites
DannyJS1 0 Posted December 30, 2021 On 12/28/2021 at 10:10 PM, roninator2 said: I tested it again with both scripts. (they are both needed) and it worked fine. Alright, I managed to get it working again and yes, the message does play! Although I would like the message to appear after the turn is over instead of right when the character falls, beggars can't be choosers. Also, one more thing if it's possible, the state I'm using usually only lasts 3 turns, but I also want to make an exception for second version of the same state that lasts until the battle ends. I assume I would add another EXCLUDED_STATES = [#] below the first one on the first script, but how would I do that for the second script? If it's not possible, I think I can just create a special battle event that constantly refreshes the state over the battle. Share this post Link to post Share on other sites
roninator2 256 Posted December 31, 2021 (edited) module R2_State_GameOver States = [4, 7] Message = "died in a frenzie." Act_Name = true # use actor name in message end module BattleManager class << self alias r2_turn_end_dead_msg turn_end end def self.turn_end r2_turn_end_dead_msg call_dead_msg end def self.call_dead_msg actbat = nil actname = nil dthmsg = nil @msgcnt = 0 if @msgcnt == nil $game_party.battle_members.each do |act| if act.dead? actbat = $game_actors[act.id] actname = act.name dthmsg = R2_State_GameOver::Message dthmsg = "#{actname} " + R2_State_GameOver::Message if R2_State_GameOver::Act_Name == true @msgcnt += 1 end if actbat != nil if actbat.dead? && (actbat.states.any? { |st| R2_State_GameOver::States.include?(st.id) } ) $game_message.add(sprintf(dthmsg, actname)) if @msgcnt >= 1 wait_for_message @msgcnt = 0 SceneManager.goto(Scene_Gameover) end end end end end Edited January 1 by roninator2 Share this post Link to post Share on other sites
DannyJS1 0 Posted January 1 13 hours ago, roninator2 said: module R2_State_GameOver States = [4, 7] Message = "died in a frenzie." Act_Name = true # use actor name in message end module BattleManager def self.turn_end @phase = :turn_end @preemptive = false @surprise = false call_dead_msg end def self.call_dead_msg actbat = nil actname = nil dthmsg = nil @msgcnt = 0 if @msgcnt == nil $game_party.battle_members.each do |act| if act.dead? actbat = $game_actors[act.id] actname = act.name dthmsg = R2_State_GameOver::Message dthmsg = "#{actname} " + R2_State_GameOver::Message if R2_State_GameOver::Act_Name == true @msgcnt += 1 end if actbat != nil if actbat.dead? && (actbat.states.any? { |st| R2_State_GameOver::States.include?(st.id) } ) $game_message.add(sprintf(dthmsg, actname)) if @msgcnt >= 1 wait_for_message @msgcnt = 0 SceneManager.goto(Scene_Gameover) end end end end end You, sir, are the absolute best. It works! Sorry if I was asking for so much for no gain on your end, thank you so much! Unfortunately, that popular Auto-Life script Mr. Bubble made doesn't seem to work at all on any character with these scripts installed, but eh, that would probably make it too easy to circumvent this and cause even more issues, even if I make it resist the effect. I don't expect this can be fixed so easily. Share this post Link to post Share on other sites
roninator2 256 Posted January 1 Script updated. Auto life aliased the turn end and mine overwrote. I changed it to alias so it should work now. Share this post Link to post Share on other sites
DannyJS1 0 Posted January 2 10 hours ago, roninator2 said: Script updated. Auto life aliased the turn end and mine overwrote. I changed it to alias so it should work now. Was having some issues at first, but I moved the auto life script after the scripts you gave me and it works perfectly! I'm still going to have the state be immune to auto life, as it wouldn't be risky otherwise. Thanks for all the help again! Share this post Link to post Share on other sites