Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Enemy Elements, Allows enemies to have elements changing their stats.
Thallion
post Nov 14 2012, 01:28 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 68
Type: Scripter
RM Skill: Skilled
Rev Points: 10




Enemy Elements
Authors: ThallionDarkshine
Version: 0.1
Type: Enemy Stat Add-on
Key Term: Enemy Add-on


Introduction

This script adds some variety to your random battles. You can define different "elements" for enemies, each of which can change different stats such as MaxHP, MaxSP, Strength, Dexterity, and many more. Then, you can give each enemy a different set of possible "elements" that the script will randomly choose from to apply. Thus, you could make weaker enemies with the "element" of minion, as I did in the script.

Features


Spices up random battles.
You don't have to give any enemy an "element" if you don't want to.
Use an unlimited number of "elements".
Use combinations of elements.


Screenshots

You can't really capture stat changes in a screenshot.

Demo

None as of yet.

Script

Script
CODE
class Game_Enemy
  ELEMENTS = {
    :minion => [[:maxhp, -50], [:atk, -25], [:maxsp, -63], [:exp, -50], [:gold, -50]],
    :brute => [[:maxhp, 12], [:atk, 3], [:maxsp, -21], [:exp, 4], [:gold, 4], [:dex, -9], [:agi, -8], [:mdef, -14]],
  }
  
  def self.elements(id)
    return case id
           when 0 then []
           else []
           end
  end

  alias tdks_elmnt_init initialize
  def initialize(troop_id, member_index)
    tdks_elmnt_init(troop_id, member_index)
    elements = Game_Enemy.elements(@enemy_id)
    @elements = elements.length > 0 ? elements[rand(elements.length)] : nil
    @atk_mod=@pdef_mod=@mdef_mod=@str_mod=@dex_mod=@agi_mod=@int_mod=@maxhp_mod
=@maxsp_mod=@eva_mod=@exp_mod=@gold_mod=100
    @elements.each{|element|Game_Enemy::ELEMENTS[element].each{|i|instance_variable_set("@#{i[0]}_mod",i[1]+instance_variable_get("@#{i[0]}_mod"))}if Game_Enemy::ELEMENTS.keys.include?(element)}if @elements
    @hp = maxhp
    @sp = maxsp
  end
  
  def base_maxhp
    return $data_enemies[@enemy_id].maxhp * @maxhp_mod / 100
  end
  
  def base_maxsp
    return $data_enemies[@enemy_id].maxsp * @maxsp_mod / 100
  end
  
  def base_str
    return $data_enemies[@enemy_id].str * @str_mod / 100
  end
  
  def base_dex
    return $data_enemies[@enemy_id].dex * @dex_mod / 100
  end
  
  def base_agi
    return $data_enemies[@enemy_id].agi * @agi_mod / 100
  end
  
  def base_int
    return $data_enemies[@enemy_id].int * @int_mod / 100
  end
  
  def base_atk
    return $data_enemies[@enemy_id].atk * @atk_mod / 100
  end
  
  def base_pdef
    return $data_enemies[@enemy_id].pdef * @pdef_mod / 100
  end
  
  def base_mdef
    return $data_enemies[@enemy_id].mdef * @mdef_mod / 100
  end
  
  def base_eva
    return $data_enemies[@enemy_id].eva * @eva_mod / 100
  end
  
  def exp
    return $data_enemies[@enemy_id].exp * @exp_mod / 100
  end
  
  def gold
    return $data_enemies[@enemy_id].gold * @gold_mod / 100
  end
end


Instructions

To configure the script, go to the line 2.
Add any elements you want into the hash, using the format:
CODE
ELEMENT_NAME_AS_SYMBOL (that means it starts with ":") => [[STAT_NAME_AS_SYMBOL, PERCENT_CHANGE], [STAT_NAME_AS_SYMBOL, PERCENT_CHANGE]]

The different stats you can change are:
MaxHP -
CODE
:maxhp

MaxSP -
CODE
:maxsp

Strength -
CODE
:str

Dexterity -
CODE
:dex

Agility -
CODE
:agi

Intelligence -
CODE
:int

Attack -
CODE
:atk

Physical Defense -
CODE
:pdef

Magic Defence -
CODE
:mdef

Evasion -
CODE
:eva

Experience -
CODE
:exp

Gold Drop -
CODE
:gold


To make different enemies have a possibility of having different elements, go to line 7 of the script.
Add this to add a new enemy that has elements:
CODE
when ENEMY_ID then [[ELEMENT1_SET1, ELEMENT2_SET1], [ELEMENT1_SET2, ELEMENT2_SET2, ELEMENT2_SET3]]

Add as many element sets and elements as you want.

Compatibility

Probably compatible with everything except maybe enemy leveling scripts.

Credits and Thanks


ThallionDarkshine


Author's Notes

Nothing
--------------------------------------------------------------------------------

This post has been edited by Thallion: Nov 14 2012, 01:51 PM
Go to the top of the page
 
+Quote Post
   

Posts in this topic


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: 21st May 2013 - 06:41 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker