Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Doom?

I'm trying to make a doom skill.  If you're unfamilier with doom skills, they are skills that give a certain amount of time, (five turns, for example) then when the time is up, the player will die even at full health.  I've tried a number of things.  Is there ANY way to do this without a script?
 
You could try a Troop event, put this page in every Troop that uses the Doom skill.

Condition: Turn 1 + 1X, Span "Turn"
Code:
@>Conditional Branch: [Actor] is [Doom] Inflicted
  @>Conditional Branch: Variable [Doom] >= 5
    @>Change State: [Actor] + Knockout
    @>Control Variables: [Doom] = 0
   : Else
    @>Control Variables: [Doom] += 1
 : End Processing

Then go to Database->States, and on the right make sure "Knockout" removes the "Doom" state.

If you have multiple actors inflicted at different times, copy and paste the code, then change the actors and variables (each actor will need a Doom variable). If you have multiple actors that are all inflicted at the same time (and die the same turn), use only one Conditional Branch, but make every actor gain the "Knockout" state once the variable is >= 5. You can also change 5 depending on the number of turns.

Good luck with it Fandosheckle :thumb:
 
Of course!! Variables!!  I can't believe I didn't think about that...

Thanks a lot!  As far as I can tell, it works perfectly.  Of course, I have one more question...

How do you let the player know how many turns are left?  I can't seem to find a simple way, not that "simple" exist in RMXP, but I can't find a method that I could use without tons of other work...
 
Well every turn you could have a Conditional Branches that check the variable.

If you have say 5 turns, and the variable is equal to 1, show a message saying "4 turns left." If the variable is equal to 2, "3 turns left", and so on.
 
Hmm... Well, you could make 5 different conditions: Doom 5, doom 4, doom 3, etc... to let the players know how much turns is left.

Instead of adding 1 to the variable, just change the condition from doom 5 to doom 4, etc. When the count reaches doom 0, the player gets knocked out on the next turn.
 

Kraft

Sponsor

That or give them like a condition or whatever they are called... ailments...  Like Poison or something you know?
And make it change depending on how many turns of left.

Either have a number somewhere in there that comes up before every attack, or have the player get pink one turn, then the next turn get a little more red... until the last turn where the player is all red or something like that...

Just a few ideas... Good luck with them!
 
King of Red Pancakes -  Lol, sorry, but that's life for ya! :D

Doctor - I tried that, but If the enemy cast Doom on the player twice, the number would go back to 5.  Since I want always for the player to be infected by Doom, I put it under Nonresistant.

Kraft - I think color thing is a novel idea!  But the player wouldn't know at first.  "HOW CRIMSON MUST I TURN BEFORE I FINALLY DIE!!!?!?!"
 
Fandosheckle: I haven't thought of that... how about just making the priority for Doom 1 higher than Doom 2 and so on, that way the lowest number will always be displayed (unless you're using one of those rotating stats scripts). When the hero finally faints, all conditions will be erased so it's no problem.
 
I made a script for this awhile back (took 30 minutes to find, actually found a keyboard music player script I never finished...).

Anways:
Code:
#==============================================================================
# ** Doom States, Items & Skills
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-11-27
# SDK : Version 2.0+, Part I
#------------------------------------------------------------------------------
# * Version History :
#
#   Version 1 ---------------------------------------------------- (2007-11-27)
#------------------------------------------------------------------------------
# * Requirements :
#
#   Method & Class Library (2.2+)
#------------------------------------------------------------------------------
# * Description :
#
#   This script was designed to inflict a "Doom" state on battlers. After a
#   battler passes through x turns, doom will be cast and the battler will be
#   KO'd right away. States, Items & Skills may cast, and cure the Doom state.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place The Script Below the SDK and Above Main.
#------------------------------------------------------------------------------
# * Customization :
#
#   Doom Word when counting down
#    - Word_Countdown = 'word'
#   Doom Word when countdown finished
#    - Word_Finish = 'word'
#
#   Doom Inflicting States, Items & Skills
#    - Doom_Inflicting_States = {state_id => turns, ...}
#    - Doom_Inflicting_Items  = {item_id => turns, ...}
#    - Doom_Inflicting_Skills = {skill_id => turns, ...}
#
#    Forms of turns :
#     n          - Direct number of turns
#     min..max   - Random number between min and max
#     [min, max] - Random number between min and max
#
#   Doom Removing States, Items & Skills
#    - Doom_Removing_States = [state_id, ...]
#    - Doom_Removing_Items  = [item_id, ...]
#    - Doom_Removing_Skills = [skill_id, ...]
#------------------------------------------------------------------------------
# * Syntax :
#
#   Changing/Reading Doom Counter
#    - <game_battler>.doom_counter = nil or nil
#
#   Item, State or Skill Doom Settings
#    - <rpg::object>.adds_doom?
#    - <rpg::object>.removes_doom?
#    - <rpg::object>.doon_turns
#------------------------------------------------------------------------------
# * Terms & Conditions :
#
#   Free  - Non-Commercial Game
#   10 USD - Commercial License
#
#   This script is not to be modified or redistributed without the author's
#   consent.
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Doom States, Items & Skills', 'SephirothSpawn', 1.0, '2007-')
SDK.check_requirements(2.0, [], {'Method & Class Library' => 2.1})

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Doom States, Items & Skills')

