Prexus' Scripts

Here is a bunch of my scripts that may have been missing. Not everything is there because I don't have copies of everything, but there are still a few things i'll be uploading soon.

Action Battle System (SDK Required)

Battle system like Zelda, on map. This one is limited to four directions, and automatically targets the closest monster when casting spells. Use the A S and D keys to set Hotkeys in the Skill menu, and press Shift to attack.

Known Issues: Some people experienced lag in the demo in the forest area, this has yet to occur for me and in any other area of any other game. My prognosis, freak accident.

Battle Domain Effects (SDK Required)

Creates effects on Maps, and in Battle, that simulate certain atmospheric conditions. Such as overwhelming heat (damage over time on maps, increased fire damage in battle), Underwater (fire damage has no effect, water damage amplified), Magic Barrier (Offensive magic has no effect), Blessed (Cure over time and heal all status ailments on map).

There are a host of default domain effects, and instructions on how to create others in the script.

Class Job System (Non-SDK)

Applies two types of Job to each character, a Job and a Sub-Job. Read the instructions/demo to see how to set this up. This allows for say a Mage class to specialize in Fire/Water/Earth/Air, or a Swordsman to specialize in defensive techniques, physical techniques, magical techniques, etc.

It also includes an EXP report at the end of battle. Made to reflect the experience gain in character level, job level, and sub-job level.

PrexCraft (SDK and Non-SDK) NEW!!

Customize recipes and quick concoctions with this Crafting script. Allows for multiple components and has a quick and easy built-in interface.

PX Module (Non-SDK)

Three scripts in one, a Party Changer, an Inn, and a Beastiary. Each seperate (you can remove/add them at will). Instructions can be seen in the demo.

Note: Never remove the main PX Module or no scripts will work.

Sketch (Non-SDK)

Made to mimic Relm's Sketch ability from Final Fantasy 6. Its not completely accurate, instead of pulling abilities from a specific list it just picks on of the monster's abilities at random and uses it. Great for adding dynamics to battles.

Note: Change the Sketch skill at the top of the script ($SKETCH_ID = 81)

Sketch v1.1 (Non-SDK)

Changes in v1.1:
  • Changed the $SKETCH_ID variable into a module variable.
  • Added NO_SKETCH array, this array contains the IDs of skills that can't be sketched.

Note: Change the Sketch skill at the top of the script (SKETCH_ID = 81)
Change the NO_SKETCH array to include variables of skills that can't be sketched.

World Objects (SDK Required)

Adds any number of skills to the game to reflect out-of-combat skills, such as Gathering and Fishing. Works great with Axe Man Deke's Combination script. Skills level up, but there is no where to see what skill level your character is at. This'll be updated sooner or later.

World Objects Version 2.0 (Non-SDK)

An upgrade on my World Objects script.

New Features Include:
  • A window which reflects skill data.
  • Randomly spawning nodes (specific densities)
  • Multiple item results/chances/types
  • Easy setup using event comments.

Note: Anyone is welcome to use these scripts, but be sure to credit me.
Action Battle System

Battle system like Zelda, on map. This one is limited to four directions, and automatically targets the closest monster when casting spells. Use the A S and D keys to set Hotkeys in the Skill menu, and press Shift to attack.

Demo
Click Here

Screenshots
Screenshot 1 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot1.png[/img]

Screenshot 2 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot2.png[/img]

Screenshot 3 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot3.png[/img]


The Script

[spoiler][code]=begin

--------------------------------------------------------------------------------
Prexus ABS build 1.0.2
********REQUIRES RMXP SDK TO WORK********
* Instructions
--------------------------------------------------------------------------------

Topics:
- Default Controls [ABS.DC]
- How to Setup an Enemy [ABS.SE]
- Setting Up Skill Ranges [ABS.SR]
- Setting Up ABS Options [ABS.AO]
- ABS Changes in Run Time [ABS.RT]
- ABS Graphics [ABS.AG]
- Animation Engine [ABS.AE]

--------------------------------------------------------------------------------
* Default Controls: [ABS.DC]
ex:
Action | Input | Default Key
--------------------------------------------------------------------------------

Melee Attack | Input::A | Shift, Z
Hotkey 1 | Input::X | A
Hotkey 2 | Input::Y | S
Hotkey 3 | Input::Z | D
Guard/Defend | Input::L | Q
Show HUD | Input::R | W

--------------------------------------------------------------------------------
* How to Setup an Enemy: [ABS.SE]
ex:
Comment: ABS Setup
Comment: Name Ghost
Comment: Troop GhostSquadA
Comment: Trigger Erase
--------------------------------------------------------------------------------

To set up an enemy to work with the ABS, you must add comments to the event.

The first comment must read 'ABS Setup' so that the ABS detects the enemy.

The second comment is used to reference the event to an enemy in the database,
you set it up by putting 'Name ' followed by the name of an enemy in the database.
If you put the name of an enemy that doesn't exist, it register the enemy in the
ABS so be sure to pick a valid enemy.

The third comment is unique to Prexus' ABS. If two or more enemies share the same
Troop, they will interact as a team. That means they will heal each other and if
one enemy becomes engaged, the second will as well. You set it up by putting
'Troop ' followed by the name of the troop. It can be any string variable. If you
put nothing, and leave it as 'Troop ' it will assign a unique troop. Meaning the
enemy will not call any allies or heal anyone else but itself.

The fourth comment defines how the enemy will die. There are four options,
Erase, Switch, Local, and Chest. Each has unique properties as to how the death
of the enemy is handled.
Erase: Erase will simply make the event dissapear. It'll reappear next time you
load the map, making this a quick and clean way to dispose of enemies.
Switch: Switch will trigger a switch, choosen by putting an ID after the word
switch. Such as 'Trigger Switch 2'. You will probably want to add a
second page to the event with the switch as a precondition or else this
will cause the game to act wonky. This is good for handling Boss monsters
or any enemy which triggers an event or that you don't want to reappear.
Local: Local will trigger a Local Switch (or Self Switch). You choose this by
putting either A, B, C, or D after the word Local. Such as 'Trigger
Local A'. This is good because it doesn't use up switches. I've also
made it so when you leave a map, whatever switch was picked will
automagically turn off so the enemy will reappear next time you load the
map. Neat huh?
Chest: This is used in the ABS demo game, Umbral Wake, often. It works similar
to Local. You don't have to put anything after Chest, it'll automatically
turn on SelfSwitch A. However when you leave the map and return, it'll
turn off all of the SelfSwitches (A, B, C and D) regardless. The best
examples of the use of this is in Umbral Wake so refer to it for example.

Thats all that is necessary to set up an event. Refer to Umbral Wake for examples.

--------------------------------------------------------------------------------
* Setting up Skill Ranges [ABS.SR]
ex.
when "Cross Cut"
@range = 2
--------------------------------------------------------------------------------

Another unique feature to Prexus' ABS is Spell Ranges. Unlike Near's ABS, when
casting a spell you aren't required to aim it and make sure that a ranged object
hits the target.

In Prexus' ABS, when you cast a spell, it automatically finds all enemies within
the range of the spell (in tiles) and chooses the best subject to hit based on
the type of spell.

All you have to do to set up a skill range is go to the 'Prexus ABS (User)' script
and add the lines of code as seen in the instructions available there.

--------------------------------------------------------------------------------
* Setting up ABS Options [ABS.AO]
ex.
@p_animations = true
@e_animations = false
@portrait = false
--------------------------------------------------------------------------------

Prexus' ABS comes with a built in Animation Engine. Whats that? Well, it handles
animating the player's character graphic to do certain things. By default, it
handles Attacking (swinging the sword), Casting, and being Hit.

If you don't want that feature for the player, you set @p_animations to false.
If you don't want the feature for the enemies, you set @e_animations to false.

Also, the HUD will display a portrait of your character. This is a small picture
depicting your character's likeness. If you don't wish to have it show that, and
instead want to show the character's characterset graphic, you simply change
@portrait to false.

The portraits are found by the ABS in the folder ..\Graphics\ABS\portraits\ and
must share the same name as the Actor (Such as Aluxes.png for Aluxes).

--------------------------------------------------------------------------------
* ABS Changes in Run Time [ABS.RT]
--------------------------------------------------------------------------------

During runtime you can enable and disable the ABS. This is good for town areas
and world maps.
To do this use the Call Script event function and put either:

$ABS.enable
or
$ABS.disable

I suggest putting the Call Script after everything else if being used in a map
changing event. See Umbral Wake for better examples.

--------------------------------------------------------------------------------
* ABS Graphics [ABS.AG]
--------------------------------------------------------------------------------

The ABS has only one required graphic for the HUD. It has to be called 'Background'
and needs to be in the directory ..\Graphics\ABS\
Umbral Wake has a graphic you are welcome to use for the HUD. It can be found in
the demo game at http://rm-dev.org/

--------------------------------------------------------------------------------
* Animation Engine [ABS.AE]
--------------------------------------------------------------------------------

The animation engine requires specific names for character graphics, if you are
using it (see * Setting up ABS Options to disable).

There are three required files, Attacking, Casting, and Being Hit. They must be
named as follows:

originalFileName-atk
originalFileName-cast
originalFileName-hit

The originalFileName is the character graphic of the hero's file name.

ex. For Aluxes, this would be written like so:

001-Fighter01-atk
001-Fighter01-cast
001-Fighter01-hit

ex. For Lisa in the Umbral Wake demo game, its written as:

LisaABS-atk
LisaABS-cast
LisaABS-hit

If the ABS is enabled to show animations for enemies (see * Setting up ABS
Options to disable), you also need graphics for the enemy as well. They are set
the same way.

ex. But for good measure, for the Ghost enemy:

051-Undead01-atk
051-Undead01-cast
051-Undead01-hit

Umbral Wake doesn't use the enemy animations.

=end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------

SDK.log('Prexus ABS', 'Prexus', 1, '18.12.05')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state('Prexus ABS') == true

