The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: cozziekuns on May 23, 2010, 04:14:31 AM

Title: Element Imbuing States
Post by: cozziekuns on May 23, 2010, 04:14:31 AM
Element Imbuing States
Version: 1.0
Author: cozziekuns
Date: May 22, 2010

Version History



Planned Future Versions


Description


States that imbue elements, akin to those in Summon Night: Swordcraft Story 2.

Features


Instructions

See header.

Script


Code: [Select]
#===============================================================================
#
# Cozziekuns Element Imbuing States
# Last Date Updated: 5/22/2010
#
# States that imbue elements, akin to those in Summon Night: Swordcraft Story 2.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 05/22/10 - Created Script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# If you want a state that imbues the element with an ID of 11, then in that
# state, you would have to put a \element[11] in the respective states notebox.
#
# Element ID's can be found in the system tab in the database. Look for where it
# says "Element Names". For example, the element with an ID of 1 would be Melee,
# while the element with an ID of 11 would be electricity.
#
# Check the demo for a more detailed example.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozElemImbuStates"] = true

# No modules -.-

#==============================================================================
# ** RPG::State
#------------------------------------------------------------------------------
#  The superclass of all states.
#==============================================================================

class RPG::State
  #--------------------------------------------------------------------------
  # * Element to add
  #--------------------------------------------------------------------------
  def element_to_add
    @elements_to_add = []
    if self.note[/\\element\[(\d+)]/i] != nil
      @elements_to_add.push($1.to_i)
    end
  return @elements_to_add
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Normal Attack Element
  #--------------------------------------------------------------------------
  alias coz_eis_element_set element_set
  def element_set
    result = coz_eis_element_set
    for state in states
      result += state.element_to_add
    end
  return result
 end
end

Credit



Support


Just post below.

Known Compatibility Issues

None as of yet.

Demo


See attached.

Author's Notes


This is probably the smallest script I've ever come up with, yet it's the one I'm the most proud of. Weird, huh?

Restrictions

:ccby:
Title: Re: Element Imbuing States
Post by: modern algebra on May 23, 2010, 01:17:31 PM
Very nice and efficient script. Good job.