#==============================================================================
# ** Doom
#==============================================================================

module Doom
  #--------------------------------------------------------------------------
  # * Doom Word
  #--------------------------------------------------------------------------
  Word_Countdown = 'Doom'
  Word_Finish = 'DOOM !'
  #--------------------------------------------------------------------------
  # * Doom Inflicting States, Items & Skills
  #
  #   Doom_Inflicting_States = {state_id => turns, ...}
  #   Doom_Inflicting_Items  = {item_id => turns, ...}
  #   Doom_Inflicting_Skills = {skill_id => turns, ...}
  #
  #   Forms of turns
  #
  #   n          - Direct number of turns
  #   min..max   - Random number between min and max
  #   [min, max] - Random number between min and max
  #--------------------------------------------------------------------------
  Doom_Inflicting_States = {}
  Doom_Inflicting_Items  = {}
  Doom_Inflicting_Skills = {}
  # State 17 - Random Number between 3 & 5
  Doom_Inflicting_States[17] = 3..5
  #--------------------------------------------------------------------------
  # * Doom Removing States, Items & Skills
  #
  #   Doom_Removing_States = [state_id, ...]
  #   Doom_Removing_Items  = [item_id, ...]
  #   Doom_Removing_Skills = [skill_id, ...]
  #--------------------------------------------------------------------------
  Doom_Removing_States = []
  Doom_Removing_Items = []
  Doom_Removing_Skills = []
end

#==============================================================================
# ** RPG::State
#==============================================================================

class RPG::State
  #--------------------------------------------------------------------------
  # * Adds Doom?
  #--------------------------------------------------------------------------
  def adds_doom?
    return Doom::Doom_Inflicting_States.has_key?(@id)
  end
  #--------------------------------------------------------------------------
  # * Removes Doom?
  #--------------------------------------------------------------------------
  def removes_doom?
    return Doom::Doom_Removing_States.include?(@id)
  end
  #--------------------------------------------------------------------------
  # * Doom Turns
  #--------------------------------------------------------------------------
  def doom_turns
    # Return 0 if Doesn't Add Doom
    return 0 unless adds_doom?
    # Gets Turn
    turn = Doom::Doom_Inflicting_States[@id]
    # Fix Turn
    turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
    # Return Turn
    return turn
  end
end

#==============================================================================
# ** RPG::Item
#==============================================================================

class RPG::Item
  #--------------------------------------------------------------------------
  # * Adds Doom?
  #--------------------------------------------------------------------------
  def adds_doom?
    return Doom::Doom_Inflicting_Items.has_key?(@id)
  end
  #--------------------------------------------------------------------------
  # * Removes Doom?
  #--------------------------------------------------------------------------
  def removes_doom?
    return Doom::Doom_Removing_Items.include?(@id)
  end
  #--------------------------------------------------------------------------
  # * Doom Turns
  #--------------------------------------------------------------------------
  def doom_turns
    # Return 0 if Doesn't Add Doom
    return 0 unless adds_doom?
    # Gets Turn
    turn = Doom::Doom_Inflicting_Items[@id]
    # Fix Turn
    turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
    # Return Turn
    return turn
  end
end

#==============================================================================
# ** RPG::Skills
#==============================================================================