#------------------------------------------------------------------------
# * Action Battle System (ABS) Class
#------------------------------------------------------------------------
# The core class and functional epicenter of the Action Battle System
#------------------------------------------------------------------------
class ABS
attr_accessor :p_animations
attr_accessor :e_animations
attr_accessor :player
attr_accessor :enemies
attr_accessor :events
attr_accessor :event_triggers
attr_reader :enabled
#----------------------------------------------------------------------
# * Initialization Handlers
#----------------------------------------------------------------------
# Makes sure that everything is set up to start the ABS
#----------------------------------------------------------------------
def initialize
@enabled = false
@player = $game_party.actors[0] # Sets to leader player
@enemies = {} # Enemy Hash
@events = {} # Hash of Dead Events
@event_triggers = {} # Hash of the Triggers of Dead Events
end
#----------------------------------------------------------------------
def setup_enemies(events)
@enemies = {} # Reset Enemy Hash
for event in events.values
parameters = SDK.event_comment_input(event, 3, 'ABS Setup')
next if !parameters
name = parameters[0].split
troop = parameters[1].split
trigger = parameters[2].split
for monster in $data_enemies
next if !monster
if name[1].upcase == monster.name.upcase
@enemies[event.id] = ABS::Enemy.new(monster.id)
@enemies[event.id].event_id = event.id
@enemies[event.id].troop = "ABS #{event.id}"
@enemies[event.id].troop = troop[1].upcase unless troop[1] == nil
@enemies[event.id].trigger_type = trigger[1].upcase
@enemies[event.id].trigger = trigger[2]
end
break if @enemies[event.id] != nil
end
end
end
#----------------------------------------------------------------------
def enable
@enabled = true
setup_enemies($game_map.events)
$scene.hud_window.visible = true if $scene.is_a?(Scene_Map)
update
end
#----------------------------------------------------------------------
def disable
@enabled = false
for enemy in @enemies.values
enemy.disengage
end
@enemies = {}
end
#----------------------------------------------------------------------
# * Update Handlers
#----------------------------------------------------------------------
# Updates and refreshes any information regarding characters, enemies,
# the ABS itself, or the graphic displays.
#----------------------------------------------------------------------
def update
update_player # Checks and updates player related stuff
for enemy in @enemies.values
update_enemy(enemy) # Checks and updates enemy related stuff
end
update_status # Checks and updates engine related stuff
update_hud # Checks and updates display related stuff
end
#----------------------------------------------------------------------
def update_player
@player = $game_party.actors[0] # Makes sure player is correct
# Decrease cooldown
@player.abs.chill if @player.abs.acted and @player.abs.cooldown != 0
# Reset acted if cooldown is over
@player.abs.acted = false if @player.abs.cooldown == 0
# Reset variables if player's cooldown has been reset
@player.abs.reset unless @player.abs.acted
end
#----------------------------------------------------------------------
def update_enemy(enemy)
enemy.find_player # Checks if player is close
if enemy.engaged
enemy.guarding = false # Resets guarding
enemy.chill if enemy.cooldown != 0 # Decrease cooldown
if enemy.cooldown == 0
enemy.reset if enemy.check_ai # Reset timers
enemy.cooldown /= 2 if enemy.guarding
end
enemy.path_find # Pathfind to the player
end
if enemy.dead?
collect_spoils(enemy) # Collect items and exp
remove(enemy) # Remove enemy based on its triggers
end
end
#----------------------------------------------------------------------
def update_status
$game_temp.gameover = true if $game_party.all_dead? # End game if dead.
end
#----------------------------------------------------------------------
def update_hud
#hud shit goes here
end
#----------------------------------------------------------------------
# * ABS Functions
#----------------------------------------------------------------------
# Handles anything regarding the ABS best done outside of other classes
#----------------------------------------------------------------------
def collect_spoils(enemy)
exp = enemy.exp # Set to the enemy's EXP amount
gold = enemy.gold # Set to the enemy's GOLD amount
if rand(100) < enemy.treasure_prob # Random Probability of SPOIL
if enemy.item_id > 0 # If its an ITEM
treasure = $data_items[enemy.item_id]
end
if enemy.weapon_id > 0 # If its a WEAPON
treasure = $data_weapons[enemy.weapon_id]
end
if enemy.armor_id > 0 # If its an ARMOR
treasure = $data_armors[enemy.armor_id]
end
end
@player.exp += exp unless @player.cant_get_exp? # Add Appropriate EXP
$game_party.gain_gold(gold) # Add Appropriate GOLD
case treasure
when RPG::Item
$game_party.gain_item(item.id, 1) # Add ITEM
when RPG::Weapon
$game_party.gain_weapon(item.id, 1) # Add WEAPON
when RPG::Armor
$game_party.gain_armor(item.id, 1) # Add ARMOR
end
end
#----------------------------------------------------------------------
def remove(enemy)
@enemies.delete(enemy.event_id) # Remove dead enemy from hash
case enemy.trigger_type
when 'LOCAL' # If trigger is a local switch
case enemy.trigger.upcase
when 'A','B','C','D' # If the trigger is a valid trigger
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, enemy.trigger.upcase]
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger.upcase
return
end
when 'SWITCH' # If the trigger is a switch
if enemy.trigger.to_i > 0 # If the trigger is a valid switch
$game_switches[enemy.trigger.to_i] = true
return
end
when 'CHEST'
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, 'A']
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger_type.upcase
return
end
# Else just remove the event lickity split.
$game_map.events[enemy.event_id].character_name = ''
$game_map.events[enemy.event_id].erase
end
#----------------------------------------------------------------------
# * Calculation Functions
#----------------------------------------------------------------------
# Handles range and direction checks
#----------------------------------------------------------------------
def check_range(element, object, range = 0)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
r = x + y
if r <= (range * range)
return true
end
return false
end
#----------------------------------------------------------------------
def find_range(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
return (x + y)
end
#----------------------------------------------------------------------
def check_facing(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
if element.direction == 2
return true if object.y >= element.y
end
if element.direction == 4
return true if object.x <= element.x
end
if element.direction == 6
return true if object.x >= element.x
end
if element.direction == 8
return true if object.y <= element.y
end
return false
end
#----------------------------------------------------------------------
# * ABS Animation Engine Functions
#----------------------------------------------------------------------
# Handles animating map sprites for a wide variety of uses
#----------------------------------------------------------------------
def animate(object, animation_name, position, wait = 8, frames = 0, repeat = 0)
if object != nil
object.animate(animation_name, position, frames, wait, repeat)
end
end
#----------------------------------------------------------------------
# * ABS Enemy Object
#----------------------------------------------------------------------
# This object handles interaction between the event and the enemy and
# deals with all the attacks and such.
#----------------------------------------------------------------------
class Enemy < Game_Battler
attr_accessor :event_id
attr_accessor :engaged
attr_accessor :trigger_type
attr_accessor :trigger
attr_accessor :cooldown
attr_accessor :dis_cooldown
attr_accessor :guarding
attr_accessor :troop
#--------------------------------------------------------------------
# * Initialize Handlers
#--------------------------------------------------------------------
# Handles setting up all the stats and information needed by the ABS
#--------------------------------------------------------------------
def initialize(monster_id)
super()
@event_id = 0
@enemy_id = monster_id
@trigger_type = nil
@trigger = nil
@engaged = false
@guarding = false
@cooldown = 0
@dis_cooldown = 0
@move_type = 0
@move_frequency = 0
@move_speed = 0
@hp = maxhp
@sp = maxsp
@troop = nil
end
#--------------------------------------------------------------------
# * Enemy Artificial Intelligence
#--------------------------------------------------------------------
# Handles the enemy's decision making and priorities.
#--------------------------------------------------------------------
def check_ai
check_status
return true if check_self_status
return true if check_troop_status
return false unless @engaged
return true if check_range_spell if @hp < (maxhp/25)
return true if check_melee_attack
return true if check_range_spell unless @hp < (maxhp/25)
@guarding = (1 == rand(5))
return @guarding
end
#--------------------------------------------------------------------
def set_skills(kind = 1)
skills = []
for action in $data_enemies[@enemy_id].actions
skills.push($data_skills[action.skill_id]) if action.kind == kind
end
return skills
end
#--------------------------------------------------------------------
def check_self_status
if @hp < (maxhp/25)
skills = set_skills(1)
return false if skills.size == 0 or skills == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4, 7].include?(skill.scope) and skill.power < 0
case skill.scope
when 3,7
target_enemies = [self]
when 4
target_enemies = []
for enemy in $ABS.enemies.values
target_enemies.push(enemy) if enemy.troop == @troop and
$ABS.check_range($game_map.events[@event_id], $game_map.events[enemy.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
end
#--------------------------------------------------------------------
def check_troop_status
skills = set_skills(1)
return false if skills.size == 0 or skills == []
troop = []
for enemy in $ABS.enemies.values
troop.push(enemy) if enemy.troop == @troop and (enemy.hp <
(enemy.maxhp*0.25)) and enemy != self
end
return false if troop.size == 0 or troop == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4].include?(skill.scope) and skill.power < 0
case skill.scope
when 3
top_target = self
for target in troop
top_target = target if target.hp < top_target.hp and
$ABS.check_range($game_map.events[@event_id], $game_map.events[target.event_id], skill.range)
end
target_enemies = [top_target]
when 4
target_enemies = []
for target in troop
target_enemies.push(target) if $ABS.check_range($game_map.events[@event_id], $game_map.events[target.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
#------------------------------------------------------------------------
def check_melee_attack
if $ABS.check_range(self, $game_player, 1) and
$ABS.check_facing(self, $game_player) and @cooldown == 0
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-atk',
event.direction/2, 4, 3, 0) if $ABS.e_animations
$ABS.player.attack_effect(self)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
if $ABS.player.damage != 'Miss' and $ABS.player.damage != 0
successful_hit(self, [$ABS.player])
end
return true
end
return false
end
#------------------------------------------------------------------------
def check_range_spell
skills = set_skills(1)
return false if skills.size == 0 or skills == []
viable_skills = []
for skill in skills
next if !skill_can_use?(skill.id)
next unless $ABS.check_range($game_map.events[@event_id], $game_player, skill.range)
next unless [1, 2].include?(skill.scope) or skill.power >= 0
viable_skills.push(skill)
end
return false if viable_skills.size == 0 or viable_skills == []
skill = viable_skills[rand(viable_skills.size+1)]
return false if skill == nil
$ABS.player.skill_effect(self, skill)
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
successful_hit(self, [$ABS.player], skill)
return true
end
#------------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 - agi)*1.2) / 1000)) * 1.5).floor
end
#------------------------------------------------------------------------
def chill
@cooldown -= 1 unless @cooldown == 0
end
#------------------------------------------------------------------------
def find_player
if $ABS.check_range(self, $game_player, 7) and
$ABS.check_facing(self, $game_player)
engage unless @engaged
return
end
check_disengage if @engaged
return
end
#------------------------------------------------------------------------
def guarding?
return @guarding
end
#------------------------------------------------------------------------
def successful_hit(object = self, target = [$game_party.actors[0]], skill = nil)
anim1 = 0; anim2 = 0
if skill == nil
anim1 = animation1_id if !$ABS.p_animations
anim2 = animation2_id
else
anim1 = skill.animation1_id if !$ABS.p_animations
anim2 = skill.animation2_id
end
if object.is_a?(Game_Actor)
$game_player.animation_id = anim1 if !$ABS.p_animations
else
event = $game_map.events[object.event_id]
event.animation_id = anim1 if !$ABS.e_animations
end
return if !target
for tar in target
next if !tar
if tar.is_a?(Game_Actor)
$game_player.animation_id = anim2
$ABS.animate($game_player, $game_player.character_name + '-hit',
$game_player.direction/2, 4, 3) if $ABS.p_animations
else
event = $game_map.events[tar.event_id]
event.animation_id = anim2
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
end
end
#------------------------------------------------------------------------
def engage
@engaged = true
engage_troops
@dis_cooldown = 500
reset
event = $game_map.events[@event_id]
@move_type = event.move_type
@move_frequency = event.move_frequency
@move_speed = event.move_speed
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
#------------------------------------------------------------------------
def engage_troops
for enemy in $ABS.enemies.values
if enemy.troop == @troop
enemy.engage unless enemy.engaged
end
end
end
#------------------------------------------------------------------------
def disengage
@engaged = false
event = $game_map.events[@event_id]
event.move_type = @move_type
event.move_frequency = @move_frequency
event.move_speed = @move_speed
end
#------------------------------------------------------------------------
def check_disengage
@dis_cooldown -= 1
if @dis_cooldown == 0
disengage
end
end
#------------------------------------------------------------------------
def check_status
if hp < (maxhp / 25)
event = $game_map.events[@event_id]
event.move_type = 4
event.move_frequency = 5
event.move_speed = 5
else
event = $game_map.events[@event_id]
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
end
#------------------------------------------------------------------------
def path_find
return if $game_map.events[@event_id].runpath
$game_map.events[@event_id].find_object($game_player)
end
#------------------------------------------------------------------------
def id
return @enemy_id
end
#------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk
end
#------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef
end
#------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef
end
#------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#------------------------------------------------------------------------
def element_rate(element_id)
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
for i in @states
result /= 2 if $data_states[i].guard_element_set.include?(element_id)
end
return result
end
#------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#------------------------------------------------------------------------
def element_set
return []
end
#------------------------------------------------------------------------
def plus_state_set
return []
end
#------------------------------------------------------------------------
def minus_state_set
return []
end
#------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
end # End ABS::Enemy Class
end # End ABS Class

#------------------------------------------------------------------------
# * Game Actor ABS Clsas
#------------------------------------------------------------------------
# This is how the Player interacts with enemies and hotkeys
#------------------------------------------------------------------------
class Game_Actor
attr_accessor :abs
#------------------------------------------------------------------------
alias prexus_abs_g_actor_setup setup
#------------------------------------------------------------------------
def setup(actor_id)
prexus_abs_g_actor_setup(actor_id)
@abs = Game_Actor::ABS.new # Setup the ABS class
end
#------------------------------------------------------------------------
class ABS
attr_accessor :cooldown
attr_accessor :acted
attr_accessor :hot_key
#----------------------------------------------------------------------
def initialize
@cooldown = 0 # Attacking/casting cooldown
@acted = false # Flag for whether or not you've acted recently
@hot_key = [nil, nil, nil] # Hot key array
end
#----------------------------------------------------------------------
# * Cooldown/input methods
#----------------------------------------------------------------------
def chill
@cooldown -= 1 if @acted and @cooldown != 0
end
#----------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 - $game_party.actors[0].agi)*1.2) / 1000)) * 1.5).floor / 2 unless @acted
end
#----------------------------------------------------------------------
# * Attacking/Spell Casting Methods
#----------------------------------------------------------------------
def attack
# Animate Actor:
$ABS.animate($game_player, $game_player.character_name + '-atk',
$game_player.direction/2, 4, 3) if $ABS.p_animations
$game_player.animation_id = $ABS.player.animation1_id unless $ABS.p_animations
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, 1) # If enemy is in range
next if !$ABS.check_facing($game_player, enemy) # and not behind
enemy.attack_effect($ABS.player) # hit the enemy
event = $game_map.events[enemy.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(enemy.damage, enemy.critical) if sprite # show damage
if enemy.damage != 'Miss' and enemy.damage != 0 # if the attack hit
# Animate Enemy:
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
event.animation_id = $ABS.player.animation2_id
end
@acted = true # Yes you've recently attacked!
end
end
#----------------------------------------------------------------------
def cast(skill)
return unless skill
skill = $data_skills[skill]
return unless skill or $ABS.player.skill_can_use?(skill.id) # Can use?
return if $ABS.player.sp < skill.sp_cost # We sure about that?
@acted = true # Then you've acted!
reset # Reset the cooldown for some reason
# Animate Actor:
$game_player.animation_id = skill.animation1_id
$ABS.animate($game_player, $game_player.character_name + '-cast',
$game_player.direction/2, 4, 3, 0) if $ABS.p_animations
# Deal with SP
$ABS.player.sp -= skill.sp_cost
case skill.scope
when 1 # One Enemy
target = find_single_target(skill) # Find closest enemy
return unless target # If you found a valid enemy
target.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[target.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(target.damage, target.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
when 2 # Multiple Enemies
target = find_all_target(skill) # Find all enemies in range
return unless target # If you found valid enemies
for tar in target # For all the enemies:
tar.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[tar.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(tar.damage, tar.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
when 3..4,7 # For yourself
$ABS.player.skill_effect($ABS.player, skill) # Hit yourself
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite # Show heal
# Animate self:
$game_player.animation_id = skill.animation2_id
else
return
end
end
#----------------------------------------------------------------------
# * Target Finding Methods
#----------------------------------------------------------------------
def find_single_target(skill)
targets = [] # Holds the valid targets
target_range = [] # Holds their range from player
final_targets = [] # Holds final targets (only valids)
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove the enemy
target_range.push($ABS.find_range($game_player, enemy)) # Shove his range
end
big_range = 0 # Lowest Range from Player
for i in target_range # Finding the lowest range of valid targets
big_range = i if i > big_range
end
for i in 0...targets.size # Finding the targets inside that range
final_targets.push(targets[i]) if target_range[i] <= big_range
end
random = rand(final_targets.size)-1 # Selecting one of the targets
random = 0 if random < 0
return final_targets[random] # Return that target
end
#----------------------------------------------------------------------
def find_all_target(skill)
targets = [] # All Targets
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove enemy
end
return targets # Return all enemies
end
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end # End SDK Check

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state('Prexus ABS') == true

class Game_Map
alias prexus_abs_g_map_setup setup
def setup(map_id)
prexus_abs_g_map_setup(map_id)
$ABS = ABS.new if !$ABS
$ABS.setup_enemies(@events)
end
end
#--------------------------------------------------------------------------
class Scene_Map
attr_accessor :spriteset
alias prexus_abs_s_map_update update
def update
$ABS.update if $ABS.enabled
if !$ABS.player.abs.acted and !$game_party.actors[0].guarding? and $ABS.enabled
$ABS.player.abs.attack if Input.trigger?(Input::A) and $ABS.player.weapon_id > 0
$ABS.player.abs.cast($ABS.player.abs.hot_key[0]) if Input.trigger?(Input::X)
$ABS.player.abs.cast($ABS.player.abs.hot_key[1]) if Input.trigger?(Input::Y)
$ABS.player.abs.cast($ABS.player.abs.hot_key[2]) if Input.trigger?(Input::Z)
end
prexus_abs_s_map_update
end
end
#--------------------------------------------------------------------------
class Game_Actor
#------------------------------------------------------------------------
def guarding?
return true if Input.press?(Input::L)
return false
end
end
#--------------------------------------------------------------------------
class Game_Event
attr_reader :page
attr_reader :map_id
def name
return @event.name
end
end
#--------------------------------------------------------------------------
class Game_Character
attr_accessor :move_type
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :character_name
attr_accessor :wait
attr_accessor :old_chr_name
attr_accessor :old_dir
attr_accessor :animating
#------------------------------------------------------------------------
alias animation_engine_game_character_initialize initialize
#------------------------------------------------------------------------
def initialize
animation_engine_game_character_initialize
@animating = false
@wait = false
@old_chr_name = @character_name
@old_dir = @direction
end
#------------------------------------------------------------------------
def animate(animation_name, position, frames, wait, repeat)
@character_name = animation_name if @animating == false
@pattern = 0
@count = 0
@repeat = repeat
@direction_fix = true
@old_dir = @direction
@direction = position * 2
@frames = frames
lock
@animating = true
@wait = wait
@anim_wait_count = @wait
update
return
end
#------------------------------------------------------------------------
def update_animate
if @anim_wait_count > 0
@anim_wait_count -= 1
return
end
if @pattern >= @frames or moving?
if !moving?
if @count < @repeat
@pattern = 0
@count += 1
@anim_wait_count = @wait
update
return
end
end
unlock
@animating = false
@pattern = 0
@direction_fix = false
@direction = @old_dir
if self.is_a?(Game_Event)
@character_name = @page != nil ? @page.graphic.character_name : ''
else
@character_name = @old_chr_name
end
$game_player.refresh
$game_map.refresh
return
end
@pattern += 1
@anim_wait_count = @wait
update
end
#------------------------------------------------------------------------
def update_movement_type
if @animating == true
update_animate
return
end
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
end
#------------------------------------------------------------------------
def update_movement
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 1 # Random
move_type_random
when 2
if @runpath
run_path
else
move_type_toward_player
end
when 3
move_type_custom
when 4
move_type_escape_player
end
end
end
#------------------------------------------------------------------------
# * Move Type : Escape
#------------------------------------------------------------------------
def move_type_escape_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_away_from_player
end
#------------------------------------------------------------------------
# * Move Type : Approach
#------------------------------------------------------------------------
def move_type_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_toward_player
end
#------------------------------------------------------------------------
# * Move away from Player
#------------------------------------------------------------------------
def move_away_from_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
sx > 0 ? move_right : move_left
if not moving?
rand(2) == 1 ? move_down : move_up
end
else
sy > 0 ? move_down : move_up
if not moving?
rand(2) == 1 ? move_right : move_left
end
end
end
end
#--------------------------------------------------------------------------
class Game_Battler
def skill_can_use?(skill_id)
if $data_skills[skill_id].sp_cost > self.sp
return false
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $scene.is_a?(Scene_Map)
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
end
def skill_effect(user, skill)
self.critical = false
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= skill.common_event_id > 0
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
effective |= hit < 100
if hit_result == true
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
self.damage = power * rate / 20
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
self.damage /= 2
end
end
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
effective |= hit < 100
end
if hit_result == true
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Miss"
end
end
else
self.damage = "Miss"
end
return effective
end
end
#--------------------------------------------------------------------------
class Scene_Skill
alias prexus_abs_s_skill_update update
def update
if Input.trigger?(Input::X)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[0] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[0] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Y)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[1] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[1] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Z)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[2] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[2] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::A)
skill = @skill_window.skill
for i in 0..$ABS.player.abs.hot_key.size
skillX = $ABS.player.abs.hot_key[i]
next unless skillX
$ABS.player.abs.hot_key[i] = nil if skill.id == skillX
end
@skill_window.refresh
return
end
prexus_abs_s_skill_update
end
end
#--------------------------------------------------------------------------
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 255)
else
self.contents.font.color = normal_color
end
else
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 160)
else
self.contents.font.color = disabled_color
end
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
class Scene_Map
alias prex_abs_s_map_transfer_player transfer_player
def transfer_player
for i in 0...$game_map.events.size
event = $ABS.events[i]
trigger = $ABS.event_triggers[i]
next unless event and trigger
if ['A', 'B', 'C', 'D'].include?(trigger.upcase)
key = [event.map_id, event.id, trigger]
$game_self_switches[key] = false
$ABS.events.delete(event)
$ABS.event_triggers.delete(trigger)
next
end
if trigger.upcase == 'CHEST'
key = [event.map_id, event.id, 'A']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'B']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'C']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'D']
$game_self_switches[key] = false
$ABS.events.delete(event)
$ABS.event_triggers.delete(trigger)
next
end
end
prex_abs_s_map_transfer_player
end
end
#--------------------------------------------------------------------------
class Scene_Save < Scene_File
alias prex_abs_s_save_write_data write_data
def write_data(file)
prex_abs_s_save_write_data(file)
Marshal.dump($ABS, file)
end
end
#--------------------------------------------------------------------------
class Scene_Load < Scene_File
alias prex_abs_s_load_read_data read_data
def read_data(file)
prex_abs_s_load_read_data(file)
$ABS = Marshal.load(file)
end
end
#--------------------------------------------------------------------------
class Spriteset_Map
attr_accessor :character_sprites
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state("Prexus ABS") == true

