{RPGMXP} Create a state which protects you from a certain type of attack
#1
This should be easy but from some reason I can't seem to get it work,
I want my enemy to have a shield which stops all ballistic attacks
since the player normal attacks are with guns it would make the player
change to energy weapons or physical attacks so I made a Element called
Ballistics gave it to all my guns

[Image: ballistics.jpg]
then I created a state which raises the users MDEF and PDEF to 200% and Element defense Ballistics
[Image: ballistics2.jpg]
yet
when I attack the enemy with guns he still takes damage not much but
some and the physical and energy weapons are also affected by the shield
I would prefer for them to not be affected
here is a copy of my game if you think it might help thanks in advance
http://www.filedropper.com/systemshockrpgmaker110215_1
Reply }
#2
The game mechanics of the "Elemental Defense" will only reduce the damage by 1/2 with states. So, if you want to make that the "Elemental Defense" will nullify the damage, you will have to change the base script, or your CBS script if you are using one. The base script is in the "Game_Actor" script, and is located on lines 123-127. You should be able to change the result to "nil" or just 0. I'm not a programmer, I just experiment with things and see if they work ;). I hope this helps.
Habs11
Reply }
#3
what happens when you turn it to 900%? i use elements for different attacks, but have never tried to change it mid battle like that.
Reply }
#4
You can use bearcat's Absorb, Null, and Weak Armors script. Despite the name, it can also create states that absorb and nullify elements.

Code:
=begin
#=============================================================================
#  Absorb, Null, and Weak Armors
#=============================================================================
# Bearcat
# Version 1.01
# 8.16.07
#=============================================================================
This script allows you to make armors and states that absorb, nullify, or
make the wearer weak to elemental damage. To set up an an armor or state,
put the armor id and the element id in the appropriate hash in Absorb_Setup.

There is no need to modify anything other than the hashes in Absorb_Setup.

Free use, modification, and distribution permitted (commercial projects
included) so long as credit is given to me, Bearcat.
==============================================================================
=end
module Absorb_Setup
  #--------------------------------------------------------------------------
  # * Absorb Armors
  #   syntax armor_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Absorb_Armors = {
  33 => [1]
  }
  #--------------------------------------------------------------------------
  # * Null Armors
  #   syntax armor_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Null_Armors = {
  33 => [2]
  }
  #--------------------------------------------------------------------------
  # * Weak Armors
  #   syntax armor_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Weak_Armors = {
  33 => [3]
  }
  #--------------------------------------------------------------------------
  # * Absorb States
  #   syntax state_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Absorb_States = {
  17 => [1]
  }
  #--------------------------------------------------------------------------
  # * Null States
  #   syntax state_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Null_States = {
  17 => [2]
  }
  #--------------------------------------------------------------------------
  # * Weak States
  #   syntax state_id => [element1, element2...]
  #--------------------------------------------------------------------------
  Weak_States = {
  17 => [3]
  }
  #--------------------------------------------------------------------------
  # * Defaults DO NOT CHANGE
  #--------------------------------------------------------------------------
  Absorb_Armors.default = []
  Null_Armors.default = []
  Weak_Armors.default = []
  Absorb_States.default = []
  Null_States.default = []
  Weak_States.default = []
end

These two scripts are also necessary.

Code:
class Game_Actor
  def element_rate(element_id)
    absorb_flag = false
    # Get values corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_classes[@class_id].element_ranks[element_id]]
    # Run Armor Stuff
    for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
      armor = $data_armors[i]
      # Halve damage if element is protected
      if armor != nil and armor.guard_element_set.include?(element_id)
        result /= 2
      end
      # Damage = 0 if element is nulled
      if armor != nil and armor.null_element_set.include?(element_id)
        result = 0
      end
      # Set flag to true if element is absorbed
      if armor != nil and armor.absorb_element_set.include?(element_id)
        absorb_flag = true
      end
      # Multiply damage if armor is weak to element
      if armor != nil and armor.weak_element_set.include?(element_id)
          result *= 2
      end
    end
    # Run State Stuff
    for i in @states
      # Halve damage if element is protected
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
      # Damage = 0 if element is nulled
      if $data_states[i].null_element_set.include?(element_id)
        result = 0
      end
      # Set flag to true if element is absorbed
      if $data_states[i].absorb_element_set.include?(element_id)
        absorb_flag = true
      end
      # Multiply damage if state is weak to element
      if $data_states[i].weak_element_set.include?(element_id)
        result *= 2
      end
    end
    # If absorb_flag = true, multiply by -1
    if absorb_flag
      result *= -1
    end
  # End Method
  return result
  end
end

class Game_Enemy
  def element_rate(element_id)
    # Get a numerical value corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
    for i in @states
      # Halve damage if element is protected
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
      # Damage = 0 if element is nulled
      if $data_states[i].null_element_set.include?(element_id)
        result = 0
      end
      # Set flag to true if element is absorbed
      if $data_states[i].absorb_element_set.include?(element_id)
        absorb_flag = true
      end
      # Multiply damage if state is weak to element
      if $data_states[i].weak_element_set.include?(element_id)
        result *= 2
      end
    end
    # If absorb_flag = true, multiply by -1
    if absorb_flag
      result *= -1
    end
    # End Method
    return result
  end
end

Code:
module RPG
class Armor
#------------------------------------------------------------------------------
# * Absorb Elements
#------------------------------------------------------------------------------
  def absorb_element_set
    return Absorb_Setup::Absorb_Armors[id]
  end
#------------------------------------------------------------------------------
# * Null Elements
#------------------------------------------------------------------------------
  def null_element_set
    return Absorb_Setup::Null_Armors[id]
  end
#------------------------------------------------------------------------------
# * Weak Elements
#------------------------------------------------------------------------------
  def weak_element_set
    return Absorb_Setup::Weak_Armors[id]
  end
end

class State
#------------------------------------------------------------------------------
# * Absorb Elements
#------------------------------------------------------------------------------
  def absorb_element_set
    return Absorb_Setup::Absorb_States[id]
  end
#------------------------------------------------------------------------------
# * Null Elements
#------------------------------------------------------------------------------
  def null_element_set
    return Absorb_Setup::Null_States[id]
  end
#------------------------------------------------------------------------------
# * Weak Elements
#------------------------------------------------------------------------------
  def weak_element_set
    return Absorb_Setup::Weak_States[id]
  end
end
end
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can a "leech seed" state be done? Samven 5 10,991 01-03-2013, 06:42 PM
Last Post: Iqus
  RPGMXP - Issue with variables (that most likely can be solved using scripts) DPhoenix29 4 9,998 01-23-2012, 06:06 AM
Last Post: DPhoenix29



Users browsing this thread: 1 Guest(s)