class RPG::Skills
  #--------------------------------------------------------------------------
  # * Adds Doom?
  #--------------------------------------------------------------------------
  def adds_doom?
    return Doom::Doom_Inflicting_Skills.has_key?(@id)
  end
  #--------------------------------------------------------------------------
  # * Removes Doom?
  #--------------------------------------------------------------------------
  def removes_doom?
    return Doom::Doom_Removing_Skills.include?(@id)
  end
  #--------------------------------------------------------------------------
  # * Doom Turns
  #--------------------------------------------------------------------------
  def doom_turns
    # Return 0 if Doesn't Add Doom
    return 0 unless adds_doom?
    # Gets Turn
    turn = Doom::Doom_Inflicting_Skills[@id]
    # Fix Turn
    turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
    # Return Turn
    return turn
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :doom_counter
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_doomskill_gmbtlr_as, :add_state
  alias_method :seph_doomskill_gmbtlr_se, :skill_effect
  alias_method :seph_doomskill_gmbtlr_ie, :item_effect
  #--------------------------------------------------------------------------
  # * Add State
  #--------------------------------------------------------------------------
  def add_state(state_id, force = false)
    # Checks if state already included
    has_state = @states.include?(state_id)
    # Original Add State
    seph_doomskill_gmbtlr_as(state_id, force)
    # If state is now included and wasn't before
    if has_state == false && @states.include?(state_id)
      # Gets state data
      state = $data_states[state_id]
      # If Adds Doom
      if state.adds_doom?
        # Sets Doom Counter
        @doom_counter = (@doom_counter.nil? ? state.doom_turns : 
                        [@doom_counter, state.doom_turns].min)
      # If Removes Doom
      elsif state.removes_doom?
        # Clear Doom Counter
        @doom_counter = nil
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # Gets Original Result
    result = seph_doomskill_gmbtlr_se(user, skill)
    # If Effective
    if result
      # If Adds Doom
      if skill.adds_doom?
        # Sets Doom Counter
        @doom_counter = (@doom_counter.nil? ? skill.doom_turns : 
                        [@doom_counter, skill.doom_turns].min)
      # If Removes Doom
      elsif skill.removes_doom?
        # Clear Doom Counter
        @doom_counter = nil
      end
    end
    # Return Effective
    return result
  end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #--------------------------------------------------------------------------
  def item_effect(item)
    # Gets Original Result
    result = seph_doomskill_gmbtlr_ie(item)
    # If Effective
    if result
      # If Adds Doom
      if item.adds_doom?
        # Sets Doom Counter
        @doom_counter = (@doom_counter.nil? ? item.doom_turns : 
                        [@doom_counter, item.doom_turns].min)
      # If Removes Doom
      elsif item.removes_doom?
        # Clear Doom Counter
        @doom_counter = nil
      end
    end
    # Return Effective
    return result
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_doom_scnbtl_up4s2, :update_phase4_step2
  #--------------------------------------------------------------------------
  # * Frame Update : Phase 4 - Step 2
  #--------------------------------------------------------------------------
  def update_phase4_step2
    # If active battler has doom counter
    if @active_battler.doom_counter != nil
      # Decrease counter
      @active_battler.doom_counter -= 1
      # If counter finished
      if @active_battler.doom_counter < 0
        # Clear Doom Counter
        @active_battler.doom_counter = nil
        # Set Damage String
        @active_battler.damage = DoomStates::Word_Finish
        @active_battler.damage_pop = true
        # Subtract HP
        @active_battler.hp -= @active_battler.hp
        # Set Wait Count
        @wait_count = 8
        return
      end
      # Set Damage String
      w, n = DoomStates::Word_Countdown, @active_battler.doom_counter
      @active_battler.damage = "#{w} #{n}"
      @active_battler.damage_pop = true
      # Set Wait Count
      @wait_count = 8
    end
    # Original Update Phase 4 Step 2
    seph_doom_scnbtl_up4s2
  end
end

#------------------------------------------------------------------------------
# ** End SDK Enable Test
#------------------------------------------------------------------------------
end

So when you get state 17, and you want to it inflict death in 3 to 5 turns, you would just add:
Code:
  Doom_Inflicting_States[17] = 3..5
Under
Code:
  Doom_Inflicting_States = {}

I haven't looked at that script in months, so if it doesn't work, let me know.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top