class ABS
attr_accessor :portrait
alias prex_abs_abs_initialize initialize
def initialize
prex_abs_abs_initialize
@p_animations = true # To play charset animations for players
@e_animations = true # To play charset animations for enemies
@portrait = true # To show a portrait in HUD. If false, shows charset.
end
end
#------------------------------------------------------------------------
module RPG
class Skill
attr_accessor :range
#--------------------------------------------------------------------
# * Instructions:
# Add new spells and their ranges by adding these lines:
# when "SpellName"
# @range = valueforrange
#--------------------------------------------------------------------
# For Example:
# when "Cross Cut"
# @range = 2
#--------------------------------------------------------------------
def set_range
@range = 0
case self.name
# Add New Lines Here:
when "Heal"
@range = 6
when "Fireball"
@range = 5
when "Sting"
@range = 3
when "Claw"
@range = 2
end
end
end
end
#------------------------------------------------------------------------
class Scene_Title
alias prexus_abs_s_title_main_database main_database
def main_database
prexus_abs_s_title_main_database
$data_skills.each {|s| s.set_range if s}
end
end
#------------------------------------------------------------------------
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 16
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(0, 96, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(96, 0, 0)
else
bitmap.font.color.set(0, 0, 96)
end
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(0, 255, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(255, 0, 0)
else
bitmap.font.color.set(0, 0, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.color.set(96, 96, 0)
bitmap.draw_text(-1, -1, 160, 20, "Nice!", 1)
bitmap.draw_text(+1, -1, 160, 20, "Nice!", 1)
bitmap.draw_text(-1, +1, 160, 20, "Nice!", 1)
bitmap.draw_text(+1, +1, 160, 20, "Nice!", 1)
bitmap.font.color.set(255, 255, 0)
bitmap.draw_text(0, 0, 160, 20, "Nice!", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state("Prexus ABS") == true

class Scene_Map
attr_accessor :hud_window
alias prex_abshud_s_map_main main
def main
@hud_window = ABS::Window_Hud.new
prex_abshud_s_map_main
end
alias prex_abshud_s_map_update update
def update
prex_abshud_s_map_update
if Input.trigger?(Input::R)
@hud_window.visible = !@hud_window.visible if $ABS.enabled
end
@hud_window.visible = false if !$ABS.enabled
@hud_window.update
end
end
#---------------------------------------------------------------------------
class ABS
class Window_Hud < Window_Base
attr_accessor :portrait
def initialize
super(-16, -16, 672, 512)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Georgia"
self.contents.font.bold = true
self.contents.font.size = 14
self.opacity = 0
@hp = 0
@maxhp = 0
@sp = 0
@maxsp = 0
@portrait = nil
refresh
end
#------------------------------------------------------------------------
def refresh
self.contents.clear
@hp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
@sp = $game_party.actors[0].sp
@maxsp = $game_party.actors[0].maxsp
#---------------------------------------------------------------------
# * Draw HUD Background (will adjust to any size image)
# - Image is ..\Graphic\HUD\Background.png
#---------------------------------------------------------------------
bitmap = RPG::Cache.hud("Background")
self.contents.blt(640-bitmap.width, 480-bitmap.height, bitmap,
Rect.new(0, 0, bitmap.width, bitmap.height))
#---------------------------------------------------------------------
# * Draw HP and SP Bars and Text
#---------------------------------------------------------------------
hpp = (@hp.to_f / @maxhp) * 100
@x = 640-152
@y = 480-40
self.contents.fill_rect(@x+0, @y+9 , 102, 8, Color.new(143, 17, 17, 180))
self.contents.fill_rect(@x+1, @y+10, 100, 6, Color.new(120, 60, 60, 180))
self.contents.fill_rect(@x+1, @y+10, hpp, 2, Color.new(234, 195, 195, 180))
self.contents.fill_rect(@x+1, @y+12, hpp, 2, Color.new(217, 152, 152, 180))
self.contents.fill_rect(@x+1, @y+14, hpp, 2, Color.new(181, 75, 75, 180))
text = "#{@hp}/#{@maxhp}"
width = self.contents.text_size(text).width
height = self.contents.text_size(text).height
self.contents.font.color = Color.new( 0, 0, 0)
self.contents.draw_text(@x+102 - width, @y+1, width, height, text)
self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(@x+101 - width, @y+0, width, height, text)
spp = (@sp.to_f / @maxsp) * 100
self.contents.fill_rect(@x+0, @y+25, 102, 8, Color.new( 17, 79, 143, 180))
self.contents.fill_rect(@x+1, @y+26, 100, 6, Color.new( 60, 60, 120, 180))
self.contents.fill_rect(@x+1, @y+26, spp, 2, Color.new(196, 213, 234, 180))
self.contents.fill_rect(@x+1, @y+28, spp, 2, Color.new(153, 185, 271, 180))
self.contents.fill_rect(@x+1, @y+30, spp, 2, Color.new( 75, 127, 181, 180))
text = "#{@sp}/#{@maxsp}"
width = self.contents.text_size(text).width
height = self.contents.text_size(text).height
self.contents.font.color = Color.new( 0, 0, 0)
self.contents.draw_text(@x+102 - width, @y+18, width, height, text)
self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(@x+101 - width, @y+17, width, height, text)
#---------------------------------------------------------------------
# * Draw Face Graphic
# - Face Graphics found in ..\Graphics\HUD\portraits\
# Must match hero's name!
#---------------------------------------------------------------------
if $ABS.portrait
bitmap = RPG::Cache.portrait($game_party.actors[0].name.to_s)
self.c
Global Domain Effects

Creates effects on Maps, and in Battle, that simulate certain atmospheric conditions. Such as overwhelming heat (damage over time on maps, increased fire damage in battle), Underwater (fire damage has no effect, water damage amplified), Magic Barrier (Offensive magic has no effect), Blessed (Cure over time and heal all status ailments on map).

There are a host of default domain effects, and instructions on how to create others in the script.

Demo
Click Here

Screenshots

None

The Script

Content Hidden Spoiler
#==========================================================================
# ● Global Domain Effects
#--------------------------------------------------------------------------
# Prexus
# v1.0
# 2.3.06
#==========================================================================
# Sample Domains at the end of script.
#==========================================================================
 
SDK.log('Global Domain Effects', 'Prexus', '1.0', '2.3.06')

#--------------------------------------------------------------------------
# ● Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Global Domain Effects') == true
 
  #------------------------------------------------------------------------
  # ● Domain
  #------------------------------------------------------------------------
  # This class handles all the updating and such for the Domain_* classes.
  #------------------------------------------------------------------------
  class Domain
    attr_reader :id                        # The ID of the Domain
    attr_reader :name                      # The name of the Domain
    attr_reader :damage_over_time          # Over_Time class for damage
    attr_reader :heal_over_time            # Over_Time class for healing
    attr_reader :plus_status_effects       # Status class for status effects
    attr_reader :minus_status_effects      # Status class for status effects
    attr_reader :damage_increase_elements  # Elements whose damage increases
    attr_reader :damage_decrease_elements  # Elements whose damage decreases
    attr_reader :effect_elements           # Elements with addition effects
    attr_reader :screen_effects            # Screen_Effects of the Domain
    #----------------------------------------------------------------------
    def initialize
      @id = 0
      @name = ''
      @damage_over_time = false
      @heal_over_time = false
      @plus_status_effects = false
      @minus_status_effects = false
      @damage_increase_elements = []
      @damage_decrease_elements = []
      @effect_elements = []
      @screen_effects = nil
    end
    #----------------------------------------------------------------------
    def update(battle = false)
      # Check for Damage/Heal Over Time effects.
      return unless $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Battle)
      for battler in $scene.effected_battlers
        d_o_t(battler, battle) if @damage_over_time
        h_o_t(battler, battle) if @heal_over_time
        inflict_status(battler) if @plus_status_effects
        remove_status(battler) if @minus_status_effects
      end
    end
    #----------------------------------------------------------------------
    def d_o_t(battler, battle)
      damage = @damage_over_time.value if @damage_over_time.type == 'direct'
      if @damage_over_time.type == 'percent'
        damage = (battler.maxhp / @damage_over_time.value).abs / 100
      end
      for element in @damage_over_time.protect_elements
        damage *= battler.element_rank(element)
      end
      battler.hp -= damage
      battler.damage = damage if battle
    end
    #----------------------------------------------------------------------
    def h_o_t(battler, battle)
      healing = @heal_over_time.value if @heal_over_time.type == 'direct'
      if @heal_over_time.type == 'percent'
        healing = ((@heal_over_time.value / 100) * battler.maxhp).abs
      end
      for element in @heal_over_time.protect_elements
        healing *= battler.element_rank(element)
      end
      battler.hp += healing
      battler.damage = -healing if battle
    end
    #----------------------------------------------------------------------
    def inflict_status(battler)
      for status in @plus_status_effects.statii
        case battler.state_ranks[status]
        when 0 # A
          battler.add_state(status)
        when 1 # B
          battler.add_state(status) if rand(100) < 75
        when 2 # C
          battler.add_state(status) if rand(100) < 50
        when 3 # D
          battler.add_state(status) if rand(100) < 25
        when 5 # E
          battler.remove_status(status)
        end
      end
    end
    #----------------------------------------------------------------------
    def remove_status(battler)
      for status in @minus_status_effects.statii
        case battler.state_ranks[status]
        when 0    # A
          battler.remove_state(status) if rand(100) < 10
        when 1    # B
          battler.remove_state(status) if rand(100) < 25
        when 2    # C
          battler.remove_state(status) if rand(100) < 50
        when 3    # D
          battler.remove_state(status) if rand(100) < 75
        when 4..5 # E
          battler.remove_state(status)
        end
      end
    end
    #----------------------------------------------------------------------
    def effect(id)
      # Returns a string denoting what effect the element has. Valid effects:
      # 'mass target' - Hits all targets.
      # 'skill' - Chance to produce an additional skill.
      # 'mass skill' - Chance to produce an additional skill that hits all.
      return nil
    end
    #----------------------------------------------------------------------
    def special_skill(id)
      # Returns a skill id of a skill that will occur when a certain element
      # is used in battle. Such as an avalanche when an earth spell is cast.
      return nil
    end
   
    #----------------------------------------------------------------------
    # ● Domain::Over_Time
    #----------------------------------------------------------------------
    # This class handles all the over-time constants for things like damage
    # and healing.
    #----------------------------------------------------------------------
    class Over_Time
      attr_reader :value            # Damage/Healing to be done
      attr_reader :type             # Either 'percent' or 'direct'
      attr_reader :killable         # True means players/enemies will die.
      attr_reader :protect_elements # Elements that protect against healing
      #--------------------------------------------------------------------
      def initialize(value, type, killable = true, protect_elements = [])
        @value = value
        @type = type.downcase
        @killable = killable
        @protect_elements = protect_elements
      end
    end
   
    #----------------------------------------------------------------------
    # ● Domain::Status
    #----------------------------------------------------------------------
    # This class holds an array of the status effect ids to either be
    # healed or inflicted by the domain.
    #----------------------------------------------------------------------
    class Status
      attr_reader :statii # Array of statuses to heal/inflict
      #--------------------------------------------------------------------
      def initialize(statii)
        @statii = statii
      end
    end
   
    #----------------------------------------------------------------------
    # ● Domain::Screen_Effects
    #----------------------------------------------------------------------
    # This class handles all the information about how to manage the screen
    # and sound effects under certain domains.
    #----------------------------------------------------------------------
    class Screen_Effects
      attr_reader :tone  # The tone of maps under domain
      attr_reader :flash # The flash when taking damage/healing
      attr_reader :sound # The sound when taking damage/healing
      #--------------------------------------------------------------------
      def initialize(tone, flash = nil, sound = nil)
        @tone = tone
        @flash = flash
        if sound == nil
          @sound = sound
        else
          @sound = RPG::AudioFile.new(sound)
        end
      end
    end
  end
 
  #------------------------------------------------------------------------
  # ● Game_Map
  #------------------------------------------------------------------------
  # Just a simple aliased method to set the domain effect when the map
  # is initialized. Also, handles updating the domain. Only each step does
  # it update.
  #------------------------------------------------------------------------
  class Game_Map
    attr_reader :domain # The domain of the map
    attr_accessor :window
    #----------------------------------------------------------------------
    alias prex_domaineffects_g_map_setup_tileset setup_tileset
    alias prex_domaineffects_g_map_update update
    alias prex_domaineffects_g_map_refresh refresh
    #----------------------------------------------------------------------
    def setup_tileset
      prex_domaineffects_g_map_setup_tileset
      @x = $game_player.x
      @y = $game_player.y
      domain_id = map_domain
      if domain_id != 0
        @domain = eval("Domain_#{DOMAIN_IDS[domain_id]}.new")
      else
        @domain = nil
      end
      if !@window
        @window = Window_Domain.new
      else
        @window.refresh
      end
    end
    #----------------------------------------------------------------------
    def update
      prex_domaineffects_g_map_update
      @window.update
      update_domain
    end
    #----------------------------------------------------------------------
    def refresh
      prex_domaineffects_g_map_refresh
      if $scene.is_a?(Scene_Battle) and @window.y != 64
        @window.y = 64
      elsif $scene.is_a?(Scene_Map) and @window.y != 0
        @window.y = 0
      end
      @window.refresh
    end
    #----------------------------------------------------------------------
    def update_domain
      return if !@domain
      if @x != $game_player.x or @y != $game_player.y
        @domain.update
        @x, @y = $game_player.x, $game_player.y
        if @domain.screen_effects
          if @domain.screen_effects.flash
            $game_screen.start_flash(@domain.screen_effects.flash, 4)
          end
          if @domain.screen_effects.sound
            $game_system.se_play(@domain.screen_effects.sound)
          end
        end
      end
    end
    #----------------------------------------------------------------------
    def map_domain
      map_data = load_data('Data/MapInfos.rxdata')[@map_id]
      return map_data.name.find('[',']').to_i
    end
  end
 
  #------------------------------------------------------------------------
  # ● Spriteset_Map
  #------------------------------------------------------------------------
  # Another aliased method to set the viewport tones properly when a map
  # initializes.
  #------------------------------------------------------------------------
  class Spriteset_Map
    alias prex_domaineffects_sset_map_init_viewports init_viewports
    #----------------------------------------------------------------------
    def init_viewports
      prex_domaineffects_sset_map_init_viewports
      if $game_map.domain != nil and $game_map.domain.screen_effects != nil
        @viewport1.tone = $game_map.domain.screen_effects.tone
        @viewport2.tone = $game_map.domain.screen_effects.tone
        @viewport3.tone = $game_map.domain.screen_effects.tone
      end
    end
  end
 
  #------------------------------------------------------------------------
  # ● Scene_Map
  #------------------------------------------------------------------------
  # A quick method added to return a list of the actors to be effected by
  # the domain. In an ABS this might include all the enemies on the field.
  #------------------------------------------------------------------------
  class Scene_Map
    def effected_battlers
      return $game_party.actors
    end
  end
 
  #------------------------------------------------------------------------
  # ● Scene_Battle
  #------------------------------------------------------------------------
  # Big modifications to Scene_Battle to include the Domain Effects.
  #------------------------------------------------------------------------
  class Scene_Battle
    alias prex_domaineffects_s_battle_start_phase4 start_phase4
    alias prex_domaineffects_s_battle_set_target_battlers set_target_battlers
    alias prex_domaineffects_s_battle_update_phase4_step6 update_phase4_step6
    #----------------------------------------------------------------------
    def start_phase4
      update_domain
      for target in effected_battlers
        if target.damage != nil
          target.damage_pop = true
        end
      end
      update_objects
      prex_domaineffects_s_battle_start_phase4
    end
    #----------------------------------------------------------------------
    def update_domain
      $game_map.domain.update(true)
      if $game_map.domain.screen_effects
          if $game_map.domain.screen_effects.flash
            $game_screen.start_flash($game_map.domain.screen_effects.flash, 4)
          end
        if $game_map.domain.screen_effects.sound
          $game_system.se_play($game_map.domain.screen_effects.sound)
        end
      end
    end
    #----------------------------------------------------------------------
    def effected_battlers
      return $game_party.actors + $game_troop.enemies
    end
    #----------------------------------------------------------------------
    def make_basic_action_result
      # If attack
      if @active_battler.current_action.basic == 0
        # Set anaimation ID
        @animation1_id = @active_battler.animation1_id
        @animation2_id = @active_battler.animation2_id
        # If action battler is enemy
        if @active_battler.is_a?(Game_Enemy)
          if @active_battler.restriction == 3
            target = $game_troop.random_target_enemy
          elsif @active_battler.restriction == 2
            target = $game_party.random_target_actor
          else
            index = @active_battler.current_action.target_index
            target = $game_party.smooth_target_actor(index)
          end
        end
        # If action battler is actor
        if @active_battler.is_a?(Game_Actor)
          if @active_battler.restriction == 3
            target = $game_party.random_target_actor
          elsif @active_battler.restriction == 2
            target = $game_troop.random_target_enemy
          else
            index = @active_battler.current_action.target_index
            target = $game_troop.smooth_target_enemy(index)
          end
        end
        # Set array of targeted battlers
        @target_battlers = [target]
        #------------------------------------------------------------------
        # ● Begin Domain Effects Edit
        #------------------------------------------------------------------
        # Check for special domain effects
        check_domain_effects
        #------------------------------------------------------------------
        # ● End Domain Effects Edit
        #------------------------------------------------------------------
        # Apply normal attack results
        for target in @target_battlers
          target.attack_effect(@active_battler)
        end
        return
      end
      # If guard
      if @active_battler.current_action.basic == 1
        # Display "Guard" in help window
        @help_window.set_text($data_system.words.guard, 1)
        return
      end
      # If escape
      if @active_battler.is_a?(Game_Enemy) and
         @active_battler.current_action.basic == 2
        # Display "Escape" in help window
        @help_window.set_text("Escape", 1)
        # Escape
        @active_battler.escape
        return
      end
      # If doing nothing
      if @active_battler.current_action.basic == 3
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    #----------------------------------------------------------------------
    def set_target_battlers(scope)
      # Check special domain effects
      if @repeat_attack_type == 'mass skill'
        @target_battlers = $game_party.actors + $game_troop.enemies
        return
      elsif @repeat_attack_type == 'skill'
        return
      end
      @target_battlers = []
      check_domain_effects
      return unless @target_battlers == []
      prex_domaineffects_s_battle_set_target_battlers(scope)
    end
    #----------------------------------------------------------------------
    def check_domain_effects
      for element in $game_map.domain.effect_elements
        if $game_map.domain.effect(element) == 'mass target' and
            @active_battler.element_set.include?(element)
          @target_battlers = $game_party.actors + $game_troop.enemies
          return
        end
      end
    end
    #----------------------------------------------------------------------
    def update_phase4_step6
      if @repeat_attack_type == nil
        for ele in $game_map.domain.effect_elements
          if ['skill', 'mass skill'].include?($game_map.domain.effect(ele)) and
              @active_battler.element_set.include?(ele)
            skill_id = $game_map.domain.special_skill(ele)
            return if skill_id == nil
            @active_battler.current_action.kind = 1
            @active_battler.current_action.skill_id = skill_id
            @active_battler.current_action.forcing = true
            @repeat_attack_type = $game_map.domain.effect(ele)
            $game_temp.forcing_battler = @active_battler
            @phase4_step = 1
            return
          end
        end
      else
        @repeat_attack_type = nil
      end
      prex_domaineffects_s_battle_update_phase4_step6
    end
    #----------------------------------------------------------------------
    def make_skill_action_result
      @skill = $data_skills[@active_battler.current_action.skill_id]
      unless @active_battler.current_action.forcing
        unless @active_battler.skill_can_use?(@skill.id)
          $game_temp.forcing_battler = nil
          @phase4_step = 1
          return
        end
      end
      #--------------------------------------------------------------------
      # ● Begin Domain Effect Edit
      #--------------------------------------------------------------------
      @active_battler.sp -= @skill.sp_cost unless @repeat_attack_type
      if @repeat_attack_type == nil
        text = @skill.name
      else
        text = "#{@active_battler.name} causes a #{@skill.name}"
      end
      #--------------------------------------------------------------------
      # ● End Domain Effect Edit
      #--------------------------------------------------------------------
      @help_window.set_text(text, 1)
      @status_window.refresh
      @animation1_id = @skill.animation1_id unless @repeat_attack_type # Edit
      @animation2_id = @skill.animation2_id
      @common_event_id = @skill.common_event_id
      set_target_battlers(@skill.scope)
      # Apply skill effect
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
    end
  end
 
  #------------------------------------------------------------------------
  # ● Game_Battler
  #------------------------------------------------------------------------
  # Small change to add the status variable (holds name of status effect
  # currently being applied to battler). Also adjusted to update that
  # variable in the add_state method.
  #------------------------------------------------------------------------
  class Game_Battler
    attr_accessor :status                   # status name
    #----------------------------------------------------------------------
    alias prex_domaineffects_g_battler_initialize initialize
    alias prex_domaineffects_g_battler_add_state add_state
    #----------------------------------------------------------------------
    def initialize
      prex_domaineffects_g_battler_initialize
      @status = nil
    end
    #----------------------------------------------------------------------
    def add_state(state_id, force = false)
      prex_domaineffects_g_battler_add_state(state_id, force)
      @status = $data_states[state_id].name unless state?(state_id)
    end
    #----------------------------------------------------------------------
    def elements_correct(element_set)
      # If not an element
      if element_set == []
        # Return 100
        return 100
      end
      #------------------------------------------------------------------
      # ● Begin Domain Effects Edit
      #------------------------------------------------------------------
      for element in $game_map.domain.damage_decrease_elements
        return 0 if element_set.include?(element)
      end
      #------------------------------------------------------------------
      # ● End Domain Effects Edit
      #------------------------------------------------------------------
      # Return the weakest object among the elements given
      # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
      #    which inherit from this class.
      weakest = -100
      for i in element_set
        weakest = [weakest, self.element_rate(i)].max
      end
      #------------------------------------------------------------------
      # ● Begin Domain Effects Edit
      #------------------------------------------------------------------
      for element in $game_map.domain.damage_increase_elements
        weakest *= 2 if element_set.include?(element)
      end
      #------------------------------------------------------------------
      # ● End Domain Effects Edit
      #------------------------------------------------------------------
      return weakest
    end
  end
 
  #------------------------------------------------------------------------
  # ● Sprite_Battler
  #------------------------------------------------------------------------
  # Small change to Sprite_Battler to send status information to the Sprite
  # class.
  #------------------------------------------------------------------------
  class Sprite_Battler
    def sprite_damage
      if @battler.damage_pop
        #------------------------------------------------------------------
        # Begin Domain Effects Edit
        #------------------------------------------------------------------
        damage(@battler.damage, @battler.critical, @battler.status)
        @battler.status = nil
        #------------------------------------------------------------------
        # End Domain Effects Edit
        #------------------------------------------------------------------
        @battler.damage = nil
        @battler.critical = false
        @battler.damage_pop = false
      end
    end
  end
 
  #------------------------------------------------------------------------
  # ● String (by Astro_Mech)
  #------------------------------------------------------------------------
  # A method by Astro_Mech that takes a string and finds whatever is
  # between two characters (s1 and s2).
  #------------------------------------------------------------------------
  class String
    def find(s1, s2)
      return "0" unless self.include?(s1)
      sz = s1.length
      a = []
      str = ""
      index = 0
      for i in self.split(//)
        index += 1
        a.push(i)
        if a.join[index-sz, sz] == s1
          break
        end
      end
      a.clear
      sz = s2.length
      newindex = 0
      for i in self.split(//)[index, self.size-1]
        newindex += 1
        a.push(i)
        if a.join[newindex-sz, sz] == s2
          for i in 0...sz
            a.pop
          end
          str = a.join
          break
        end
      end
      return str
    end
  end
 
  module RPG
    class Sprite < ::Sprite
      def damage(value, critical, status = nil)
        dispose_damage
        if value.is_a?(Numeric)
          damage_string = value.abs.to_s
        else
          damage_string = value.to_s
        end
        bitmap = Bitmap.new(160, 64)
        bitmap.font.name = "Arial Black"
        bitmap.font.size = 32
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
        bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
        bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
        bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
        if value.is_a?(Numeric) and value < 0
          bitmap.font.color.set(176, 255, 144)
        else
          bitmap.font.color.set(255, 255, 255)
        end
        bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
        if critical
          bitmap.font.size = 20
          bitmap.font.color.set(0, 0, 0)
          bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
          bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
          bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
          bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
          bitmap.font.color.set(255, 255, 255)
          bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
        end
        if status
          bitmap.font.size = 20
          bitmap.font.color.set(0, 0, 0)
          bitmap.draw_text(-1, 36-1, 160, 20, status, 1)
          bitmap.draw_text(+1, 36-1, 160, 20, status, 1)
          bitmap.draw_text(-1, 36+1, 160, 20, status, 1)
          bitmap.draw_text(+1, 36+1, 160, 20, status, 1)
          bitmap.font.color.set(255, 255, 255)
          bitmap.draw_text(0, 36, 160, 20, status, 1)
        end
        @_damage_sprite = ::Sprite.new(self.viewport)
        @_damage_sprite.bitmap = bitmap
        @_damage_sprite.ox = 80
        @_damage_sprite.oy = 20
        @_damage_sprite.x = self.x
        @_damage_sprite.y = self.y - self.oy / 2
        @_damage_sprite.z = 3000
        @_damage_duration = 40
      end
    end
  end
 
  class Window_Domain < Window_Base
    def initialize
      super(0, 0, 160, 64)
      self.contents = Bitmap.new(width-32, height-32)
      refresh
    end
    def refresh
      self.contents.clear
      self.contents.draw_text(0, 0, self.contents.width, 32,
        "#{$game_map.domain.name}", 1)
    end
  end
end
#--------------------------------------------------------------------------
# ● End SDK Enabled Test
#--------------------------------------------------------------------------

#------------------------------------------------------------------------
# ● Domain_* Classes
#------------------------------------------------------------------------
# The Domain_* Classes are subclasses of the Domain class that predefine
# the information required by the Domain class to function. Otherwise,
# all domains would do nothing.
#------------------------------------------------------------------------

#--------------------------------------------------------------------------
# ● Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Global Domain Effects') == true

  # Domain ID=>'DomainName' where DomainName is the * in Domain_* for the
  # domain classes.
  DOMAIN_IDS = {1=>'Underwater',
                2=>'Fire',
                3=>'Swamp',
                4=>'Midair',
                5=>'Mountain',
                6=>'Seaside',
                7=>'Blessed',
                8=>'MagicBarrier'}
         
  #------------------------------------------------------------------------
  # ● Domain_Underwater
  #------------------------------------------------------------------------
  class Domain_Underwater < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 1
      @name = 'Underwater'
      @damage_increase_elements = [4]
      @damage_decrease_elements = [1]
      @effect_elements = [3]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(-68, -68, 16),
                                                   Color.new(0, 0, 48),
                                                   '022-Dive02')
    end
    #----------------------------------------------------------------------
    def effect(id)
      # Returns a string denoting what effect the element has. Valid effects:
      # 'mass target' - Hits all targets.
      # 'skill' - Chance to produce an additional skill.
      # 'mass skill' - Chance to produce an additional skill that hits all.
      case id
      when 3
        return 'mass target'
      end
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Fire
  #------------------------------------------------------------------------
  class Domain_Fire < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 2
      @name = 'Fire'
      @damage_over_time = Domain::Over_Time.new(2, 'percent')
      @damage_increase_elements = [1]
      @damage_decrease_elements = [2, 4]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(16, -68, -68),
                                                   Color.new(48, 0, 0))
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Swamp
  #------------------------------------------------------------------------
  class Domain_Swamp < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 3
      @name = 'Swamp'
      @plus_status_effects = Domain::Status.new([3])
      @damage_over_time = Domain::Over_Time.new(15, 'direct')
      @effect_elements = [6]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(-68, 16, -68),
                                                   Color.new(48, 0, 48))
    end
    #----------------------------------------------------------------------
    def effect(id)
      # Returns a string denoting what effect the element has. Valid effects:
      # 'mass target' - Hits all targets.
      # 'skill' - Chance to produce an additional skill.
      # 'mass skill' - Chance to produce an additional skill that hits all.
      case id
      when 6
        return 'skill'
      end
      return nil
    end
    #----------------------------------------------------------------------
    def special_skill(id)
      # Returns a skill id of a skill that will occur when a certain element
      # is used in battle. Such as an avalanche when an earth spell is cast.
      case id
      when 6
        return 33 # Venom
      end
      return nil
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Midair
  #------------------------------------------------------------------------
  class Domain_Midair < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 4
      @name = 'Midair'
      @damage_increase_elements = [6]
      @damage_decrease_elements = [5]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(0, 0, 0))
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Mountain
  #------------------------------------------------------------------------
  class Domain_Mountain < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 5
      @name = 'Mountain'
      @damage_increase_elements = [5]
      @effect_elements = [5]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(0, 0, 0))
    end
    #----------------------------------------------------------------------
    def effect(id)
      # Returns a string denoting what effect the element has. Valid effects:
      # 'mass target' - Hits all targets.
      # 'skill' - Chance to produce an additional skill.
      # 'mass skill' - Chance to produce an additional skill that hits all.
      case id
      when 5
        return 'mass skill' if rand(100) > 80
      end
      return nil
    end
    #----------------------------------------------------------------------
    def special_skill(id)
      # Returns a skill id of a skill that will occur when a certain element
      # is used in battle. Such as an avalanche when an earth spell is cast.
      case id
      when 5
        return 21
      end
      return nil
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Seaside
  #------------------------------------------------------------------------
  class Domain_Seaside < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 6
      @name = 'Seaside'
      @damage_increase_elements = [4]
      @effect_elements = [4]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(0, 0, 0))
    end
    #----------------------------------------------------------------------
    def effect(id)
      # Returns a string denoting what effect the element has. Valid effects:
      # 'mass target' - Hits all targets.
      # 'skill' - Chance to produce an additional skill.
      # 'mass skill' - Chance to produce an additional skill that hits all.
      case id
      when 4
        return 'mass skill' if rand(100) > 80
      end
      return nil
    end
    #----------------------------------------------------------------------
    def special_skill(id)
      # Returns a skill id of a skill that will occur when a certain element
      # is used in battle. Such as an avalanche when an earth spell is cast.
      case id
      when 4
        return 18
      end
      return nil
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_Blessed
  #------------------------------------------------------------------------
  class Domain_Blessed < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 7
      @name = 'Blessed'
      @heal_over_time = Domain::Over_Time.new(5, 'percent')
      @minus_status_effects = Domain::Status.new([1, 3])
      @damage_increase_elements = [7]
      @damage_decrease_elements = [8]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(16, 16, 16))
    end
  end
 
  #------------------------------------------------------------------------
  # ● Domain_MagicBarrier
  #------------------------------------------------------------------------
  class Domain_MagicBarrier < Domain
    def initialize
      super()
      setup
    end
    #----------------------------------------------------------------------
    def setup
      @id = 8
      @name = 'MagicBarrier'
      @damage_decrease_elements = [1, 2, 3, 4, 5, 6, 7, 8]
      @screen_effects = Domain::Screen_Effects.new(Tone.new(24, 0, 24),
                                                   Color.new(32, 0, 32))
    end
  end
 
end
#--------------------------------------------------------------------------
# ● End SDK Enabled Test
#--------------------------------------------------------------------------
Expand to see the code.


Compatibility

Requires the RMXP SDK, which can be found here: Version 1.5
Class Job System

Applies two types of Job to each character, a Job and a Sub-Job. Read the instructions/demo to see how to set this up. This allows for say a Mage class to specialize in Fire/Water/Earth/Air, or a Swordsman to specialize in defensive techniques, physical techniques, magical techniques, etc.

It also includes an EXP report at the end of battle. Made to reflect the experience gain in character level, job level, and sub-job level.

Demo
Click Here

Screenshots
Screenshot 1 Spoiler
http://rm-dev.org/Scripts/Class%20Job%20System/Screenshot1.png[/img]

Screenshot 2 Spoiler
http://rm-dev.org/Scripts/Class%20Job%20System/Screenshot2.png[/img]

Screenshot 3 Spoiler
http://rm-dev.org/Scripts/Class%20Job%20System/Screenshot3.png[/img]


The Script
Content Hidden Spoiler
# Class and Profession System
# By Prexus
# Special Thanks: Fuso, Astro_Mech
# http://rm-dev.org
# All Rights Reserved
# Credit: Cogwheel for EXP Report bars.

# Redefinitions and additions to game_actor
class Game_Actor < Game_Battler
# Secondary class id
attr_accessor :profession_id
# Array for class/pro levels/exp
attr_accessor :class_level
attr_accessor :profession_level
attr_accessor :class_exp
attr_accessor :profession_exp
attr_accessor :end_of_classes

def setup(actor_id)
   actor = $data_actors[actor_id]
   @actor_id = actor_id
   @name = actor.name
   @character_name = actor.character_name
   @character_hue = actor.character_hue
   @battler_name = actor.battler_name
   @battler_hue = actor.battler_hue
   @class_id = actor.class_id
   @profession_id = 1 + (4*@class_id)
   # Set the variable @end_of_classes to the ID of the last class you want
   # and the ID before the start of professions.
   @end_of_classes = 4
   @weapon_id = actor.weapon_id
   @armor1_id = actor.armor1_id
   @armor2_id = actor.armor2_id
   @armor3_id = actor.armor3_id
   @armor4_id = actor.armor4_id
   @level = actor.initial_level
   @exp_list = Array.new(101)
   # Defines Class EXP Table
   @class_exp_list = Array.new(101)
   make_class_exp_list
   # Defines Profession EXP Table
   @profession_exp_list = Array.new(101)
   make_profession_exp_list
   make_exp_list
   @exp = @exp_list[@level]
   @class_level = []
   @class_exp = []
   # Sets-Up Class table based on the IDs in the database.
   # The line 1..4 means that Classes with the IDs 1 through 4 are "Classes"
   # whereas the rest of the classes are Professions. If you want to increase
   # the amount of Classes, just increase the 4. Make sure in the database
   # that classes are the first entries in the class tab.
   for i in 1..@end_of_classes
     @class_level[i] = 1
     @class_exp[i] = @class_exp_list[@class_level[i]]
   end
   @profession_level = []
   @profession_exp = []
   # This sets up the profession arrays based on IDs in the database.
   # The line 5..$data_classes.size means all the IDs from 5 to the end
   # are included as Professions rather than Classes. If you want more classes,
   # make sure to increase this number as well as the number above. They
   # should be +1 apart. (4, 5 // 12, 13 // etc.)
   for i in @end_of_classes+1..$data_classes.size
     @profession_level[i] = 1
     @profession_exp[i] = @profession_exp_list[@profession_level[i]]
   end     
   @skills = []
   @hp = maxhp
   @sp = maxsp
   @states = []
   @states_turn = {}
   @maxhp_plus = 0
   @maxsp_plus = 0
   @str_plus = 0
   @dex_plus = 0
   @agi_plus = 0
   @int_plus = 0
   # Skills learned are now based on class and profession level rather
   # than the character level. The character level governs statistical
   # growth rather than skill growth.
   # --
   # Teaches initial skills for class
   for i in 1..@class_level[@class_id]
     for j in $data_classes[@class_id].learnings
       if j.level == i
         learn_skill(j.skill_id)
       end
     end
   end
   # Teaches initial skills for profession
   for i in 1..@profession_level[@profession_id]
     for j in $data_classes[@profession_id].learnings
       if j.level == i
         learn_skill(j.skill_id)
       end
     end
   end
   update_auto_state(nil, $data_armors[@armor1_id])
   update_auto_state(nil, $data_armors[@armor2_id])
   update_auto_state(nil, $data_armors[@armor3_id])
   update_auto_state(nil, $data_armors[@armor4_id])
end
# Mainly used for drawing in windows [draw_text(x,y,wid,hei, @actor.show_class_level)
# or something of the like]
def show_class_exp
   return @class_exp[@class_id]
end
def show_class_level
   return @class_level[@class_id]
end
def show_profession_level
   return @profession_level[@profession_id]
end
def show_profession_exp
   return @profession_exp[@profession_id]
end
def make_class_exp_list
   # Defines the Class exp table based on the first
   # character in the database
   actor = $data_actors[1]   
   @class_exp_list[1] = 0
   pow_i = 2.4 + actor.exp_inflation / 100.0
   for i in 2..100
     if i > actor.final_level
       @class_exp_list[i] = 0
     else
       n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
       @class_exp_list[i] = @class_exp_list[i-1] + Integer(n)
     end
   end
end
def make_profession_exp_list
   # Defines the Profession exp table based on the second
   # character in the database.
   actor = $data_actors[2]
   @profession_exp_list[1] = 0
   pow_i = 2.4 + actor.exp_inflation / 100.0
   for i in 2..100
     if i > actor.final_level
       @profession_exp_list[i] = 0
     else
       n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
       @profession_exp_list[i] = @profession_exp_list[i-1] + Integer(n)
     end
   end
end
# Forgets all skills, change 80 to the maximum number of skills in the
# database (80 is default)
def forget_all
   for i in 1...80
     if @skills.include?(i)
       @skills.delete(i)
     end 
   end
end
def element_rate(element_id)
   table = [0,200,150,100,50,0,-100]
   # Changed to take an average between Class and Profession's element ranks.
   result = table[$data_classes[@class_id].element_ranks[element_id]]
   result2 = table[$data_classes[@profession_id].element_ranks[element_id]]
   result /= result2
   result *= 100
   for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
     armor = $data_armors[i]
     if armor != nil and armor.guard_element_set.include?(element_id)
       result /= 2
     end
   end
   for i in @states
     if $data_states[i].guard_element_set.include?(element_id)
       result /= 2
     end
   end
   return result
end
def profession_state_ranks
   return $data_classes[@profession_id].state_ranks
end
def class_name
   return $data_classes[@class_id].name
end
def profession_name
   return $data_classes[@profession_id].name
end
def class_exp_s
   return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp[@class_id].to_s : "-------"
end
def next_class_exp_s
   return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp_list[@class_level[@class_id]+1].to_s : "-------"
end
def next_class_rest_exp_s
   return @class_exp_list[@class_level[@class_id]+1] > 0 ?
     (@class_exp_list[@class_level[@class_id]+1] - @class_exp[@class_id]).to_s : "-------"
end
def profession_exp_s
   return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp[@profession_id].to_s : "-------"
end
def next_profession_exp_s
   return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp_list[@profession_level[@profession_id]+1].to_s : "-------"
end
def next_profession_rest_exp_s
   return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ?
     (@profession_exp_list[@profession_level[@profession_id]+1] - @profession_exp[@profession_id]).to_s : "-------"
end
# Def Equippable? changed to detect if equipment is in the Class OR Profession sets.
def equippable?(item)
   if item.is_a?(RPG::Weapon)
     if $data_classes[@class_id].weapon_set.include?(item.id) or $data_classes[@profession_id].weapon_set.include?(item.id)
       return true
     end
   end
   if item.is_a?(RPG::Armor)
     if $data_classes[@class_id].armor_set.include?(item.id) or $data_classes[@profession_id].armor_set.include?(item.id)
       return true
     end
   end
   return false
end
# A redeclaration of def exp=(exp) which works for different classes.
# If you wish to add EXP to a character now, if you want to add to just
# the EXP use the regular event command but if you want to add to all the
# exp types, Call Script and use this line: $game_party.actors[ID].add_exp(amount)
def add_exp(value)
   @exp += value
   while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
     @level += 1
     for j in $data_classes[@class_id].learnings
       if j.level == @level
         learn_skill(j.skill_id)
       end
     end
   end
   while @exp < @exp_list[@level]
     @level -= 1
   end
   @class_exp[@class_id] += (value*0.75).floor
   while @class_exp[@class_id] >= @class_exp_list[@class_level[@class_id]+1] and @class_exp_list[@class_level[@class_id]+1] > 0
     @class_level[@class_id] += 1
     for j in $data_classes[@class_id].learnings
       if j.level == @class_level[@class_id]
         learn_skill(j.skill_id)
       end
     end
   end
   while @class_exp[@class_id] < @class_exp_list[@class_level[@class_id]]
     @class_level[@class_id] -= 1
   end
   @profession_exp[@profession_id] += (value*0.5).floor
   while @profession_exp[@profession_id] >= @profession_exp_list[@profession_level[@profession_id]+1] and @profession_exp_list[@profession_level[@profession_id]+1] > 0
     @profession_level[@profession_id] += 1
     for j in $data_classes[@profession_id].learnings
       if j.level == @profession_level[@profession_id]
         learn_skill(j.skill_id)
       end
     end
   end
   while @profession_exp[@profession_id] < @profession_exp_list[@profession_level[@profession_id]]
     @profession_level[@profession_id] -= 1
   end
   @hp = [@hp, self.maxhp].min
   @sp = [@sp, self.maxsp].min
