=begin
==============================================================================
** EST - RACE TRAITS AND FEATURE
------------------------------------------------------------------------------
Author : ESTRIOLE
Usage Level : Easy
licences:
Free to use in all project (except the one containing pornography)
as long as i credited (ESTRIOLE).
also credits to FORMAR since i use his extra trait lv up as guide.
modification for your own usage is permitted just don't claim this is yours
just add below the author: Modded by : ....
Version History:
v 1.0 - 2012.10.06 > - finish the script
------------------------------------------------------------------------------
This script assign traits to actors based on what race the actor is. actor
race assigned using notetags. and the traits added is using armors as reference
in the database.
------------------------------------------------------------------------------
How to use:
1) set your race in the configuration part below
a) set the name
set the armor id that it reference as trait adder. you could also assign
multiple armor since i made it arrays in case you have mixed race. ex:
hercules is half god half human. he gain both human and god trait.
2) create the armor that you assign as race trait and give it traits (ex:maxhp +100%,etc)
3) give tags to your actors
<race: x>
x is the race name you defined in the configuration (not case sensitive)
Future Development
Currently this only support traits. not attack/def/agi modifier. maybe if lots
of people want it i could try making it.
Author Notes
none
=end
module ESTRIOLE
######## RACE CONFIGURATION PART ######################################
RACE = { # DO NOT TOUCH THIS LINE
1 => {
NAME: "HUMAN", #this used in notetags: <race: human>
ARMOR_ID: [1] #array of armor id to add starting feature
}, #remember the , people tend to forget this
2 => {
NAME: "ELF",
ARMOR_ID: [2]
},
3 => {
NAME: "DWARF",
ARMOR_ID: [3,4]
},
4 => {
NAME: "DEMON",
ARMOR_ID: [5]
},
5 => {
NAME: "HALF_ELF", #no spaces allowed if name have two words <race: half_elf>
ARMOR_ID: [1,2]
},
}# DO NOT TOUCH THIS LINE
####### END RACE CONFIGURATION PART ###################################
RACE_TAG = /<(?:RACE|TRIBE):\s*(\w+)>/i
# RACE_TAG = /<race:[ ]*(\w+.)>/
end
#load notetags part
class RPG::Actor < RPG::BaseItem
attr_accessor :race
def load_notetags_race
@race = nil
self.note.split(/[\r\n]+/).each { |line|
case line
when ESTRIOLE::RACE_TAG
@race = $1
end
} #end note split
end
end
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_est_race1234 load_database; end
def self.load_database
load_database_est_race1234
load_notetags_est_race_333
end
#--------------------------------------------------------------------------
# new method: load_notetags_armpos
#--------------------------------------------------------------------------
def self.load_notetags_est_race_333
for obj in $data_actors
next if obj.nil?
obj.load_notetags_race
end
puts "Read: actor race Notetags"
end
end # DataManager
class Game_Actor < Game_Battler
alias est_race_feature_setup setup
def setup(actor_id)
@race_features = Race_Features.new
@race_features.features = []
set_race_features(actor_id) if $data_actors[actor_id].race != nil
est_race_feature_setup(actor_id)
end
def get_armor_race(id)
for i in 1..ESTRIOLE::RACE.size
actor_race = $data_actors[id].race
check = /#{actor_race}/i.match(ESTRIOLE::RACE[i][:NAME])
return ESTRIOLE::RACE[i][:ARMOR_ID] if check
end
return nil
end
def set_race_features(id)
armor_ref = get_armor_race(id)
if armor_ref!=nil
for i in 0..armor_ref.size-1
@race_features.features += $data_armors[armor_ref[i].to_i].features
end
end
end
alias est_feature_objects feature_objects
def feature_objects
est_feature_objects + [@race_features]
end
end
class Race_Features
attr_accessor :features
end