brainstorm
Member
Sasuke's Advanced Battle System
Version: 1
Introduction
Yes, I know. You guys have been bombarded with multiple ABSs and loads of them are better than mine, but with all due respect, I don't care. This script was done for the sole purpose of PRACTICE.
Features
Screenshots
N/A
Demo
Sasuke's ABS Version 1.2
Script
Instructions
Instructions are in the Instructions Spoiler
FAQ
Ask a question!!
Compatibility
Also in Instructions Spoiler
Credits and Thanks
Also in Instructions Spoiler
Author's Notes
This script was done for practice... DON'T KILL ME!!
Terms and Conditions
This script can be used in commercial and non-commercial games as long as you credit sasuke89, and Demonfire.
Version: 1
Introduction
Yes, I know. You guys have been bombarded with multiple ABSs and loads of them are better than mine, but with all due respect, I don't care. This script was done for the sole purpose of PRACTICE.
Features
- Computer Controlled Allies and Enemies
- Full Move System Attacking
- Custimizable
Screenshots
N/A
Demo
Sasuke's ABS Version 1.2
Script
Code:
#==============================================================================
# ** Sasuke89's Advanced Battle System 10-24-08
#------------------------------------------------------------------------------
# ~Credits
#------------------------------------------------------------------------------
# ~Sasuke89
# ~DeM0nFiRe
# ~Trickster
#==============================================================================
#==============================================================================
# ~Features
#------------------------------------------------------------------------------
# ~Computer Controlled Allies and Enemies
# ~Full Move System
# ~Attacking While Running
# ~Fully Custimizable
#==============================================================================
#==============================================================================
# ~Instructions
#------------------------------------------------------------------------------
# ~Enemy Event Setup
#------------------------------------------------------------------------------
# To setup an event use the name the event with the following for it to become
# an ABS Event, "NAME_00HP_0ATK_ANIM" , without quotations.
#
# NAME is the name used in the Settings Section. Normally, for an enemy or
# boss, the NAME would be "Enemy_" or Boss_". Every option must be seperated
# by an "_".
#
# Where 00HP would be is the HP of the event in the ABS using four digits only.
# If the HP is below four digits just put zeros in front of the number. It's
# the same with all the options. In later versions I'll add more variety to
# this limitation.
#
# Where 0ATK would be is where you would put the Event's Attack Power. Enemies
# attack every so often so this option is overly important.
#
# ANIM is the Animation ID of the Enemy's Attack. The Option was made possible
# by Trickster's Script.
#------------------------------------------------------------------------------
# ~Actor Event Setup
#------------------------------------------------------------------------------
# These Events are easy to setup because all you need is one word and one
# number.
#
# The number is the id of the party member you want the event to
# copy. The event will then do everything with the Actor's stats from then
# on.
#
# The word will depend on the word in the Settings Section. the word regularly
# is "Ally_".
#------------------------------------------------------------------------------
# ~Item Event Setup
#------------------------------------------------------------------------------
# All you have to do to make an ABS event that changes into a treasure chest is
# to add "Item" at the BEGINNING of the event's name. If the event dies, the
# event will refresh with the self switch "D" on. Make a new event page with
# that switch on, with the event's item and such. You eventer's should know
# it's done.
#------------------------------------------------------------------------------
# ~Object Event Setup
#------------------------------------------------------------------------------
# Objects are also easy. Objects are easy, the code for them is "Object_00HP".
# Objects can be anything that doesn't attack back at an opponent. Usually in
# games, the "Object" is a crate or a barrel, etc.
#------------------------------------------------------------------------------
# ~Compatibility
#------------------------------------------------------------------------------
# The only events that are compatible with ITEM Events are Enemies, Bosses and
# Objects. Actors should work, but It may be hard and it is weird for an ally
# to become something else and possibly going back into itself. Weird.
#------------------------------------------------------------------------------
# ~Known Errors
#------------------------------------------------------------------------------
# Errors can come from not having four digits for HP, Attack, and Battle
# Animations.
# Another error can come from adding two name words at once. Like:
# "Enemy_Ally_5"
#==============================================================================
#==============================================================================
# ~Version 2 Features
#------------------------------------------------------------------------------
# ~Full Relationship System
# ~More Options, (Defend and Skills)
# ~Full Kingdom Hearts Styled HUD
# ~Healing Skill Coverage
# ~Error FIxes
# ~Added Variety
#==============================================================================
#==============================================================================
# ~Compatibility
#------------------------------------------------------------------------------
# This script is recommended to be used with the SDK Version 2.3 Parts 1 and 2.
# This script should work with every single script out there.
# ~The script rewrites one method in Scene_Item, update_target.
# ~The script aliases many methods in Game_Event, Game_Character,
# Window_Skill, Scene Skill, Game_Map and Game_Actor.
# ~The script adds methods in Interpreter, Game_Event, Game_Map, and
# Game_Actor
#==============================================================================
Code:
#===============================================================================
# ** ABS Setup 10-24-08
#------------------------------------------------------------------------------
# This section helps create a full Advanced Battle System. The section
# creates global variables that are the base of the main script.
#===============================================================================
#------------------------------------------------------------------------------
# ** Randomizes an Enemy's HP.
# $random_hp = [boolean,variance]
#------------------------------------------------------------------------------
$random_hp = [true,20]
#------------------------------------------------------------------------------
# ** The words used to create ABS events.
# $words = [Enemy Text,Boss Text,Ally Text,Item Text,Objects]
#------------------------------------------------------------------------------
$words = ["Enemy_","Boss_","Ally_","Item","Object_"]
#------------------------------------------------------------------------------
# ** The switch that is turned on when an Item Event is destroyed.
#------------------------------------------------------------------------------
$switch = "D"
#------------------------------------------------------------------------------
# ** If true the game triggers a game-over if one Ally dies. Otherwise, The
# player will wait until all Ally Events Die
# $deathswitch = [boolean,in-partyid]
#------------------------------------------------------------------------------
$deathswitch = [false,0]#Switch
#------------------------------------------------------------------------------
# ** The Buttons used to Attack and use Skills
# Button Setup [Attack Button, Skill Button]
#------------------------------------------------------------------------------
$button = [Input::C,Input::A]
#===============================================================================
# ** Scripted Actor Setup
#===============================================================================
=begin
#------------------------------------------------------------------------------
# ** The Cost, Damage, and Animation ID of an attack
# Attack Setup [Skill Cost, Damage, Animation ID]
#------------------------------------------------------------------------------
$attack = [0, 20, 101]
#------------------------------------------------------------------------------
# ** The Skill Cost, Damage, and Animation ID
# Skill Setup "Skill Name" => [Skill Cost, Damage, Animation ID]
#------------------------------------------------------------------------------
$skills = {
"Fire" => [75, 30, 27],
"Cross Cut" => [75, 30, 67]
}
=end
#===============================================================================
# ** DO NOT EDIT
#===============================================================================
$actor = 0
Code:
#===============================================================================
# ** Realistic ABS Setup 10-24-08
#------------------------------------------------------------------------------
# This section helps create a full Advanced Battle System. The section helps
# create actor actions.
#===============================================================================
#--------------------------------------------------------------------------
# * SDK Log
#--------------------------------------------------------------------------
SDK.log('ABS_Actor_Realistic', 'sasuke89', 1.0, '10-24-08')
#--------------------------------------------------------------------------
# * SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2])
if SDK.enabled?('ABS_Actor_Realistic')
#Skill Setup "Skill Name" => [Skill Cost, Damage, Animation ID]
class Interpreter
def check_skill_name
return $game_party.actors[0].skill_id
end
def use_skill(skill_id = check_skill_name)
if skill_id != nil
if $game_party.actors[0].sp > $data_skills[skill_id].sp_cost
dv = $data_skills[skill_id].power.to_i + $game_party.actors[0].level
d = @event_id
$game_map.events[@event_id].hp -= dv
$damage.push(Damage.new(dv,'event',d))
character = get_character(0)
character.animation_id = $data_skills[skill_id].animation2_id.to_i
character.jump(0, 0)
$game_party.actors[0].sp -= $data_skills[skill_id].sp_cost
return
end
end
weapon = $data_weapons[$game_party.actors[0].weapon_id]
dv = weapon.atk.to_i + $game_party.actors[0].level
d = @event_id
$game_map.events[@event_id].hp -= dv
$damage.push(Damage.new(dv,'event',d))
character = get_character(0)
character.animation_id = weapon.animation2_id.to_i
character.jump(0, 0)
end
def attack
weapon = $data_weapons[$game_party.actors[0].weapon_id]
dv = weapon.atk.to_i + $game_party.actors[0].level
d = @event_id
$game_map.events[@event_id].hp -= dv
$damage.push(Damage.new(dv,'event',d))
character = get_character(0)
character.animation_id = weapon.animation2_id.to_i
character.jump(0, 0)
end
def open_event(random)
#for j in 0...$ga
if random != 0
for i in 1...($game_map.events.size + 1)
if $game_map.events[i].abs_ally?
if $game_map.events[i].name.include?(random.to_s)
#unless $game_map.events[i].erased == true
#if $game_map.events[i].check_dead?
#$game_map.events[i].hp = 0
$game_map.events[i].hp = $game_party.actors[random.to_i].hp
$game_map.events[i].erased = false
$game_map.events[i].refresh
$game_map.events[i].ally_hp($game_party.actors[random.to_i],true)
#end
#end
end
end
end
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#alias sasuke89update_target update_target
def update_target
$actor = @target_window.index
#sasuke89update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
end
# Erase target window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If items are used up
if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Redraw item window item
@item_window.draw_item(@item_window.index)
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If common event ID is valid
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
$game_temp.common_event_id = 10
#open_event($actor)
#$scene = Scene_Map.new
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Game_Actor < Game_Battler
attr_reader :skill_id
alias sasuke89initialize initialize
def initialize(actor_id)
@skill_id = skill_id
sasuke89initialize(actor_id)
end
def skill_id=(skillid)
@skill_id = skillid
return @skill_id == nil ? nil : @skill_name
end
def assign_skill(name)
@skill_id = name
end
end
class Scene_Skill
alias sasuke89update_skill update_skill
def update_skill
if Input.trigger?($button[1])
$game_system.se_play($data_system.decision_se)
$game_party.actors[@actor_index].assign_skill(@skill_window.skill.id)
@skill_window.refresh
end
sasuke89update_skill
end
end
class Window_Skill < Window_Selectable
#alias sasuke89draw_item draw_item
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
elsif $game_party.actors[0].skill_id == skill.id
self.contents.font.color = crisis_color
else
self.contents.font.color = disabled_color
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)
#sasuke89draw_item
end
end
end
Code:
#===============================================================================
# ** Enemy Event Setup 10-24-08
#------------------------------------------------------------------------------
# This section helps create a full Advanced Battle System. The section helps
# create enemy/ally event actions.
#===============================================================================
#SDK CHECK START
#--------------------------------------------------------------------------
# * SDK Log
#--------------------------------------------------------------------------
SDK.log('ABS_Enemy', 'sasuke89', 1.0, '10-24-08')
#--------------------------------------------------------------------------
# * SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2])
if SDK.enabled?('ABS_Enemy')
#==============================================================================
class Game_Event
attr_accessor :hp
attr_reader :name
attr_reader :maxhp
#attr_accessor :abs_events?
attr_accessor :erased
attr_accessor :target
attr_accessor :animation
alias sasuke89initialize initialize
alias sasuke89update update
def initialize(map_id, event)
@wait = 0
sasuke89initialize(map_id, event)
if abs_events?
if hp?
@name = name
@hp = maxhp
@hp = makehp
@target = 0
if abs_item?
@createditem = false
end
end
end
end
def update
check_all_dead?
if abs_events?
if hp?
if check_dead?
if @erased == false
if abs_item?
if @createditem == false
if abs_enemy?
$game_map.defeats += 1
end
$game_system.se_play($data_system.enemy_collapse_se)
s89change_selfswitch($switch)
@createditem = true
end
else
if abs_enemy?
$game_map.defeats += 1
end
erase
$game_system.se_play($data_system.enemy_collapse_se)
end
end
end
end
end
#if @target == $game_player
if $deathswitch.include?(true)
if $game_party.actors[$deathswitch[1].to_i].hp <= 0
$scene = Scene_Gameover.new
return
end
else
if $game_party.actors[0].hp <= 0
#$game_player.move_away_from_player
$game_player.lock
$game_player.transparent = (0 == 0)
#return
else
$game_player.unlock
$game_player.transparent = (1 == 0)
end
end
if @wait > 1
@wait -= 1
return
end
if abs_ally?
size = $words[2].size
ally = $game_party.actors[name.slice(size,4).to_i] #if @target.is_a?(Game_Event)
ally_hp(ally) #if @target.is_a?(Game_Event)
end
sasuke89update
end
def check_all_dead?
#check_all_dead?
#@hp = $game_party.actors[(name.delete($words[indexid])).to_i].hp
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
end
def pick_random_ally
#target = $game_player
random = 0 + rand($game_party.actors.size - 0 + 1)
if random == 0
#unless $game_player.transparent == (1 == 0)
target = $game_player
#end
elsif random.between?(1,$game_party.actors.size)
for i in 1...($game_map.events.size + 1)
if $game_map.events[i].abs_ally?
if name.include?($words[2].to_s + random.to_s)
#unless $game_map.events[i].erased == true
#unless $game_map.events[i].check_dead?
target = $game_map.events[[i].min]
#end
#end
end
end
end
#else
# target = $game_player
end
return target
end
#--------------------------------------------------------------------------
# * Move toward Player
#--------------------------------------------------------------------------
def move_toward_player
if abs_enemy?
unless @target.is_a?(Game_Event)
@target = pick_random_ally
end
end
#if @target.is_a?(Game_Event)
# if @target.abs_ally?
# if @target.erased
# @target = pick_random_ally
# end
# end
#end
if @target == nil
@target = $game_player
end
attack_for_enemy
#end
# Get difference in player coordinates
sx = @x - @target.x
sy = @y - @target.y
#attack_for_enemy
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move towards player, prioritize left and right directions
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# If vertical distance is longer
else
# Move towards player, prioritize up and down directions
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
def attack_for_enemy
# Get difference in player coordinates
sx = @x - @target.x
sy = @y - @target.y
if sx.abs == 1 and sy.abs == 1
unless self.erased
dv = find_attack_enemy
#$game_map.events[event.id].hp -= dv
if @target.is_a?(Game_Player)
$damage.push(Damage.new(dv,'player'))
$game_party.actors[0].hp -= dv
character = @target
character.animation_id = find_animation_enemy
character.jump(0,0)
@wait = 50
else
$damage.push(Damage.new(dv,'event',@target.id))
@target.hp -= dv
character = @target
character.animation_id = find_animation_enemy
character.jump(0,0)
@wait = 50
end
end
end
end
def find_animation_enemy
if abs_item?
size2 = $words[3].size
size = $words[indexid].size
anim = name.slice(size + size2 + 10,4).to_i
return anim
else
size = $words[indexid].size
anim = name.slice(size + 10,4).to_i
return anim
end
end
def find_attack_enemy
if abs_item?
size2 = $words[3].size
size = $words[indexid].size
atk = name.slice(size + size2 + 5,4).to_i
return atk
else
size = $words[indexid].size
atk = name.slice(size + 5,4).to_i
return atk
end
end
#--------------------------------------------------------------------------
def s89change_selfswitch(switch)
key = [@map_id, @id, switch]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
def name
return @event.name
end
def abs_events?
#i = 0...3
if name.include?($words[0]) or name.include?($words[1]) or
name.include?($words[2]) or name.include?($words[4])
return true
end
return false
end
def abs_enemy?
if name.include?($words[0]) or name.include?($words[1])
return true
end
return false
end
def abs_ally?
if name.include?($words[2])
return true
end
return false
end
def abs_object?
if name.include?($words[4])
return true
end
return false
end
def abs_item?
if name.include?($words[3])
return true
end
return false
end
def enemies_defeated_per_map
return $game_map.defeats
end
def indexid
if name.include?($words[0]) # Enemy
return 0
elsif name.include?($words[1]) # Boss
return 1
elsif name.include?($words[2]) # Ally
return 2
elsif name.include?($words[4]) # Object
return 4
end
return 2
end
def hp?
#i = 0...3
return name.include?($words[indexid])
end
def maxhp
#i = 0...3
unless name.include?($words[1]) or name.include?($words[2]) or
name.include?($words[4])
if $random_hp[0] == true
size = $words[indexid].size
hp = name.slice(size,4).to_i
regular = hp
var = $random_hp[1]
variance = -var + rand(var - -var + 1)
return regular += variance
end
end
if abs_item?
size2 = $words[3].size
size = $words[indexid].size
hp = name.slice(size + size2,4).to_i
return hp
elsif abs_ally?
return $game_party.actors[(name.delete($words[indexid])).to_i].maxhp
elsif abs_enemy?
size = $words[indexid].size
hp = name.slice(size,4).to_i
return hp
else
return (name.delete($words[indexid])).to_i
end
end
def makehp
return @hp
end
def hp=(hp)
@hp = hp
end
def check_dead?
if @hp < 1
return true
else
return false
end
end
alias sasuke89move_random move_random
def move_random
if name.include?($words[2])
event = get_new_target
move_toward_event(event)
check_event_for_ally(event) if event != nil
#attack_for_ally(event)
return
end
sasuke89move_random
end
def ally_hp(ally,els = false)
#@hp = maxhp
unless ally == nil
unless ally == $game_party.actors[0]
ally_hp = ally.hp
hp = @hp
#$game_party.actors[0].hp
dif = ally_hp - hp
if ally_hp == 0 or ally_hp < dif
if els == false
ally.hp = @hp
end
#ally.hp = @hp
@erased = true
refresh
#ally.hp = @hp#$game_party.actors[0].hp
else
if els == false
ally.hp = @hp
end
@erased = false
refresh
end
if els != false
@hp = $game_party.actors[(name.delete($words[indexid])).to_i].hp
end
end
end
end
def move_toward_event(event)
# Get difference in player coordinates
follow = event if event != nil
follow = $game_player if event == nil
sx = self.x - follow.x
sy = self.y - follow.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move towards player, prioritize left and right directions
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# If vertical distance is longer
else
# Move towards player, prioritize up and down directions
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
def check_event_for_ally(event)
# Get difference in player coordinates
sx = self.x - event.x
sy = self.y - event.y
# If coordinates are equal
if sx.abs <= 1 and sy.abs <= 1
attack_for_ally(event)
end
end
def attack_for_ally(event)
dv = 20 + $game_party.actors[(name.delete($words[indexid])).to_i].level
d = event.id
$game_map.events[event.id].hp -= dv
$damage.push(Damage.new(dv,'event',d))
character = event
if SDK.enabled?('ABS_Actor_Realistic')
weapon = $data_weapons[$game_party.actors[(name.delete($words[indexid])).to_i].weapon_id]
character.animation_id = weapon.animation2_id.to_i
#character.animation_id = 101
else
character.animation_id = $attack[2].to_i
end
character.jump(0,0)
@wait = 30
if event.erased == true
get_new_target
end
end
def near?(event)
sx = event.x - self.x
sy = event.y - self.y
# If coordinates are equal
if sx.abs <= 2 and sy.abs <= 2
return true
end
return false
end
def get_new_target
for i in 1...($game_map.events.size + 1)
if $game_map.events[i].abs_enemy?
unless $game_map.events[i].erased == true
unless $game_map.events[i].check_dead?
if $game_map.events[i].near?(self)
@target = $game_map.events[[i].min]
return @target
end
end
end
end
end
return nil
end
end
class Game_Map
attr_accessor :defeats
attr_reader :max
alias sasuke89initialize initialize
alias sasuke89setup setup
alias sasuke89update update
def initialize
@defeats = 0
@enemy_events = []
@j = 0
sasuke89initialize
end
def setup(map_id)
@defeats = 0
sasuke89setup(map_id)
@max = max
end
def update
sasuke89update
end
def max
enemy_events
return enemy_events#@enemy_events.size
end
def enemy_events
@j = 0
for i in 1...@events.size + 1
if @events[i].abs_enemy?
@enemy_events[@j] = @events[i]
@j += 1
end
end
return @j
end
end
#SDK CHECK END
end
Code:
=begin
┌──────────────────────────────────────â”
│◠Damage Display 1.0 │
│ │
│ Created By │
│ │
│ Trickster (tricksterguy@hotmail.com)│
│ │
│ │
└──────────────────────────────────────┘
â–ºInstructions
Add this above main.
To call just do
$damage.push(Damage.new(damage, type[, param, viewport])
anything within the [] is optional
damage is the String to Display or Damage to Display
type is the type of where to display use either 'player', 'actor',
'enemy', 'event', 'tile', or just specify the x coordinate
param is the parameter you can leave this off if using player, the index if using actor or enemy
the events id if using event, an array [tile_x, tile_y] if using tile, or
the y coordinate
Optional
viewport is the viewport of the sprite you can leave this off
=end
class Damage < ::Sprite
attr_accessor :duration
def initialize(dealt_damage, type, param = nil, viewport = Viewport.new(0,0,640,480))
super(viewport)
case type.downcase
when 'player'
@battler = $game_player
when 'actor'
@battler = $game_party.actors[param]
when 'enemy'
@battler = $game_troop.enemies[param]
when 'event'
@battler = $game_map.events[param]
when 'tile'
x = (param[0] % $game_map.width) * 32
y = (param[1] % $game_map.height) * 32
else
x = type
y = param
end
@base_y = @battler.nil? ? y : @battler.screen_y
@base_x = @battler.nil? ? x : @battler.screen_x
@off_y = self.oy / 2
@off_x = 0
self.ox = 80
self.oy = 20
self.x = 0
self.y = 0
self.z = 9000
@damage = dealt_damage
damage(@damage)
end
def dispose
dispose_damage
super
end
def damage(value)
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
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)
self.bitmap = bitmap
@duration = 40
end
def dispose_damage
self.bitmap.dispose if self.bitmap != nil
end
def update
super
if @battler != nil
if @base_x != @battler.screen_x
@base_x = @battler.screen_x
self.x = 0
end
if @base_y != @battler.screen_y
@base_y = @battler.screen_y
self.y = 0
end
end
if @duration > 0
@duration -= 1
case @duration
when 38..39
@off_y -= 4
when 36..37
@off_y -= 2
when 34..35
@off_y += 2
when 28..33
@off_y += 4
end
self.y = 0
self.opacity = 256 - (12 - @duration) * 32
end
end
def y=(y)
super(y+@base_y+@off_y)
end
def x=(x)
super(x+@base_x+@off_x)
end
end
$damage = []
class Scene_Map
alias trickster_update update
def update
for damage in $damage
if damage.is_a?(Damage)
if damage.duration <= 0
damage.dispose
damage = nil
$damage.compact!
else
damage.update
end
end
end
trickster_update
end
end
class Interpreter
def command_338
# Get operate value
value = operate_value(0, @parameters[2], @parameters[3])
# Process with iterator
iterate_battler(@parameters[0], @parameters[1]) do |battler|
# If battler exists
if battler.exist?
# Change HP
battler.hp -= value
# If in battle
if $game_temp.in_battle
# Set damage
battler.damage = value
battler.damage_pop = true
else
damage = value
$damage.push(Damage.new(damage,'player'))
end
end
end
# Continue
return true
end
end
Instructions
Instructions are in the Instructions Spoiler
FAQ
Ask a question!!
Compatibility
Also in Instructions Spoiler
Credits and Thanks
Also in Instructions Spoiler
Author's Notes
This script was done for practice... DON'T KILL ME!!
Terms and Conditions
This script can be used in commercial and non-commercial games as long as you credit sasuke89, and Demonfire.