end
# When changing classes, all skills are forgotten and relearned
def class_id=(class_id)
   if $data_classes[class_id] != nil
     @class_id = class_id
     unless equippable?($data_weapons[@weapon_id])
       equip(0, 0)
     end
     unless equippable?($data_armors[@armor1_id])
       equip(1, 0)
     end
     unless equippable?($data_armors[@armor2_id])
       equip(2, 0)
     end
     unless equippable?($data_armors[@armor3_id])
       equip(3, 0)
     end
     unless equippable?($data_armors[@armor4_id])
       equip(4, 0)
     end
     forget_all
     for i in 1..@class_level[@class_id]
       for j in $data_classes[@class_id].learnings
         if j.level == i
           learn_skill(j.skill_id)
         end
       end
     end
     for i in 1..@profession_level[@profession_id]
       for j in $data_classes[@profession_id].learnings
         if j.level == i
           learn_skill(j.skill_id)
         end
       end
     end
   end
end
# When changing profession, all skills are forgotten and relearned
def profession_id=(profession_id)
   if $data_classes[profession_id] != nil
     @profession_id = profession_id
     unless equippable?($data_weapons[@weapon_id])
       equip(0, 0)
     end
     unless equippable?($data_armors[@armor1_id])
       equip(1, 0)
     end
     unless equippable?($data_armors[@armor2_id])
       equip(2, 0)
     end
     unless equippable?($data_armors[@armor3_id])
       equip(3, 0)
     end
     unless equippable?($data_armors[@armor4_id])
       equip(4, 0)
     end
     forget_all
     for i in 1..@class_level[@class_id]
       for j in $data_classes[@class_id].learnings
         if j.level == i
           learn_skill(j.skill_id)
         end
       end
     end
     for i in 1..@profession_level[@profession_id]
       for j in $data_classes[@profession_id].learnings
         if j.level == i
           learn_skill(j.skill_id)
         end
       end
     end
   end
end
end

# Small modification to the way EXP is given at the end of battle.
class Scene_Battle
alias cps_scene_battle_main main
def main
   cps_scene_battle_main
   if @level_window != nil
     @level_window.dispose
   end
end
def start_phase5
   # ???? 5 ???
   @phase = 5
   # ????? ME ???
   $game_system.me_play($game_system.battle_end_me)
   # ??????? BGM ???
   $game_system.bgm_play($game_temp.map_bgm)
   # EXP???????????????
   exp = 0
   gold = 0
   treasures = []
   # ???
   for enemy in $game_troop.enemies
     # ??????????????
     unless enemy.hidden
       # ?? EXP????????
       exp += enemy.exp
       gold += enemy.gold
       # ?????????
       if rand(100) < enemy.treasure_prob
         if enemy.item_id > 0
           treasures.push($data_items[enemy.item_id])
         end
         if enemy.weapon_id > 0
           treasures.push($data_weapons[enemy.weapon_id])
         end
         if enemy.armor_id > 0
           treasures.push($data_armors[enemy.armor_id])
         end
       end
     end
   end
   # ???????? 6 ??????
   treasures = treasures[0..5]
   # EXP ??
   @level_window = Window_Level.new
   for i in 0...$game_party.actors.size
     actor = $game_party.actors[i]
     if actor.cant_get_exp? == false
       last_level = actor.level
       last_class_level = actor.class_level[actor.class_id]
       last_profession_level = actor.profession_level[actor.profession_id]
       actor.add_exp(exp)
       if actor.level > last_level
         @level_window.level_up(i)
       end
       if actor.class_level[actor.class_id] > last_class_level
         @level_window.class_up(i)
       end
       if actor.profession_level[actor.profession_id] > last_profession_level
         @level_window.profession_up(i)
       end
     end
   end
   # ??????
   $game_party.gain_gold(gold)
   # ???????
   for item in treasures
     case item
     when RPG::Item
       $game_party.gain_item(item.id, 1)
     when RPG::Weapon
       $game_party.gain_weapon(item.id, 1)
     when RPG::Armor
       $game_party.gain_armor(item.id, 1)
     end
   end
   # ???????????????
   @result_window = Window_BattleResult.new(exp, gold, treasures)
   # ???????????
   @phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ? ?????? (???????????)
#--------------------------------------------------------------------------
def update_phase5
   # ????????? 0 ???????
   if @phase5_wait_count > 0
     # ????????????
     @phase5_wait_count -= 1
     # ????????? 0 ??????
     if @phase5_wait_count == 0
       # ????????????
       @result_window.visible = true
       @level_window.visible = true
       # ??????????????
       $game_temp.battle_main_phase = false
       # ?????????????????
       @status_window.refresh
       @level_window.refresh
     end
     return
   end
   # C ??????????
   if Input.trigger?(Input::C)
     # ????
     battle_end(0)
   end
end
end

# Window to display the names of all the classes but not professions.
class Window_Classes < Window_Selectable
def initialize
   super(0, 0, 160, 160)
   @column_max = 1
   refresh
   self.index = 0
end
def classdata
   return @data[self.index]
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   # This for makes sure only to show the first four entries in $data_classes.
   # If you make more than 4 classes, be sure to modify these numbers.
   for i in 1..$game_party.actors[0].end_of_classes
     @data.push($data_classes[i])
   end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   x = 4
   y = index * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(x, y, 128, 32, item.name, 0)
end
end
# Window to display all the professions but not classes.
class Window_Professions < Window_Selectable
def initialize(class_id)
   super(0, 160, 160, 160)
   @column_max = 1
   @class_id = class_id
   refresh
   self.index = 0
end
def classdata
   return @data[self.index]
end
# Use this when updating so that only the appropriate professions are shown.
def new_class_id(class_id)
   @class_id = class_id
   refresh
end
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   # Little equation to only show the appropriate professions.
   # (@class_id - 1) * 4 makes sure to move ahead 4 for every class
   # since in the default system there are 4 professions for each class
   low = ($game_party.actors[0].end_of_classes + 1) + (@class_id - 1) * 4
   # Sets the high end of for loop to encompass all the professions for the
   # class. Since there are 4 per class its obviously 4 more.
   high = low + 4
   for i in low...high
     @data.push($data_classes[i])
   end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
end
def draw_item(index)
   item = @data[index]
   x = 4
   y = index * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(x, y, 128, 32, item.name, 0)
end
end

class Scene_ClassSelect
def initialize(actor_index = 0)
   @actor_index = actor_index
end
def main
   @actor = $game_party.actors[@actor_index]
   @class_win = Window_Classes.new
   @prof_win = Window_Professions.new(@actor.class_id)
   @prof_win.index = -1
   @prof_win.active = false
   @spriteset = Spriteset_Map.new
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @class_win.dispose
   @prof_win.dispose
   @spriteset.dispose
end
def update
   @class_win.update
   @spriteset.update
   if @class_win.active
     # Updates the profession list with the professions appropriate to
     # the class only.
     @prof_win.new_class_id(@class_win.index + 1)
   end
   @prof_win.update
   if @class_win.active
     update_class
     return
   end
   if @prof_win.active
     update_prof
     return
   end
end
def update_class
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(6)
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     @class_win.active = false
     @prof_win.index = 0
     @prof_win.active = true
     return
   end
end
def update_prof
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @prof_win.active = false
     @prof_win.index = -1
     @class_win.active = true
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     # Updates character's class and profession based on decisions.
     @actor.class_id = @class_win.classdata.id
     @actor.profession_id = @prof_win.classdata.id
     $scene = Scene_Map.new
     return
   end
end
end

# Updated version of the default battle result made to show the gains
# in Class EXP and Profession EXP (C-EXP/P-EXP)
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
  @exp = exp
  @gold = gold
  @treasures = treasures
  super(0, 0, 640, 192)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.visible = false
  refresh
end
def refresh
  self.contents.clear
  self.contents.font.color = system_color
  self.contents.draw_text(4, 0, 128, 32, "Gold:")
  self.contents.draw_text(4, 64, 128, 32, "EXP:")
  self.contents.draw_text(4, 96, 128, 32, "C-EXP:")
  self.contents.draw_text(4, 128, 128, 32, "P-EXP:")
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 0, 128, 32, @gold.to_s, 2)
  self.contents.draw_text(4, 64, 128, 32, @exp.to_s, 2)
  self.contents.draw_text(4, 96, 128, 32, (@exp*0.75).floor.to_s, 2)
  self.contents.draw_text(4, 128, 128, 32, (@exp*0.5).floor.to_s, 2)
  self.contents.font.color = system_color
  self.contents.draw_text(164, 0, 128, 32, "Items Found:")
  y = 32
  for item in @treasures
    draw_item_name(item, 164, y)
    y += 32
  end
end
end

# Small mod of Window_Base to show profession
class Window_Base
def draw_actor_class(actor, x, y)
   self.contents.font.color = normal_color
   self.contents.draw_text(x, y, 236, 32, actor.class_name + "/" + actor.profession_name)
end
end

# Temporary mod of Window_Status to show Class/Profession and Level.
class Window_Status < Window_Base
def refresh
   self.contents.clear
   draw_actor_graphic(@actor, 40, 112)
   draw_actor_name(@actor, 4, 0)
   draw_actor_level(@actor, 96, 32)
   draw_actor_state(@actor, 96, 64)
   draw_actor_hp(@actor, 96, 112, 172)
   draw_actor_sp(@actor, 96, 144, 172)
   draw_actor_parameter(@actor, 96, 192, 0)
   draw_actor_parameter(@actor, 96, 224, 1)
   draw_actor_parameter(@actor, 96, 256, 2)
   draw_actor_parameter(@actor, 96, 304, 3)
   draw_actor_parameter(@actor, 96, 336, 4)
   draw_actor_parameter(@actor, 96, 368, 5)
   draw_actor_parameter(@actor, 96, 400, 6)
   self.contents.font.color = system_color
   self.contents.draw_text(320, 48, 80, 32, "EXP")
   self.contents.draw_text(320, 80, 80, 32, "NEXT")
   self.contents.font.color = normal_color
   self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
   self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
   self.contents.font.color = system_color
   self.contents.draw_text(320, 160, 96, 32, "Equipment")
   draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
   draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
   draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
   draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
   draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
   # Mod is here
   self.contents.font.color = system_color
   self.contents.draw_text(320, 400, 200, 32, @actor.class_name.to_s)
   self.contents.draw_text(320, 424, 200, 32, @actor.profession_name.to_s)
   self.contents.font.color = normal_color
   self.contents.draw_text(320, 400, 200, 32, @actor.show_class_level.to_s, 2)
   self.contents.draw_text(320, 424, 200, 32, @actor.show_profession_level.to_s, 2)
end
end
class Window_Level < Window_Base
def initialize
   super(0, 192, 640, 128)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.visible = false
   @level_up_flags = [false, false, false, false]
   @class_up_flags = [false, false, false, false]
   @profession_up_flags = [false, false, false, false]
   refresh
end
def level_up(actor_index)
   @level_up_flags[actor_index] = true
end
def class_up(actor_index)
   @class_up_flags[actor_index] = true
end
def profession_up(actor_index)
   @profession_up_flags[actor_index] = true
end
def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     @actor = $game_party.actors[i]
     self.contents.font.color = normal_color
     self.contents.font.size = 18
     draw_actor_exp_bar(@actor, i * 160 + 4, 0, 120)
     draw_actor_class_bar(@actor, i * 160 + 4, 32, 120)
     draw_actor_profession_bar(@actor, i * 160 + 4, 64, 120)
     self.contents.draw_text(i * 160 + 4, 0, 120, 32, "Level")
     self.contents.draw_text(i * 160 + 4, 32, 120, 32, "C. Level")
     self.contents.draw_text(i * 160 + 4, 64, 120, 32, "P. Level")
     if @level_up_flags[i]
       self.contents.font.color = Color.new(0,255,0,255)
       self.contents.font.size = 24
       self.contents.draw_text(i * 160 + 4, 0, 120, 32, "+", 2)
     end
     if @class_up_flags[i]
       self.contents.font.color = Color.new(0,255,0,255)
       self.contents.font.size = 24
       self.contents.draw_text(i * 160 + 4, 32, 120, 32, "+", 2)
     end
     if @profession_up_flags[i]
       self.contents.font.color = Color.new(0,255,0,255)
       self.contents.font.size = 24
       self.contents.draw_text(i * 160 + 4, 64, 120, 32, "+", 2)
     end
   end
end
end

# Gradient Bars
# http://members.jcom.home.ne.jp/cogwheel/

class Game_Actor < Game_Battler
def now_exp
  return @exp - @exp_list[@level]
end
def next_exp
  return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
def now_class_exp
  return @class_exp[@class_id] - @class_exp_list[@class_level[@class_id]]
end
def next_class_exp
  return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp_list[@class_level[@class_id]+1] - @class_exp_list[@class_level[@class_id]] : 0
end
def now_profession_exp
  return @profession_exp[@profession_id] - @profession_exp_list[@profession_level[@profession_id]]
end
def next_profession_exp
  return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp_list[@profession_level[@profession_id]+1] - @profession_exp_list[@profession_level[@profession_id]] : 0
end
end

class Window_Base < Window
def draw_actor_exp_bar(actor, x, y, width = 144)
  if actor.next_exp != 0
    rate = actor.now_exp.to_f / actor.next_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_exp != 0
    exp = (width + plus_width) * actor.now_exp * rate_width /
                                                        100 / actor.next_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
   end
def draw_actor_class_bar(actor, x, y, width = 144)
  if actor.next_class_exp != 0
    rate = actor.now_class_exp.to_f / actor.next_class_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_class_exp != 0
    exp = (width + plus_width) * actor.now_class_exp * rate_width /
                                                        100 / actor.next_class_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
end
def draw_actor_profession_bar(actor, x, y, width = 144)
  if actor.next_profession_exp != 0
    rate = actor.now_profession_exp.to_f / actor.next_profession_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_profession_exp != 0
    exp = (width + plus_width) * actor.now_profession_exp * rate_width /
                                                        100 / actor.next_profession_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
end         
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
  case align1
  when 1
    x += (rect_width - width) / 2
  when 2
    x += rect_width - width
  end
  case align2
  when 1
    y -= height / 2
  when 2
    y -= height
  end
  self.contents.fill_rect(x, y, width, height, color1)
  self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  if align3 == 0
    if grade1 == 2
      grade1 = 3
    end
    if grade2 == 2
      grade2 = 3
    end
  end
  if (align3 == 1 and grade1 == 0) or grade1 > 0
    color = color3
    color3 = color4
    color4 = color
  end
  if (align3 == 1 and grade2 == 0) or grade2 > 0
    color = color5
    color5 = color6
    color6 = color
  end
  self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
                                color3, color4, grade1)
  if align3 == 1
    x += width - gauge
  end
  self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
                                color5, color6, grade2)
end
end

class Bitmap
def gradation_rect(x, y, width, height, color1, color2, align = 0)
  if align == 0
    for i in x...x + width
      red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
      green = color1.green +
              (color2.green - color1.green) * (i - x) / (width - 1)
      blue  = color1.blue +
              (color2.blue - color1.blue) * (i - x) / (width - 1)
      alpha = color1.alpha +
              (color2.alpha - color1.alpha) * (i - x) / (width - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(i, y, 1, height, color)
    end
  elsif align == 1
    for i in y...y + height
      red   = color1.red +
              (color2.red - color1.red) * (i - y) / (height - 1)
      green = color1.green +
              (color2.green - color1.green) * (i - y) / (height - 1)
      blue  = color1.blue +
              (color2.blue - color1.blue) * (i - y) / (height - 1)
      alpha = color1.alpha +
              (color2.alpha - color1.alpha) * (i - y) / (height - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(x, i, width, 1, color)
    end
  elsif align == 2
    for i in x...x + width
      for j in y...y + height
        red   = color1.red + (color2.red - color1.red) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color1.green + (color2.green - color1.green) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color1.blue + (color2.blue - color1.blue) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color1.alpha + (color2.alpha - color1.alpha) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  elsif align == 3
    for i in x...x + width
      for j in y...y + height
        red   = color1.red + (color2.red - color1.red) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color1.green + (color2.green - color1.green) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color1.blue + (color2.blue - color1.blue) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color1.alpha + (color2.alpha - color1.alpha) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  end
end
end
Expand to see the code.
PX Module

Three scripts in one, a Party Changer, an Inn, and a Beastiary. Each seperate (you can remove/add them at will). Instructions can be seen in the demo.

Note: Never remove the main PX Module or no scripts will work.

Demo
Click Here

Screenshots
Screenshot 1 Spoiler
http://rm-dev.org/Scripts/PX%20Module/Screenshot1.png[/img]

Screenshot 2 Spoiler
http://rm-dev.org/Scripts/PX%20Module/Screenshot2.png[/img]

Screenshot 3 Spoiler
http://rm-dev.org/Scripts/PX%20Module/Screenshot3.png[/img]


The Script
Content Hidden Spoiler
http://rm-dev.org/Scripts/PX%20Module/PX%20Module.txt
Expand to see the code.
Sketch

Made to mimic Relm's Sketch ability from Final Fantasy 6. Its not completely accurate, instead of pulling abilities from a specific list it just picks on of the monster's abilities at random and uses it. Great for adding dynamics to battles.

Note: Change the Sketch skill at the top of the script ($SKETCH_ID = 81)

The Demo
Click Here

Screenshots

None

The Script
Content Hidden Spoiler
#------------------
# Sketch
# by Prexus
# Mimics the ability Sketch by Relm in Final Fantasy 6
# Randomly selects one of the monster's abilities and uses it
# http://rm-dev.org/
#------------------

class Scene_Battle
 
  # Set the ID of the Sketch skill here:
  $SKETCH_ID = 81
 
  # Do not edit any of the following:
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    if @skill.id == $SKETCH_ID
      set_target_battlers(@skill)
      for target in @target_battlers
        enemy = $data_enemies[target.id]
        skills = []
        for i in 0...enemy.actions.size
          if enemy.actions[i].kind = 1
            if enemy.actions[i].condition_level <= @active_battler.level
              skills.push($data_skills[enemy.actions[i].skill_id])
            end
          end
        end
        if skills.size != 0
          # Randomly picks an enemy's skill
          @skill = skills[rand(skills.size)-1]
        else
          # Clear battler being forced into action
          $game_temp.forcing_battler = nil
          # Shift to step 1
          @phase4_step = 1
          return
        end
      end
    end
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    if skills != nil
      skills = []
      skills = nil
      @target_battlers = []
      sketch = true
    else
      @active_battler.sp -= @skill.sp_cost
      sketch = false
    end
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill, sketch)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
 
  alias stb set_target_battlers
  def set_target_battlers(skill, sketch = false)
    if sketch
      if @active_battler.is_a?(Game_Enemy)
        case skill.scope
        when 1
          index = rand($game_party.actors.size)-1
          @target_battlers.push($game_party.smooth_target_actor(index))
        when 2
          for actor in $game_party.actors
            if actor.exist?
              @target_battlers.push(actor)
            end
          end
        when 3
          index = rand($game_troop.enemies.size)-1
          @target_battlers.push($game_troop.smooth_target_enemy(index))
        when 4
          for enemy in $game_troop.enemies
            if enemy.exist?
              @target_battlers.push(enemy)
            end
          end
        when 5
          index = rand($game_troop.enemies.size)-1
          enemy = $game_troop.enemies[index]
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        when 6
          for enemy in $game_troop.enemies
            if enemy != nil and enemy.hp0?
              @target_battlers.push(enemy)
            end
          end
        when 7
          @target_battlers.push(@active_battler)
        end
      end
      if @active_battler.is_a?(Game_Actor)
        case skill.scope
        when 1
          index = rand($game_troop.enemies.size)-1
          @target_battlers.push($game_troop.smooth_target_enemy(index))
        when 2
          for enemy in $game_troop.enemies
            if enemy.exist?
              @target_battlers.push(enemy)
            end
          end
        when 3
          index = rand($game_party.actors.size)-1
          @target_battlers.push($game_party.smooth_target_actor(index))
        when 4
          for actor in $game_party.actors
            if actor.exist?
              @target_battlers.push(actor)
            end
          end
        when 5
          index = rand($game_party.actors.size)-1
          actor = $game_party.actors[index]
          if actor != nil and actor.hp0?
            @target_battlers.push(actor)
          end
        when 6
          for actor in $game_party.actors
            if actor != nil and actor.hp0?
              @target_battlers.push(actor)
            end
          end
        when 7
          @target_battlers.push(@active_battler)
        end
      end
      return
    end
    stb(skill.scope)
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    #if not skill_learn?(skill_id)
    #  return false
    #end
    return super
  end
end
Expand to see the code.
World Objects

Adds any number of skills to the game to reflect out-of-combat skills, such as Gathering and Fishing. Works great with Axe Man Deke's Combination script. Skills level up, but there is no where to see what skill level your character is at. This'll be updated sooner or later.

Demo
Click Here

Screenshots
Screenshot 1 Spoiler
http://rm-dev.org/Scripts/World%20Objects/Screenshot1.png[/img]

Screenshot 2 Spoiler
http://rm-dev.org/Scripts/World%20Objects/Screenshot2.png[/img]

Screenshot 3 Spoiler
http://rm-dev.org/Scripts/World%20Objects/Screenshot3.png[/img]


The Script
Content Hidden Spoiler
#==========================================================================
# ** World Objects
#--------------------------------------------------------------------------
# Sylver
# Version 1.0
# February 7th 2006
#==========================================================================
# Instructions:
#
# To add new gathering types, find the line [ADD TYPE] and follow
# the instructions below it.
#
# To add a world object event, create an event and add comments to it.
# They must be in the format:
# Comment: World Setup
# Comment: Type skillName
# Comment: Level aNumber
# Comment: Result resType itemId numTries
#
# - skillName must correspond with a skill defined in the script (read
# above to learn how to add new skills).
# - aNumber must be a number between 1-100. This is the level of the gathering
# node. If the level is higher than the gatherer's skill level in that type,
# it cannot be gathered from.
# - resType has to be one of the following:
# Item
# Weapon
# Armor
# This determines which type of item will result if you gather from the node.
# - itemId is the ID of the item you wish to be able to gather from the node;
# it must exist in the database.
# - numTries is the amount of times you can attempt to gather from the source.
# It'll reduce if you fail as well as if you succeed.
#
# The default key to harvest nodes (gathering spots) is Input::A, which is
# either Z or Shift in the default controls.
#==========================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------

SDK.log('World Objects', 'Sylver', 1, '07.02.06')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state('World Objects') == true
 
  #------------------------------------------------------------------------
  # * World Class
  #------------------------------------------------------------------------
  # This is the core class and holds subclasses of each functionality of
  # the World Objects scripts.
  # World::Object, World::Skills, and World::Window_Get are subclasses.
  #------------------------------------------------------------------------
  class World
    #----------------------------------------------------------------------
    attr_accessor :objects
    attr_accessor :skills
    #----------------------------------------------------------------------
    def initialize
      @objects = {}
      @skills = []
      # [ADD TYPE]
      # To add new skills, add the line:
      # @skills.push(World::Skills.new("skillName", requiredItemID))
      # where skillName is the name of the skill, and requiredItemID
      # is the id of a weapon that has to be equipped to perform the
      # gathering. Such as a Pick Axe, or a Fishing Pole.
      # If you don't put an item id, there will be no required item to
      # perform the gathering skill.
      # Example:
      # @skills.push(World::Skills.new("Herbalism"))
      # @skills.push(World::Skills.new("Mining", 32))
      @skills.push(World::Skills.new("Herbalism"))
      @skills.push(World::Skills.new("Mining", 32))
      @skills.push(World::Skills.new("Fishing", 31))
    end
    #----------------------------------------------------------------------
    def setup(events)
      @objects = {}
      for event in events.values
        parameters = SDK.event_comment_input(event, 3, 'World Setup')
        next if !parameters
        type = parameters[0].split
        level = parameters[1].split
        result = parameters[2].split
        @objects[event.id] = World::Object.new(type[1], level[1], result[1],
          result[2], result[3], event.id)
      end
    end
    #----------------------------------------------------------------------
    def check_gather
      for object in @objects.values
        next unless check_range(object.event_id)
        object.gather($game_party.actors[0])
        return
      end
    end
    #----------------------------------------------------------------------
    def check_range(event_id, range = 1)
      element = $game_player
      object = $game_map.events[event_id]
      x = (object.x - element.x) * (object.x - element.x)
      y = (object.y - element.y) * (object.y - element.y)
      r = x + y
      if r <= (range * range)
        if element.direction == 2 # Down
          return true if (object.x == element.x) and (object.y > element.y)
        end
        if element.direction == 4 # Left
          return true if (object.y == element.y) and (object.x < element.x)
        end
        if element.direction == 6 # Right
          return true if (object.y == element.y) and (object.x > element.x)
        end
        if element.direction == 8 # Up
          return true if (object.x == element.x) and (object.y < element.y)
        end
      end
      return false
    end
    #----------------------------------------------------------------------
    def erase_object(object)
      event = $game_map.events[object.event_id]
      key = [event.map_id, event.id, 'A']
      $game_self_switches[key] = true
      $game_map.refresh
      @objects.delete(object.event_id)
    end
    #----------------------------------------------------------------------
    # * Object
    #----------------------------------------------------------------------
    # This handles the objects by making them into 'special events' which
    # are managed and interacted with via. the World class.
    #----------------------------------------------------------------------
    class Object
      attr_accessor :type
      attr_accessor :level
      attr_accessor :result_type
      attr_accessor :result
      attr_accessor :tries
      attr_accessor :event_id
      #--------------------------------------------------------------------
      def initialize(type, level, result_type, result, tries, event_id)
        for ski in $world.skills
          if ski.name == type
            @type = ski
          end
          break if @type
        end
        $world.erase_object(self) unless @type
        @level = level.to_i
        @result_type = result_type
        @result = result.to_i
        @tries = tries.to_i
        @event_id = event_id.to_i
      end
      #--------------------------------------------------------------------
      def gather(actor)
        skill_level = actor.gather_skill[@type]
        text1 = ""
        text2 = ""
        if @type.item_id != 0
          if @type.item_id != $game_party.actors[0].weapon_id
            $game_system.se_play($data_system.buzzer_se)
            text1 = "You require a #{$data_weapons[@type.item_id].name} equipped"
            $scene.get_window.start(text1, text2)
            return
          end
        end
        if skill_level < @level
          $game_system.se_play($data_system.buzzer_se)
          text1 = "Skill not sufficient"
          $scene.get_window.start(text1, text2)
          return
        end
        if rand(100) < (100 - @level)
          case @result_type.upcase
          when "ITEM"
            $game_party.gain_item(@result, 1)
            text1 = "Gathered #{$data_items[@result].name}"
          when "WEAPON"
            $game_party.gain_weapon(@result, 1)
            text1 = "Gathered #{$data_weapons[@result].name}"
          when "ARMOR"
            $game_party.gain_armor(@result, 1)
            text1 = "Gathered #{$data_armors[@result].name}"
          end
          if skill_level < @type.max_level
            if (skill_level < @level + 10) and (rand(100)+@level > skill_level)
              actor.gather_skill[@type] += 1
              text2 = "(#{@type.name} skill up!)"
            end
          end
          $game_system.se_play($data_system.decision_se)
        else
          text1 = "Failed Attempt."
          $game_system.se_play($data_system.cancel_se)
        end
        $scene.get_window.start(text1, text2)
        @tries -= 1
        $world.erase_object(self) if @tries <= 0
      end
    end
    #----------------------------------------------------------------------
    # * Skills
    #----------------------------------------------------------------------
    # This object is a container that holds the values for skills and
    # organizes them for future reference. These are not RMXP's default
    # 'skills' but instead gathering skills which are used to seperate
    # different kinds of gathering points.
    #----------------------------------------------------------------------
    class Skills
      attr_accessor :name
      attr_accessor :max_level
      attr_accessor :item_id
      #--------------------------------------------------------------------
      def initialize(name, item_id = 0, max_level = 100)
        @name = name.to_s
        @max_level = max_level.to_i
        @item_id = item_id.to_i
      end
    end
    #----------------------------------------------------------------------
    # * Window_Get
    #----------------------------------------------------------------------
    # This is a special window, similar to the Help Window in RMXP's
    # non-extended code. However it will appear and fade automatically when
    # new text is added. It is the standard way for World Objects to display
    # information to the player.
    #----------------------------------------------------------------------
    class Window_Get < Window_Base
      def initialize
        super(16, 16, 608, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.opacity = 0
        self.back_opacity = 0
        self.contents_opacity = 0
        @text = ""
        @text2 = ""
      end
      #--------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.draw_text(4, 0, self.contents.width - 8, 32,
          "#{@text.to_s} #{@text2.to_s}", 1)
      end
      #--------------------------------------------------------------------
      def start(text, text2 = "")
        @text = text
        @text2 = text2
        @timer = 0
        refresh
      end
      #--------------------------------------------------------------------
      def update
        if @text != "" and self.opacity != 0
          if $game_player.y <= 5
            self.y = 400 if self.y == 16
          else
            self.y = 16 if self.y == 400
          end
        end
        if @text != "" and self.opacity != 255
          self.opacity += 20 unless self.opacity >= 255
          self.back_opacity += 10 unless self.back_opacity >= 120
          self.contents_opacity += 20 unless self.contents_opacity >= 255
        elsif @text == "" and self.opacity != 0
          self.opacity -= 20 unless self.opacity <= 0
          self.back_opacity -= 10 unless self.back_opacity <= 0
          self.contents_opacity -= 20 unless self.contents_opacity <= 0
        elsif @text != "" and self.opacity >= 255
          @timer += 1
          @text = "" if @timer == 100
          @text2 = "" if @timer == 100
        end
      end
    end
  end
  #------------------------------------------------------------------------
  # * Scene_Map
  #------------------------------------------------------------------------
  # RMXP's Default Scene_Map editted via aliases to include the Window_Get
  # subclass of the World class and to take proper input to control the
  # World class and the Objects within it.
  #------------------------------------------------------------------------
  class Scene_Map
    attr_accessor :get_window
    #----------------------------------------------------------------------
    alias prx_world_s_map_main_draw main_draw
    #----------------------------------------------------------------------
    def main_draw
      @get_window = World::Window_Get.new
      prx_world_s_map_main_draw
    end
    #----------------------------------------------------------------------
    alias prx_world_s_map_update update
    #----------------------------------------------------------------------
    def update
      $world.check_gather if (Input.trigger?(Input::A) and
                             @get_window.opacity <= 0)
      @get_window.update
      prx_world_s_map_update
    end
  end
  #------------------------------------------------------------------------
  # * Game_Actor
  #------------------------------------------------------------------------
  # RMXP's Default Game_Actor editted via aliases to initialize the
  # @gather_skill hash properly. Also includes the train_skill() method to
  # update that hash accordingly when learning new skills, and the
  # untrain_skill() method which does the same.
  #------------------------------------------------------------------------
  class Game_Actor
    attr_accessor :gather_skill
    #----------------------------------------------------------------------
    alias prx_world_g_actor_setup setup
    #----------------------------------------------------------------------
    def setup(actor_id)
      prx_world_g_actor_setup(actor_id)
      @gather_skill = Hash.new(0)
    end
    #----------------------------------------------------------------------
    def train_skill(name, level = 1)
      for ski in $world.skills
        if ski.name == name
          @gather_skill[ski] = level
          if $scene.is_a?(Scene_Map)
            $scene.get_window.start("#{@name} learned #{ski.name}!")
          end
          return
        end
      end
    end
    #----------------------------------------------------------------------
    def untrain_skill(name)
      for ski in $world.skills
        if ski.name == name
          @gather_skill[ski] = nil
          @gather_skill.flatten
          if $scene.is_a?(Scene_Map)
            $scene.get_window.start("#{@name} forgot #{ski.name}!")
          end
          return
        end
      end
    end
  end
  #------------------------------------------------------------------------
  # * Game_Map
  #------------------------------------------------------------------------
  # RMXP's Default Game_Map editted via alias to initialize the World class
  # object once and then reassign all the special events each time a new
  # map is loaded.
  #------------------------------------------------------------------------
  class Game_Map
    alias prx_world_g_map_setup setup
    #----------------------------------------------------------------------
    def setup(map_id)
      prx_world_g_map_setup(map_id)
      $world = World.new if !$world
      $world.setup(@events)
    end
  end
  #------------------------------------------------------------------------
  # * Game_Event
  #------------------------------------------------------------------------
  # Editted to include the variable map_id as a reader attribute.
  #------------------------------------------------------------------------
  class Game_Event
    attr_reader :map_id
  end
 
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end
Expand to see the code.


Compatibility

Requires the RMXP SDK, which can be found here: Version 1.5
Where is your after batte report system?
Wait do all of these require the Standard Development kit to work at all?
[QUOTE=Prexus]Action Battle System

Battle system like Zelda, on map. This one is limited to four directions, and automatically targets the closest monster when casting spells. Use the A S and D keys to set Hotkeys in the Skill menu, and press Shift to attack.

Demo
Click Here

Screenshots
Screenshot 1 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot1.png[/img]

Screenshot 2 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot2.png[/img]

Screenshot 3 Spoiler
http://rm-dev.org/Scripts/Action%20Battle%20System/Screenshot3.png[/img]


The Script

[spoiler][code]=begin

--------------------------------------------------------------------------------
Prexus ABS build 1.0.2
********REQUIRES RMXP SDK TO WORK********
* Instructions
--------------------------------------------------------------------------------

Topics:
- Default Controls [ABS.DC]
- How to Setup an Enemy [ABS.SE]
- Setting Up Skill Ranges [ABS.SR]
- Setting Up ABS Options [ABS.AO]
- ABS Changes in Run Time [ABS.RT]
- ABS Graphics [ABS.AG]
- Animation Engine [ABS.AE]

--------------------------------------------------------------------------------
* Default Controls: [ABS.DC]
ex:
Action | Input | Default Key
--------------------------------------------------------------------------------

Melee Attack | Input::A | Shift, Z
Hotkey 1 | Input::X | A
Hotkey 2 | Input::Y | S
Hotkey 3 | Input::Z | D
Guard/Defend | Input::L | Q
Show HUD | Input::R | W

--------------------------------------------------------------------------------
* How to Setup an Enemy: [ABS.SE]
ex:
Comment: ABS Setup
Comment: Name Ghost
Comment: Troop GhostSquadA
Comment: Trigger Erase
--------------------------------------------------------------------------------

To set up an enemy to work with the ABS, you must add comments to the event.

The first comment must read 'ABS Setup' so that the ABS detects the enemy.

The second comment is used to reference the event to an enemy in the database,
you set it up by putting 'Name ' followed by the name of an enemy in the database.
If you put the name of an enemy that doesn't exist, it register the enemy in the
ABS so be sure to pick a valid enemy.

The third comment is unique to Prexus' ABS. If two or more enemies share the same
Troop, they will interact as a team. That means they will heal each other and if
one enemy becomes engaged, the second will as well. You set it up by putting
'Troop ' followed by the name of the troop. It can be any string variable. If you
put nothing, and leave it as 'Troop ' it will assign a unique troop. Meaning the
enemy will not call any allies or heal anyone else but itself.

The fourth comment defines how the enemy will die. There are four options,
Erase, Switch, Local, and Chest. Each has unique properties as to how the death
of the enemy is handled.
Erase: Erase will simply make the event dissapear. It'll reappear next time you
load the map, making this a quick and clean way to dispose of enemies.
Switch: Switch will trigger a switch, choosen by putting an ID after the word
switch. Such as 'Trigger Switch 2'. You will probably want to add a
second page to the event with the switch as a precondition or else this
will cause the game to act wonky. This is good for handling Boss monsters
or any enemy which triggers an event or that you don't want to reappear.
Local: Local will trigger a Local Switch (or Self Switch). You choose this by
putting either A, B, C, or D after the word Local. Such as 'Trigger
Local A'. This is good because it doesn't use up switches. I've also
made it so when you leave a map, whatever switch was picked will
automagically turn off so the enemy will reappear next time you load the
map. Neat huh?
Chest: This is used in the ABS demo game, Umbral Wake, often. It works similar
to Local. You don't have to put anything after Chest, it'll automatically
turn on SelfSwitch A. However when you leave the map and return, it'll
turn off all of the SelfSwitches (A, B, C and D) regardless. The best
examples of the use of this is in Umbral Wake so refer to it for example.

Thats all that is necessary to set up an event. Refer to Umbral Wake for examples.

--------------------------------------------------------------------------------
* Setting up Skill Ranges [ABS.SR]
ex.
when "Cross Cut"
@range = 2
--------------------------------------------------------------------------------

Another unique feature to Prexus' ABS is Spell Ranges. Unlike Near's ABS, when
casting a spell you aren't required to aim it and make sure that a ranged object
hits the target.

In Prexus' ABS, when you cast a spell, it automatically finds all enemies within
the range of the spell (in tiles) and chooses the best subject to hit based on
the type of spell.

All you have to do to set up a skill range is go to the 'Prexus ABS (User)' script
and add the lines of code as seen in the instructions available there.

--------------------------------------------------------------------------------
* Setting up ABS Options [ABS.AO]
ex.
@p_animations = true
@e_animations = false
@portrait = false
--------------------------------------------------------------------------------

Prexus' ABS comes with a built in Animation Engine. Whats that? Well, it handles
animating the player's character graphic to do certain things. By default, it
handles Attacking (swinging the sword), Casting, and being Hit.

If you don't want that feature for the player, you set @p_animations to false.
If you don't want the feature for the enemies, you set @e_animations to false.

Also, the HUD will display a portrait of your character. This is a small picture
depicting your character's likeness. If you don't wish to have it show that, and
instead want to show the character's characterset graphic, you simply change
@portrait to false.

The portraits are found by the ABS in the folder ..\Graphics\ABS\portraits\ and
must share the same name as the Actor (Such as Aluxes.png for Aluxes).

--------------------------------------------------------------------------------
* ABS Changes in Run Time [ABS.RT]
--------------------------------------------------------------------------------

During runtime you can enable and disable the ABS. This is good for town areas
and world maps.
To do this use the Call Script event function and put either:

$ABS.enable
or
$ABS.disable

I suggest putting the Call Script after everything else if being used in a map
changing event. See Umbral Wake for better examples.

--------------------------------------------------------------------------------
* ABS Graphics [ABS.AG]
--------------------------------------------------------------------------------

The ABS has only one required graphic for the HUD. It has to be called 'Background'
and needs to be in the directory ..\Graphics\ABS\
Umbral Wake has a graphic you are welcome to use for the HUD. It can be found in
the demo game at http://rm-dev.org/

--------------------------------------------------------------------------------
* Animation Engine [ABS.AE]
--------------------------------------------------------------------------------

The animation engine requires specific names for character graphics, if you are
using it (see * Setting up ABS Options to disable).

There are three required files, Attacking, Casting, and Being Hit. They must be
named as follows:

originalFileName-atk
originalFileName-cast
originalFileName-hit

The originalFileName is the character graphic of the hero's file name.

ex. For Aluxes, this would be written like so:

001-Fighter01-atk
001-Fighter01-cast
001-Fighter01-hit

ex. For Lisa in the Umbral Wake demo game, its written as:

LisaABS-atk
LisaABS-cast
LisaABS-hit

If the ABS is enabled to show animations for enemies (see * Setting up ABS
Options to disable), you also need graphics for the enemy as well. They are set
the same way.

ex. But for good measure, for the Ghost enemy:

051-Undead01-atk
051-Undead01-cast
051-Undead01-hit

Umbral Wake doesn't use the enemy animations.

=end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------

SDK.log('Prexus ABS', 'Prexus', 1, '18.12.05')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state('Prexus ABS') == true

#------------------------------------------------------------------------
# * Action Battle System (ABS) Class
#------------------------------------------------------------------------
# The core class and functional epicenter of the Action Battle System
#------------------------------------------------------------------------
class ABS
attr_accessor :p_animations
attr_accessor :e_animations
attr_accessor :player
attr_accessor :enemies
attr_accessor :events
attr_accessor :event_triggers
attr_reader :enabled
#----------------------------------------------------------------------
# * Initialization Handlers
#----------------------------------------------------------------------
# Makes sure that everything is set up to start the ABS
#----------------------------------------------------------------------
def initialize
@enabled = false
@player = $game_party.actors[0] # Sets to leader player
@enemies = {} # Enemy Hash
@events = {} # Hash of Dead Events
@event_triggers = {} # Hash of the Triggers of Dead Events
end
#----------------------------------------------------------------------
def setup_enemies(events)
@enemies = {} # Reset Enemy Hash
for event in events.values
parameters = SDK.event_comment_input(event, 3, 'ABS Setup')
next if !parameters
name = parameters[0].split
troop = parameters[1].split
trigger = parameters[2].split
for monster in $data_enemies
next if !monster
if name[1].upcase == monster.name.upcase
@enemies[event.id] = ABS::Enemy.new(monster.id)
@enemies[event.id].event_id = event.id
@enemies[event.id].troop = "ABS #{event.id}"
@enemies[event.id].troop = troop[1].upcase unless troop[1] == nil
@enemies[event.id].trigger_type = trigger[1].upcase
@enemies[event.id].trigger = trigger[2]
end
break if @enemies[event.id] != nil
end
end
end
#----------------------------------------------------------------------
def enable
@enabled = true
setup_enemies($game_map.events)
$scene.hud_window.visible = true if $scene.is_a?(Scene_Map)
update
end
#----------------------------------------------------------------------
def disable
@enabled = false
for enemy in @enemies.values
enemy.disengage
end
@enemies = {}
end
#----------------------------------------------------------------------
# * Update Handlers
#----------------------------------------------------------------------
# Updates and refreshes any information regarding characters, enemies,
# the ABS itself, or the graphic displays.
#----------------------------------------------------------------------
def update
update_player # Checks and updates player related stuff
for enemy in @enemies.values
update_enemy(enemy) # Checks and updates enemy related stuff
end
update_status # Checks and updates engine related stuff
update_hud # Checks and updates display related stuff
end
#----------------------------------------------------------------------
def update_player
@player = $game_party.actors[0] # Makes sure player is correct
# Decrease cooldown
@player.abs.chill if @player.abs.acted and @player.abs.cooldown != 0
# Reset acted if cooldown is over
@player.abs.acted = false if @player.abs.cooldown == 0
# Reset variables if player's cooldown has been reset
@player.abs.reset unless @player.abs.acted
end
#----------------------------------------------------------------------
def update_enemy(enemy)
enemy.find_player # Checks if player is close
if enemy.engaged
enemy.guarding = false # Resets guarding
enemy.chill if enemy.cooldown != 0 # Decrease cooldown
if enemy.cooldown == 0
enemy.reset if enemy.check_ai # Reset timers
enemy.cooldown /= 2 if enemy.guarding
end
enemy.path_find # Pathfind to the player
end
if enemy.dead?
collect_spoils(enemy) # Collect items and exp
remove(enemy) # Remove enemy based on its triggers
end
end
#----------------------------------------------------------------------
def update_status
$game_temp.gameover = true if $game_party.all_dead? # End game if dead.
end
#----------------------------------------------------------------------
def update_hud
#hud shit goes here
end
#----------------------------------------------------------------------
# * ABS Functions
#----------------------------------------------------------------------
# Handles anything regarding the ABS best done outside of other classes
#----------------------------------------------------------------------
def collect_spoils(enemy)
exp = enemy.exp # Set to the enemy's EXP amount
gold = enemy.gold # Set to the enemy's GOLD amount
if rand(100) < enemy.treasure_prob # Random Probability of SPOIL
if enemy.item_id > 0 # If its an ITEM
treasure = $data_items[enemy.item_id]
end
if enemy.weapon_id > 0 # If its a WEAPON
treasure = $data_weapons[enemy.weapon_id]
end
if enemy.armor_id > 0 # If its an ARMOR
treasure = $data_armors[enemy.armor_id]
end
end
@player.exp += exp unless @player.cant_get_exp? # Add Appropriate EXP
$game_party.gain_gold(gold) # Add Appropriate GOLD
case treasure
when RPG::Item
$game_party.gain_item(item.id, 1) # Add ITEM
when RPG::Weapon
$game_party.gain_weapon(item.id, 1) # Add WEAPON
when RPG::Armor
$game_party.gain_armor(item.id, 1) # Add ARMOR
end
end
#----------------------------------------------------------------------
def remove(enemy)
@enemies.delete(enemy.event_id) # Remove dead enemy from hash
case enemy.trigger_type
when 'LOCAL' # If trigger is a local switch
case enemy.trigger.upcase
when 'A','B','C','D' # If the trigger is a valid trigger
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, enemy.trigger.upcase]
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger.upcase
return
end
when 'SWITCH' # If the trigger is a switch
if enemy.trigger.to_i > 0 # If the trigger is a valid switch
$game_switches[enemy.trigger.to_i] = true
return
end
when 'CHEST'
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, 'A']
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger_type.upcase
return
end
# Else just remove the event lickity split.
$game_map.events[enemy.event_id].character_name = ''
$game_map.events[enemy.event_id].erase
end
#----------------------------------------------------------------------
# * Calculation Functions
#----------------------------------------------------------------------
# Handles range and direction checks
#----------------------------------------------------------------------
def check_range(element, object, range = 0)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
r = x + y
if r <= (range * range)
return true
end
return false
end
#----------------------------------------------------------------------
def find_range(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
return (x + y)
end
#----------------------------------------------------------------------
def check_facing(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
if element.direction == 2
return true if object.y >= element.y
end
if element.direction == 4
return true if object.x <= element.x
end
if element.direction == 6
return true if object.x >= element.x
end
if element.direction == 8
return true if object.y <= element.y
end
return false
end
#----------------------------------------------------------------------
# * ABS Animation Engine Functions
#----------------------------------------------------------------------
# Handles animating map sprites for a wide variety of uses
#----------------------------------------------------------------------
def animate(object, animation_name, position, wait = 8, frames = 0, repeat = 0)
if object != nil
object.animate(animation_name, position, frames, wait, repeat)
end
end
#----------------------------------------------------------------------
# * ABS Enemy Object
#----------------------------------------------------------------------
# This object handles interaction between the event and the enemy and
# deals with all the attacks and such.
#----------------------------------------------------------------------
class Enemy < Game_Battler
attr_accessor :event_id
attr_accessor :engaged
attr_accessor :trigger_type
attr_accessor :trigger
attr_accessor :cooldown
attr_accessor :dis_cooldown
attr_accessor :guarding
attr_accessor :troop
#--------------------------------------------------------------------
# * Initialize Handlers
#--------------------------------------------------------------------
# Handles setting up all the stats and information needed by the ABS
#--------------------------------------------------------------------
def initialize(monster_id)
super()
@event_id = 0
@enemy_id = monster_id
@trigger_type = nil
@trigger = nil
@engaged = false
@guarding = false
@cooldown = 0
@dis_cooldown = 0
@move_type = 0
@move_frequency = 0
@move_speed = 0
@hp = maxhp
@sp = maxsp
@troop = nil
end
#--------------------------------------------------------------------
# * Enemy Artificial Intelligence
#--------------------------------------------------------------------
# Handles the enemy's decision making and priorities.
#--------------------------------------------------------------------
def check_ai
check_status
return true if check_self_status
return true if check_troop_status
return false unless @engaged
return true if check_range_spell if @hp < (maxhp/25)
return true if check_melee_attack
return true if check_range_spell unless @hp < (maxhp/25)
@guarding = (1 == rand(5))
return @guarding
end
#--------------------------------------------------------------------
def set_skills(kind = 1)
skills = []
for action in $data_enemies[@enemy_id].actions
skills.push($data_skills[action.skill_id]) if action.kind == kind
end
return skills
end
#--------------------------------------------------------------------
def check_self_status
if @hp < (maxhp/25)
skills = set_skills(1)
return false if skills.size == 0 or skills == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4, 7].include?(skill.scope) and skill.power < 0
case skill.scope
when 3,7
target_enemies = [self]
when 4
target_enemies = []
for enemy in $ABS.enemies.values
target_enemies.push(enemy) if enemy.troop == @troop and
$ABS.check_range($game_map.events[@event_id], $game_map.events[enemy.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
end
#--------------------------------------------------------------------
def check_troop_status
skills = set_skills(1)
return false if skills.size == 0 or skills == []
troop = []
for enemy in $ABS.enemies.values
troop.push(enemy) if enemy.troop == @troop and (enemy.hp <
(enemy.maxhp*0.25)) and enemy != self
end
return false if troop.size == 0 or troop == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4].include?(skill.scope) and skill.power < 0
case skill.scope
when 3
top_target = self
for target in troop
top_target = target if target.hp < top_target.hp and
$ABS.check_range($game_map.events[@event_id], $game_map.events[target.event_id], skill.range)
end
target_enemies = [top_target]
when 4
target_enemies = []
for target in troop
target_enemies.push(target) if $ABS.check_range($game_map.events[@event_id], $game_map.events[target.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
#------------------------------------------------------------------------
def check_melee_attack
if $ABS.check_range(self, $game_player, 1) and
$ABS.check_facing(self, $game_player) and @cooldown == 0
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-atk',
event.direction/2, 4, 3, 0) if $ABS.e_animations
$ABS.player.attack_effect(self)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
if $ABS.player.damage != 'Miss' and $ABS.player.damage != 0
successful_hit(self, [$ABS.player])
end
return true
end
return false
end
#------------------------------------------------------------------------
def check_range_spell
skills = set_skills(1)
return false if skills.size == 0 or skills == []
viable_skills = []
for skill in skills
next if !skill_can_use?(skill.id)
next unless $ABS.check_range($game_map.events[@event_id], $game_player, skill.range)
next unless [1, 2].include?(skill.scope) or skill.power >= 0
viable_skills.push(skill)
end
return false if viable_skills.size == 0 or viable_skills == []
skill = viable_skills[rand(viable_skills.size+1)]
return false if skill == nil
$ABS.player.skill_effect(self, skill)
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
successful_hit(self, [$ABS.player], skill)
return true
end
#------------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 - agi)*1.2) / 1000)) * 1.5).floor
end
#------------------------------------------------------------------------
def chill
@cooldown -= 1 unless @cooldown == 0
end
#------------------------------------------------------------------------
def find_player
if $ABS.check_range(self, $game_player, 7) and
$ABS.check_facing(self, $game_player)
engage unless @engaged
return
end
check_disengage if @engaged
return
end
#------------------------------------------------------------------------
def guarding?
return @guarding
end
#------------------------------------------------------------------------
def successful_hit(object = self, target = [$game_party.actors[0]], skill = nil)
anim1 = 0; anim2 = 0
if skill == nil
anim1 = animation1_id if !$ABS.p_animations
anim2 = animation2_id
else
anim1 = skill.animation1_id if !$ABS.p_animations
anim2 = skill.animation2_id
end
if object.is_a?(Game_Actor)
$game_player.animation_id = anim1 if !$ABS.p_animations
else
event = $game_map.events[object.event_id]
event.animation_id = anim1 if !$ABS.e_animations
end
return if !target
for tar in target
next if !tar
if tar.is_a?(Game_Actor)
$game_player.animation_id = anim2
$ABS.animate($game_player, $game_player.character_name + '-hit',
$game_player.direction/2, 4, 3) if $ABS.p_animations
else
event = $game_map.events[tar.event_id]
event.animation_id = anim2
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
end
end
#------------------------------------------------------------------------
def engage
@engaged = true
engage_troops
@dis_cooldown = 500
reset
event = $game_map.events[@event_id]
@move_type = event.move_type
@move_frequency = event.move_frequency
@move_speed = event.move_speed
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
#------------------------------------------------------------------------
def engage_troops
for enemy in $ABS.enemies.values
if enemy.troop == @troop
enemy.engage unless enemy.engaged
end
end
end
#------------------------------------------------------------------------
def disengage
@engaged = false
event = $game_map.events[@event_id]
event.move_type = @move_type
event.move_frequency = @move_frequency
event.move_speed = @move_speed
end
#------------------------------------------------------------------------
def check_disengage
@dis_cooldown -= 1
if @dis_cooldown == 0
disengage
end
end
#------------------------------------------------------------------------
def check_status
if hp < (maxhp / 25)
event = $game_map.events[@event_id]
event.move_type = 4
event.move_frequency = 5
event.move_speed = 5
else
event = $game_map.events[@event_id]
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
end
#------------------------------------------------------------------------
def path_find
return if $game_map.events[@event_id].runpath
$game_map.events[@event_id].find_object($game_player)
end
#------------------------------------------------------------------------
def id
return @enemy_id
end
#------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk
end
#------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef
end
#------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef
end
#------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#------------------------------------------------------------------------
def element_rate(element_id)
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
for i in @states
result /= 2 if $data_states[i].guard_element_set.include?(element_id)
end
return result
end
#------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#------------------------------------------------------------------------
def element_set
return []
end
#------------------------------------------------------------------------
def plus_state_set
return []
end
#------------------------------------------------------------------------
def minus_state_set
return []
end
#------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
end # End ABS::Enemy Class
end # End ABS Class

#------------------------------------------------------------------------
# * Game Actor ABS Clsas
#------------------------------------------------------------------------
# This is how the Player interacts with enemies and hotkeys
#------------------------------------------------------------------------
class Game_Actor
attr_accessor :abs
#------------------------------------------------------------------------
alias prexus_abs_g_actor_setup setup
#------------------------------------------------------------------------
def setup(actor_id)
prexus_abs_g_actor_setup(actor_id)
@abs = Game_Actor::ABS.new # Setup the ABS class
end
#------------------------------------------------------------------------
class ABS
attr_accessor :cooldown
attr_accessor :acted
attr_accessor :hot_key
#----------------------------------------------------------------------
def initialize
@cooldown = 0 # Attacking/casting cooldown
@acted = false # Flag for whether or not you've acted recently
@hot_key = [nil, nil, nil] # Hot key array
end
#----------------------------------------------------------------------
# * Cooldown/input methods
#----------------------------------------------------------------------
def chill
@cooldown -= 1 if @acted and @cooldown != 0
end
#----------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 - $game_party.actors[0].agi)*1.2) / 1000)) * 1.5).floor / 2 unless @acted
end
#----------------------------------------------------------------------
# * Attacking/Spell Casting Methods
#----------------------------------------------------------------------
def attack
# Animate Actor:
$ABS.animate($game_player, $game_player.character_name + '-atk',
$game_player.direction/2, 4, 3) if $ABS.p_animations
$game_player.animation_id = $ABS.player.animation1_id unless $ABS.p_animations
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, 1) # If enemy is in range
next if !$ABS.check_facing($game_player, enemy) # and not behind
enemy.attack_effect($ABS.player) # hit the enemy
event = $game_map.events[enemy.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(enemy.damage, enemy.critical) if sprite # show damage
if enemy.damage != 'Miss' and enemy.damage != 0 # if the attack hit
# Animate Enemy:
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
event.animation_id = $ABS.player.animation2_id
end
@acted = true # Yes you've recently attacked!
end
end
#----------------------------------------------------------------------
def cast(skill)
return unless skill
skill = $data_skills[skill]
return unless skill or $ABS.player.skill_can_use?(skill.id) # Can use?
return if $ABS.player.sp < skill.sp_cost # We sure about that?
@acted = true # Then you've acted!
reset # Reset the cooldown for some reason
# Animate Actor:
$game_player.animation_id = skill.animation1_id
$ABS.animate($game_player, $game_player.character_name + '-cast',
$game_player.direction/2, 4, 3, 0) if $ABS.p_animations
# Deal with SP
$ABS.player.sp -= skill.sp_cost
case skill.scope
when 1 # One Enemy
target = find_single_target(skill) # Find closest enemy
return unless target # If you found a valid enemy
target.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[target.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(target.damage, target.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
when 2 # Multiple Enemies
target = find_all_target(skill) # Find all enemies in range
return unless target # If you found valid enemies
for tar in target # For all the enemies:
tar.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[tar.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(tar.damage, tar.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
when 3..4,7 # For yourself
$ABS.player.skill_effect($ABS.player, skill) # Hit yourself
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite # Show heal
# Animate self:
$game_player.animation_id = skill.animation2_id
else
return
end
end
#----------------------------------------------------------------------
# * Target Finding Methods
#----------------------------------------------------------------------
def find_single_target(skill)
targets = [] # Holds the valid targets
target_range = [] # Holds their range from player
final_targets = [] # Holds final targets (only valids)
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove the enemy
target_range.push($ABS.find_range($game_player, enemy)) # Shove his range
end
big_range = 0 # Lowest Range from Player
for i in target_range # Finding the lowest range of valid targets
big_range = i if i > big_range
end
for i in 0...targets.size # Finding the targets inside that range
final_targets.push(targets[i]) if target_range[i] <= big_range
end
random = rand(final_targets.size)-1 # Selecting one of the targets
random = 0 if random < 0
return final_targets[random] # Return that target
end
#----------------------------------------------------------------------
def find_all_target(skill)
targets = [] # All Targets
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove enemy
end
return targets # Return all enemies
end
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end # End SDK Check

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state('Prexus ABS') == true

class Game_Map
alias prexus_abs_g_map_setup setup
def setup(map_id)
prexus_abs_g_map_setup(map_id)
$ABS = ABS.new if !$ABS
$ABS.setup_enemies(@events)
end
end
#--------------------------------------------------------------------------
class Scene_Map
attr_accessor :spriteset
alias prexus_abs_s_map_update update
def update
$ABS.update if $ABS.enabled
if !$ABS.player.abs.acted and !$game_party.actors[0].guarding? and $ABS.enabled
$ABS.player.abs.attack if Input.trigger?(Input::A) and $ABS.player.weapon_id > 0
$ABS.player.abs.cast($ABS.player.abs.hot_key[0]) if Input.trigger?(Input::X)
$ABS.player.abs.cast($ABS.player.abs.hot_key[1]) if Input.trigger?(Input::Y)
$ABS.player.abs.cast($ABS.player.abs.hot_key[2]) if Input.trigger?(Input::Z)
end
prexus_abs_s_map_update
end
end
#--------------------------------------------------------------------------
class Game_Actor
#------------------------------------------------------------------------
def guarding?
return true if Input.press?(Input::L)
return false
end
end
#--------------------------------------------------------------------------
class Game_Event
attr_reader :page
attr_reader :map_id
def name
return @event.name
end
end
#--------------------------------------------------------------------------
class Game_Character
attr_accessor :move_type
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :character_name
attr_accessor :wait
attr_accessor :old_chr_name
attr_accessor :old_dir
attr_accessor :animating
#------------------------------------------------------------------------
alias animation_engine_game_character_initialize initialize
#------------------------------------------------------------------------
def initialize
animation_engine_game_character_initialize
@animating = false
@wait = false
@old_chr_name = @character_name
@old_dir = @direction
end
#------------------------------------------------------------------------
def animate(animation_name, position, frames, wait, repeat)
@character_name = animation_name if @animating == false
@pattern = 0
@count = 0
@repeat = repeat
@direction_fix = true
@old_dir = @direction
@direction = position * 2
@frames = frames
lock
@animating = true
@wait = wait
@anim_wait_count = @wait
update
return
end
#------------------------------------------------------------------------
def update_animate
if @anim_wait_count > 0
@anim_wait_count -= 1
return
end
if @pattern >= @frames or moving?
if !moving?
if @count < @repeat
@pattern = 0
@count += 1
@anim_wait_count = @wait
update
return
end
end
unlock
@animating = false
@pattern = 0
@direction_fix = false
@direction = @old_dir
if self.is_a?(Game_Event)
@character_name = @page != nil ? @page.graphic.character_name : ''
else
@character_name = @old_chr_name
end
$game_player.refresh
$game_map.refresh
return
end
@pattern += 1
@anim_wait_count = @wait
update
end
#------------------------------------------------------------------------
def update_movement_type
if @animating == true
update_animate
return
end
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
end
#------------------------------------------------------------------------
def update_movement
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 1 # Random
move_type_random
when 2
if @runpath
run_path
else
move_type_toward_player
end
when 3
move_type_custom
when 4
move_type_escape_player
end
end
end
#------------------------------------------------------------------------
# * Move Type : Escape
#------------------------------------------------------------------------
def move_type_escape_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_away_from_player
end
#------------------------------------------------------------------------
# * Move Type : Approach
#------------------------------------------------------------------------
def move_type_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_toward_player
end
#------------------------------------------------------------------------
# * Move away from Player
#------------------------------------------------------------------------
def move_away_from_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
sx > 0 ? move_right : move_left
if not moving?
rand(2) == 1 ? move_down : move_up
end
else
sy > 0 ? move_down : move_up
if not moving?
rand(2) == 1 ? move_right : move_left
end
end
end
end
#--------------------------------------------------------------------------
class Game_Battler
def skill_can_use?(skill_id)
if $data_skills[skill_id].sp_cost > self.sp
return false
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $scene.is_a?(Scene_Map)
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
end
def skill_effect(user, skill)
self.critical = false
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= skill.common_event_id > 0
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
effective |= hit < 100
if hit_result == true
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
self.damage = power * rate / 20
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
self.damage /= 2
end
end
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
effective |= hit < 100
end
if hit_result == true
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Miss"
end
end
else
self.damage = "Miss"
end
return effective
end
end
#--------------------------------------------------------------------------
class Scene_Skill
alias prexus_abs_s_skill_update update
def update
if Input.trigger?(Input::X)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[0] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[0] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Y)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[1] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[1] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Z)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[2] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[2] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::A)
skill = @skill_window.skill
for i in 0..$ABS.player.abs.hot_key.size
skillX = $ABS.player.abs.hot_key[i]
next unless skillX
$ABS.player.abs.hot_key[i] = nil if skill.id == skillX
end
@skill_window.refresh
return
end
prexus_abs_s_skill_update
end
end
#--------------------------------------------------------------------------
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 255)
else
self.contents.font.color = normal_color
end
else
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 160)
else
self.contents.font.color = disabled_color
end
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
class Scene_Map
alias prex_abs_s_map_transfer_player transfer_player
def transfer_player
for i in 0...$game_map.events.size
event = $ABS.events[i]
trigger = $ABS.event_triggers[i]
next unless event and trigger
if ['A', 'B', 'C', 'D'].include?(trigger.upcase)
key = [event.map_id, event.id, trigger]
$game_self_switches[key] = false
$ABS.events.delete(event)
$ABS.event_triggers.delete(trigger)
next
end
if trigger.upcase == 'CHEST'
key = [event.map_id, event.id, 'A']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'B']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'C']
$game_self_switches[key] = false
key = [event.map_id, event.id, 'D']
$game_self_switches[key] = false
$ABS.events.delete(event)
$ABS.event_triggers.delete(trigger)
next
end
end
prex_abs_s_map_transfer_player
end
end
#--------------------------------------------------------------------------
class Scene_Save < Scene_File
alias prex_abs_s_save_write_data write_data
def write_data(file)
prex_abs_s_save_write_data(file)
Marshal.dump($ABS, file)
end
end
#--------------------------------------------------------------------------
class Scene_Load < Scene_File
alias prex_abs_s_load_read_data read_data
def read_data(file)
prex_abs_s_load_read_data(file)
$ABS = Marshal.load(file)
end
end
#--------------------------------------------------------------------------
class Spriteset_Map
attr_accessor :character_sprites
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state("Prexus ABS") == true

