Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Night_Runner's State Altering Elemental Efficiencies, As requested by lohenien
Night_Runner
post Oct 28 2011, 07:11 AM
Post #1


Level 50
Group Icon

Group: +Gold Member
Posts: 1,528
Type: Scripter
RM Skill: Undisclosed




Night_Runner's State Altering Elemental Efficiencies

Version 1.0
Author Night_Runner
Release Date 29/Oct/2011


Exclusive Script at RPG RPG Revolution


Introduction
This script allows character states to alter their elemental effectiveness.


Script
CODE
#==============================================================================
# ** VX: Night_Runner's State Altering Elemental Efficiencies
#------------------------------------------------------------------------------
# History:
#  Date Created: 29/Oct/2011
#  Created for: lohenien
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=53698
#
# Description:
#  This script allows character states to alter their elemental effectiveness.
#
# How to Install:
#  Copy this entire script. In your game's editor, select Tools >>
#  Script Editor. Along the left hand side scroll all the way to the
#  bottom, right click on the square after ( Insert here ), and select
#  "Insert". Paste the code on the right.
#
# How to Use:
#  In the State's Note box, insert something similar to:
#          [ElementEff:"Fire"+=10]
#  Where the element being changed is Fire for the character, and the +=10
#  means that the character's fire efficiency gets altered by 10 positions,
#  where one position is the difference between state A efficiency and
#  state B efficiency.
#  
#==============================================================================



#==============================================================================
# ** NR_ElementEfficiencyByState
#------------------------------------------------------------------------------
#  This module contains the code to get the state's contribution to element
#  efficiency.
#==============================================================================

module NR_ElementEfficiencyByState
  #--------------------------------------------------------------------------
  # * State's Contribution to Element Rate
  #--------------------------------------------------------------------------
  def state_element_rate(element_id)
    # Make a variable for the changes to the state
    @rate_changes = 0
    # Keep a string fo the name of the elmeent
    element_name = $data_system.elements[element_id]
    # Loop throug every state
    for state_id in @states
      state = $data_states[state_id]
      # If the state has a note
      for command in state.note.split("\n")
        if command =~ /\[ElementEff:\"(.*)\"(.*)\]/
          # If this element is the same as the one in the note
          if element_name == $1
            # If the change is to force set the state
            @a, @b = 2, 100; eval("@a"+$2); eval("@b"+$2)
            if @a == @b
              # Then force the value
              return @a - nr_elemEffStates_element_rate(state_id)
            end
            # Apply the changes set in the note
            eval("@rate_changes" + $2)
          end
        end
      end
    end
    # Get the final rate
    return @rate_changes * 50
  end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  Edited to include state incudes element efficiencies.
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Include Modules
  #--------------------------------------------------------------------------
  include NR_ElementEfficiencyByState
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_elemEffStates_element_rate  element_rate  unless $@
  #--------------------------------------------------------------------------
  # * Element Rate
  #--------------------------------------------------------------------------
  def element_rate(*args)
    return nr_elemEffStates_element_rate(*args) + state_element_rate(*args)
  end
end



#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  Edited to include state incudes element efficiencies.
#==============================================================================

class Game_Enemy
  #--------------------------------------------------------------------------
  # * Include Modules
  #--------------------------------------------------------------------------
  include NR_ElementEfficiencyByState
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_elemEffStates_element_rate  element_rate  unless $@
  #--------------------------------------------------------------------------
  # * Element Rate
  #--------------------------------------------------------------------------
  def element_rate(*args)
    return nr_elemEffStates_element_rate(*args) + state_element_rate(*args)
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================



Customization
In the State's Note box, insert something similar to:
CODE
[ElementEff:"Fire"+=10]

Where the element being changed is Fire for the character, and the +=10 means that the character's fire efficiency gets altered by 10 positions, where one position is the difference between state A efficiency and state B efficiency.
Img

Note that Efficiency 1 means A, and Efficiency 6 means F, so if you try and alter it by 10, you will get results similar to that in the screenshot.


Compatibility
Should be compatible with any other script, although if you were to try and force a efficiency ( e.g. [ElementEff:"Water"=1] ) then it may not work perfectly if there are conflicting scripts that alter the efficiency placed after this script.


Screenshot
Img


Update:
Added more pictures to give a clearer indication of how this works.
In this example we have a skill, "SplashOil", which induces the state "Covered in Oil", which is what causes the elemental efficiency alteration.
So firstly, make the state with the Note that states the alteration to the efficienty


Then the skill which induces the state:


And give the skill to the hero, or enemy, but I'm showing a hero here


And some happy pictures that show that the hero can also deal massive damage!

Before:


Inducing the state


Altered Damage
http://1dl.us/q6w.png



DEMO
N/A


Installation
CODE
Copy this entire script. In your game's editor, select Tools >>
Script Editor. Along the left hand side scroll all the way to the
bottom, right click on the square after ( Insert here ), and select
"Insert". Paste the code on the right.

I've also updated the screenshot section above, it shows how to set up the skills & states smile.gif

FAQ
The enemy HP window was from the two scripts posted here


Terms and Conditions
Use as you see fit.


Credits
lohenien for the request
myself for coding it.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
lohenien
post Oct 29 2011, 04:01 PM
Post #2


Level 3
Group Icon

Group: Member
Posts: 40
Type: Writer
RM Skill: Beginner




Added the script and tried testing it out. [ElementEff:"Fire"+=50] [ElementEff:"Fire"+=10] [ElementEff:"Fire"=2] [ElementEff:"Fire"==2] all had no effect on damage taken from a 55 damage (no variance) fire attack for PCs as well as NPCs.

Am I missing something?
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Oct 31 2011, 03:55 AM
Post #3


Level 50
Group Icon

Group: +Gold Member
Posts: 1,528
Type: Scripter
RM Skill: Undisclosed




I hope so, for the sake of my sanity smile.gif

I've updated the Screenshot section, it should a lot more detail in the explanation of how to set up the script, I've tested and ( for me at least ) it works, on both PC's and NPC's.

Let me know if that helps.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
lohenien
post Oct 31 2011, 07:20 AM
Post #4


Level 3
Group Icon

Group: Member
Posts: 40
Type: Writer
RM Skill: Beginner




QUOTE (Night_Runner @ Oct 31 2011, 07:55 AM) *
I hope so, for the sake of my sanity smile.gif

I've updated the Screenshot section, it should a lot more detail in the explanation of how to set up the script, I've tested and ( for me at least ) it works, on both PC's and NPC's.

Let me know if that helps.


I copied the script a second time and now it works. New question : how do I set specific efficiencies such as absorbing ? Would I simply do -200 or something ?

Ok -10 works for making absorb effects, but I also tried [elementeff:"fire"=6] and that caused the game to crash because it could not convert nil to integer.

New problem : Some times entities start absorbing a given element after a vulnerability effect is applied. I have no idea why that could even be possible.

NR - Please don't double post

This post has been edited by Night_Runner: Nov 1 2011, 08:05 PM
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 08:39 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker