RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Element Efficiency States

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Element Efficiency States
Version: 1.0b
Author: modern algebra
Date: August 20, 2010

Version History


  • <Version 1.0b> 08.20.2010 - fixed a bug when it applied to enemies.
  • <Version 1.0> 05.15.2010 - Original Release

Description


By default, a state can only be setup to halve the damage done by an elemental attack of any nature. This script allows you to create states which can modify the damage done by any percentage you choose. Want to create a state which completely nullifies all damage from a fire attack? This script can do that. Want to create a state which makes attacks from a particular element heal instead of damage? That can be done too.

Features

  • Allows you to make states that have more profound effects on the efficiency of elemental attacks; for instance you can make states that will convert damage from an element to healing.
  • Easy configuration

Instructions

Paste this script into its own slot in the Script Editor (F11) somewhere above Main but below Materials. Please see the header of the script for details on configuring the script.

Script


Code: [Select]
#==============================================================================
#    Element Efficiency States
#    Version: 1.0b
#    Author: modern algebra (rmrk.net)
#    Date: August 20, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    By default, a state can only be setup to halve the damage done by an
#   elemental attack of any nature. This script allows you to create states
#   which can modify the damage done by any percentage you choose. Want to
#   create a state which completely nullifies all damage from a fire attack?
#   This script can do that. Want to create a state which makes attacks from
#   a particular element heal instead of damage? That can be done too.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot in the Script Editor (F11) somewhere
#   above Main but below Materials.
#
#    To set a state to have a particular element efficiency, you have to use
#   the following code in a note box:
#      \ELEMENT_EFFICIENCY[element_id, element_efficiency]
#        element_id         : the ID of the element to modify damage from
#        element_efficiency : the efficiency of the element when this state is
#          applied. This can be either A-F (corresponding to the normal table
#          for element efficiencies), or you can set it as a direct percentage
#          by putting an integer there for the total percentage (100 = 1xdamage;
#          200 = 2x damage; etc...)
#   You can put as many of these codes in the notebox of the same state.
#
#  EXAMPLE:
#    \element_efficiency[9, E]
#    \ELEMENT_EfficIENCY[10, 250]
#
#    A state with that in the notebox, when applied, would make the battler
#   immune to element 9 attacks (Fire), but element 10 attacks (Ice) would do
#   2.5x damage.
#==============================================================================
# ** RPG::State
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - ees_element_efficiency
#==============================================================================

class RPG::State
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Element Efficiency
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ees_element_efficiency
    if !@ees_element_efficiency
      @ees_element_efficiency = {}
      @ees_element_efficiency.default = 100
      note.gsub (/\\ELEMENT_EFFICIENCY\[(\d+),\s*([A-F]?)(-?\d*)\]/i) {
        if $2.empty?
          @ees_element_efficiency[$1.to_i] = $3.to_i
        else
          rank = ["A", "B", "C", "D", "E", "F"].index ($2.to_s.upcase)
          @ees_element_efficiency[$1.to_i] = [200,150,100,50,0,-100][rank]
        end
      }
    end
    return @ees_element_efficiency
  end
end

#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - element_rate
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Element Efficiency
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mod_mord_ees_elrte_6yh2 element_rate
  def element_rate (element_id, *args)
    rate = mod_mord_ees_elrte_6yh2 (element_id, *args) # Run Original Method
    for state in states
      rate *= -1 if state.ees_element_efficiency[element_id] < 0 && rate < 0
      rate *= (state.ees_element_efficiency[element_id].to_f / 100.0)
    end
    return rate.to_i
  end
end

#==============================================================================
# ** Game Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - element_rate
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Element Efficiency
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrn_con_ees_mentr_4wc2 element_rate
  def element_rate (element_id, *args)
    rate = modrn_con_ees_mentr_4wc2 (element_id, *args)
    for state in states
      rate *= -1 if state.ees_element_efficiency[element_id] < 0 && rate < 0
      rate *= (state.ees_element_efficiency[element_id].to_f / 100.0)
    end
    return rate.to_i
  end
end

Credit


  • modern algebra

Thanks

  • mordicon, for the request

Support


Please post in this topic at RMRK.net for support.

Known Compatibility Issues

No currently known compatibility problems.
« Last Edit: August 21, 2010, 03:54:28 AM by modern algebra »

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
This script wins.

Always wondered how to do that.

**
Rep: +0/-0Level 81
RMRK Junior
SWEET!

I figured out a very long handed way of doing this by copying the classes and making an identical one but changing the classes elemental efficiency to absorb.. yada yada... took forever, like doing long division  >:(

This is WAY better.

TY!  ;D ;D

****
Rep:
Level 83
Awesome script modern.
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 75
RMRK Junior
error message
Spoiler for:

these were the conditions, and i used your script unedited :(

Spoiler for:
Spoiler for:

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Thanks for catching that bug. I updated the script and the new version should work.

****
Rep:
Level 76
Praise the Sun (Arcana)
GIAW 14: 1st Place (Hard Mode)
Do you think there is a way to pretty much do the inverse of this script? Such as when you have a weapon that doesn't do much Ice damage to an enemy with a weakness to Ice, drink a potion that puts a state on you or your party member that rather than increase their resistance, but increase the damage they'll do with the element?

At the moment I made a boss fight where the best way to kill it was to gather oil buckets scattered around a mine outside of town and then head back to the boss. Then you'd throw the buckets onto the enemy and cause it to gain a lowered resistance to fire, then of course you'd spam. But I want to save something that complex for a later boss, (DONT STEAL MY IDEA PLEASE XD) what I'd like to do is get Fire Balm from a merchant and consuming it would increase your elemental damage with fire.

Any luck with doing that? Or should I stick with my Advanced Strategy Guide-ish technique.

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Excellent work.
:tinysmile:

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
@hiro - it wouldn't be overly hard, but the default script doesn't really allow for degrees of element. Either a weapon has it or it doesn't, and it calculates damage based solely on the resistances the enemy has to the respective element. To logically add in a factor like that, it might be prudent to also look at how you want the elements to interplay and whether damage should be divided. Would it simply be a priority system? IE the highest element is the one used to calculate the damage? Or would it be divided, like for instance if a skill would normally do 300 damage and has three elements attached. Would each element modify 100 damage and then add all of them together for the final result?

So, it would require some modification of basic damage formulas, but it probably wouldn't be hard; however, it's not something I want to do at the moment as I am busy with other things.

****
Rep:
Level 76
Praise the Sun (Arcana)
GIAW 14: 1st Place (Hard Mode)
@ robo - Oh, I wasn't requesting the script, what you said was exactly what I wanted to hear. My brother could help me there. But thanks a lot for the script, and all others. :)