class ABS
attr_accessor :portrait
alias prex_abs_abs_initialize initialize
def initialize
prex_abs_abs_initialize
@p_animations = true # To play charset animations for players
@e_animations = true # To play charset animations for enemies
@portrait = true # To show a portrait in HUD. If false, shows charset.
end
end
#------------------------------------------------------------------------
module RPG
class Skill
attr_accessor :range
#--------------------------------------------------------------------
# * Instructions:
# Add new spells and their ranges by adding these lines:
# when "SpellName"
# @range = valueforrange
#--------------------------------------------------------------------
# For Example:
# when "Cross Cut"
# @range = 2
#--------------------------------------------------------------------
def set_range
@range = 0
case self.name
# Add New Lines Here:
when "Heal"
@range = 6
when "Fireball"
@range = 5
when "Sting"
@range = 3
when "Claw"
@range = 2
end
end
end
end
#------------------------------------------------------------------------
class Scene_Title
alias prexus_abs_s_title_main_database main_database
def main_database
prexus_abs_s_title_main_database
$data_skills.each {|s| s.set_range if s}
end
end
#------------------------------------------------------------------------
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 16
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(0, 96, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(96, 0, 0)
else
bitmap.font.color.set(0, 0, 96)
end
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(0, 255, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(255, 0, 0)
else
bitmap.font.color.set(0, 0, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.color.set(96, 96, 0)
bitmap.draw_text(-1, -1, 160, 20, "Nice!", 1)
bitmap.draw_text(+1, -1, 160, 20, "Nice!", 1)
bitmap.draw_text(-1, +1, 160, 20, "Nice!", 1)
bitmap.draw_text(+1, +1, 160, 20, "Nice!", 1)
bitmap.font.color.set(255, 255, 0)
bitmap.draw_text(0, 0, 160, 20, "Nice!", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end

#==============================================================================
# ** Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if SDK.state("Prexus ABS") == true

class Scene_Map
attr_accessor :hud_window
alias prex_abshud_s_map_main main
def main
@hud_window = ABS::Window_Hud.new
prex_abshud_s_map_main
end
alias prex_abshud_s_map_update update
def update
prex_abshud_s_map_update
if Input.trigger?(Input::R)
@hud_window.visible = !@hud_window.visible if $ABS.enabled
end
@hud_window.visible = false if !$ABS.enabled
@hud_window.update
end
end
#---------------------------------------------------------------------------
class ABS
class Window_Hud < Window_Base
attr_accessor :portrait
def initialize
super(-16, -16, 672, 512)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Georgia"
self.contents.font.bold = true
self.contents.font.size = 14
self.opacity = 0
@hp = 0
@maxhp = 0
@sp = 0
@maxsp = 0
@portrait = nil
refresh
end
#------------------------------------------------------------------------
def refresh
self.contents.clear
@hp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
@sp = $game_party.actors[0].sp
@maxsp = $game_party.actors[0].maxsp
#---------------------------------------------------------------------
# * Draw HUD Background (will adjust to any size image)
# - Image is ..\Graphic\HUD\Background.png
#---------------------------------------------------------------------
bitmap = RPG::Cache.hud("Background")
self.contents.blt(640-bitmap.width, 480-bitmap.height, bitmap,
Rect.new(0, 0, bitmap.width, bitmap.height))
#---------------------------------------------------------------------
# * Draw HP and SP Bars and Text
#---------------------------------------------------------------------
hpp = (@hp.to_f / @maxhp) * 100
@x = 640-152
@y = 480-40
self.contents.fill_rect(@x+0, @y+9 , 102, 8, Color.new(143, 17, 17, 180))
self.contents.fill_rect(@x+1, @y+10, 100, 6, Color.new(120, 60, 60, 180))
self.contents.fill_rect(@x+1, @y+10, hpp, 2, Color.new(234, 195, 195, 180))
self.contents.fill_rect(@x+1, @y+12, hpp, 2, Color.new(217, 152, 152, 180))
self.contents.fill_rect(@x+1, @y+14, hpp, 2, Color.new(181, 75, 75, 180))
text = "#{@hp}/#{@maxhp}"
width = self.contents.text_size(text).width
height = self.contents.text_size(text).height
self.contents.font.color = Color.new( 0, 0, 0)
self.contents.draw_text(@x+102 - width, @y+1, width, height, text)
self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(@x+101 - width, @y+0, width, height, text)
spp = (@sp.to_f / @maxsp) * 100
self.contents.fill_rect(@x+0, @y+25, 102, 8, Color.new( 17, 79, 143, 180))
self.contents.fill_rect(@x+1, @y+26, 100, 6, Color.new( 60, 60, 120, 180))
self.contents.fill_rect(@x+1, @y+26, spp, 2, Color.new(196, 213, 234, 180))
self.contents.fill_rect(@x+1, @y+28, spp, 2, Color.new(153, 185, 271, 180))
self.contents.fill_rect(@x+1, @y+30, spp, 2, Color.new( 75, 127, 181, 180))
text = "#{@sp}/#{@maxsp}"
width = self.contents.text_size(text).width
height = self.contents.text_size(text).height
self.contents.font.color = Color.new( 0, 0, 0)
self.contents.draw_text(@x+102 - width, @y+18, width, height, text)
self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(@x+101 - width, @y+17, width, height, text)
#---------------------------------------------------------------------
# * Draw Face Graphic
# - Face Graphics found in ..\Graphics\HUD\portraits\
# Must match hero's name!
#---------------------------------------------------------------------
if $ABS.portrait
bitmap = RPG::Cache.portrait($game_party.actors[0].name.to_s)
I've never come across that problem, and as a result, I can't fix it.

XP Learner: some do, some don't. It says in the script's post and beside the name in the first posts.
Wow Prexus, these are great! :D
@ Mist: Pretty sure the demo lag just has to do with the map size and number of enemies... the forest is the only part where it slowed down to a complete crawl for me.
Actually if an enemy blocks a pathway, and another enemy is trying to path through him, a bit of slowdown has occured once or twice. But in an ABS, a 1tile wide pathway is a bad idea already.
For the domain effects, in battle the domain effects still gets in the way of skill/item descriptions. You might consider moving it lower and out of the way. Other than that good job.
Oh er, is that a window telling you what the domain is? That isn't even supposed to be there.. i'll remove it later.
you know theres an edit button right>_>

spammer
Okay.... -goes off to edit... the maps...- Hey it did work..... It doesnt lag any more.. Yay.. I removed about 13 monsters... And I also edited to demo and all of the dialog for Lunas.. do you have a HUD Port for Lunas? I like him WAY better than Lisa.. Please give me it.. Ill give credit I promise...
I used this one for one of the old betas of the ABS:

http://rm-dev.org/images/LunasHUD.png[/img]

Its not made properly for the new HUD but you could edit itpretty easily (its Kyo from the anime Fruits Basket)

Edit: Err don't give me credit for this or Lisa's portrait, didn't make either of them, just googled em =P
[QUOTE=Prexus]Oh er, is that a window telling you what the domain is? That isn't even supposed to be there.. i'll remove it later.[/QUOTE]
You should instead make an option to have it below that bar or non-existant. It may by nice to have a reminder of the feild effect that doesn't get annoying quick (like underwater)
I have a question good sir. I believe I PMED you this as well. May I ask you what is the capacity of people the party changer will handle?

I need one that can handle a multiple amount of people/creatures, like Fire Emblem or Pokemon.

Viskar's handle's 8 and Seph's handles 16 or more I think, BUT it doesn't show their stats/or sprites.

I like yours the best so far but I need to know the answer to my question. Even if it holds like 30 that will do. :D

Thank you!
Really nice scripts! One problem, though... After a battle, using the ABS, if the enemy drops an item, a error occurs on line 345. Undefined local variable or method 'item' for ABS> something, something... And because IÂÂÂ ´m a script-retard, I donÂÂÂ ´t know what to do.
Great ABS, Prexus. Though, I'm having a problem with it. The only "Trigger" that works is "Trigger Erase". When I use the others and kill the enemy, nothing happens, unless I press F9 into the switches menu, the exit out.

I'm thinking it's something with the refresh, but in your game, Umbral Wake, I fought the boss and had no problems.

I have RPGMXP legal, and your newly posted script for the ABS.

Scripts in use:
SDK 1.5
MeisMe's HUD add on for Prexus ABS
Dubealex AMS and Text Scroll
LegACy's 1-Scene CMS
SephirothSpawn's Introduction & Splash System
Near Fantastica's Particle Engine
Rataime's Destruction Engine (Non-SDK)

I've removed all of them and it still happens.



Thanks in advance.
So, in the original post it says that the class-job system is non sdk, then in the post about it says it requires SDK... which is it?
Korin-Sama, are you setting up the ABS Setup trigger right? The enemy events should look like this:
@>Comment: ABS Setup
@>Comment: Name Ghost
@>Comment: Troop GhostTroopA
@>Comment: Trigger Local A
Expand to see the code.
Yep, except I'm using "Tigger Switch 1". Just like that. When I check the Switches, it says it's been turned on, but nothing happens until I exit out that screen.
Hey, Prexus-man (or someone), why do I get an error if an enemy drops an item?
From what I understand from studing the ABS demo, you're not supposed to put the item drop from the editor, you have to do it with the event. Study Umbral Wake for more details on it.
Still donÂÂÂ ´t get it...
Study the demo, learn from it. I'm not offering support on that script.

Also the Class Job system is NON-SDK and i'll fix that in a minute.

I'm just about finished a new and much better version of the World Object's script. Its no-longer SDK required/compliant but it should still remain SDK compatible with an edit to one or two methods. I removed the SDK because i'm not using the SDK in my own project (since i'm scripting everything myself, why would I need the SDK?) and yeah. I'll release it tomorrow most likely.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=8671