Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Submission: Kingdom Hearts ABS, by Near Fantastica and S.S.
123q
post Jun 13 2006, 02:17 PM
Post #1


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




This is a script set that Quinn got me to.

Script #1

CODE
#======================================
# ■ Squad Based Action Battle System
#======================================
#  By: Near Fantastica
# Date: 02.07.05
# Version: 3.4
# Thanks To: Cybersam for the Keyboard Script
# Thanks To: Prexus for the Graphics
#======================================
#
#======================================
# ■ ABS Key Commands
#======================================
# E ● Change Lead Forward
# R ● Change Lead Backwards
# T ● Waits Leader
# Y ● Waits Allies
# U ● Gathers Allies
# I ● Dash
# O ● Sneak
# P ● Toggle Hud
# F ● Melee Attack
# G ● Range Attack
# H ● Skill Key 1
# J ● Skill Key 2
# K ● Skill Key 3
# L ● Skill Key 4
# N ● Wide Follow
# M ● Close Follow
#======================================
#
#======================================
# ■ ABS Enemy Ai List
#======================================
# Name
# Name Of the Enemy in The Data Base
#---------------------------------------------------------------------------
# Behavior
# Passive = 0 ● The Event (Enemy) will only attack when attacked
# Aggressive = 1 ● The Event will attack when one of its Detection level are set true
# Linking = 2 ● Event will only attack when another Event is attacked with in its Detection level
# Aggressive Linking = 3 ● Event will attack when either Aggressive or Linking is true
#---------------------------------------------------------------------------
# Detection
# Sound = range ● The range of sound the enemy can hear inactive if set to zero
# Sight = range ● The range of sightthe enemy can see inactive if set to zero
#---------------------------------------------------------------------------
# Aggressiveness
# Aggressiveness = Level ● The high number the less Aggressive the Event
#---------------------------------------------------------------------------
# Movement
# Speed = Level ● The movment Speed of the event when engaged
# Frequency = Level ● The movment Frequency of the event when engaged
#---------------------------------------------------------------------------
# Trigger
# Erased = 0 ● The event will be erased on death
# Switch = 1 ● The event will be trigger Switch[ID] on death
# Varible = 2 ● The event will be set the Varible[ID] = VALUE on death
# Local Switch = 3 ● The event will trigger Local_Switch[ID] on death
#======================================
#
#======================================
# ■ ABS CONSTANTS
#======================================
# ● DEAD_DISPLAY is the sprite that is displayed when an actor is dead
# ● DEAD_DISPLAY[Data_Base_Actor_ID] = ["Character_Set_Name", X of sprite, Y of sprite]
#---------------------------------------------------------------------------
$DEAD_DISPLAY = {}
$DEAD_DISPLAY[1] = ["189-Down01", 2, 0] #Actor 1
$DEAD_DISPLAY[2] = ["189-Down01", 6, 1] #Actor 2
$DEAD_DISPLAY[7] = ["190-Down02", 8, 0] #Actor 7
$DEAD_DISPLAY[8] = ["191-Down03", 4, 1] #Actor 8
#---------------------------------------------------------------------------
# ● RANGE_ELEMENT_ID is which element the range is set to
#---------------------------------------------------------------------------
$RANGE_ELEMENT_ID = 17 #Element 17
#---------------------------------------------------------------------------
# ● RANGE_DISPLAY is the setup for range weapons
# ● RANGE_DISPLAY[Data_Base_Weapon_ID] =
# ["Character_Set_Name", New Animation Id, Item Id of Ammo]
#---------------------------------------------------------------------------
$RANGE_DISPLAY = {}
$RANGE_DISPLAY[17] = ["Arrow", 4, 33] #Weapon 17
#======================================

class Action_Battle_System
#--------------------------------------------------------------------------
attr_accessor :ally_ai_active
attr_accessor :enemies
attr_accessor :display
attr_accessor :hud
attr_accessor :hud_pc
attr_accessor :hudname
attr_accessor :dash_level
attr_accessor :sneak_level
attr_accessor :transer_player
attr_accessor :ranged
attr_accessor :skill_key
attr_accessor :player_engaged
attr_accessor :close_follow
#--------------------------------------------------------------------------
def initialize
# Ally AI Flag
@ally_ai_active = true
# Enemies List
@enemies = {}
# Range List
@ranged = {}
# Dashing
@dashing = false
@dash_restore = false
@dash_reduce= false
@dash_timer = 0
@dash_level = 5
@dash_sec = 0
# Sneaking
@sneaking = false
@sneak_restore = false
@sneak_reduce= false
@sneak_timer = 0
@sneak_level = 5
@sneak_sec = 0
# Display
@display = []
@display[0] = false
@display[1] = ""
# Hud
@hud = true
@hud_pc = false
@hudname = "HUD-Display"
# Transfering Player
@transer_player = false
# Skill Keys
@skill_key = {}
@skill_key[1] = 0
@skill_key[2] = 0
@skill_key[3] = 0
@skill_key[4] = 0
# Ally tracking
@player_engaged = false
@player_obect = nil
# Party Command
@close_follow = false
end
#--------------------------------------------------------------------------
def hud_control(flag)
@hud = flag
return
end
#--------------------------------------------------------------------------
def hud_player_control(flag)
@hud_pc = flag
return
end
#--------------------------------------------------------------------------
def set_ally_ai(tirgger)
@ally_ai_active = tirgger
return
end
#--------------------------------------------------------------------------
def refresh(event, list, character_name)
@enemies.delete(event.id)
return if character_name == ""
return if list == nil
for i in 0...list.size
if list[i].code == 108 and list[i].parameters == ["ABS Event Command List"]
name = list[i+1].parameters[0].split
for x in 1...$data_enemies.size
enemy = $data_enemies[x]
if name[1].upcase == enemy.name.upcase
@enemies[event.id] = Game_ABS_Enemy.new(enemy.id)
@enemies[event.id].event_id = event.id
default_setup(event.id)
behavior = list[i+2].parameters[0].split
@enemies[event.id].behavior = behavior[1].to_i
sound = list[i+3].parameters[0].split
@enemies[event.id].detection[0] = sound[1].to_i
sight = list[i+4].parameters[0].split
@enemies[event.id].detection[1] = sight[1].to_i
aggressiveness = list[i+5].parameters[0].split
@enemies[event.id].aggressiveness = aggressiveness[1].to_i
speed = list[i+6].parameters[0].split
@enemies[event.id].speed = speed[1].to_i
frequency = list[i+7].parameters[0].split
@enemies[event.id].frequency = frequency[1].to_i
trigger = list[i+8].parameters[0].split
@enemies[event.id].trigger= [trigger[1].to_i, trigger[2].to_i, trigger[3].to_i]
end
end
end
end
end
#--------------------------------------------------------------------------
def default_setup(id)
@enemies[id].behavior = 1
@enemies[id].detection[0] = 1
@enemies[id].detection[1] = 4
@enemies[id].aggressiveness = 2
@enemies[id].engaged[0] = false
@enemies[id].engaged[1] = 0
@enemies[id].speed = 4
@enemies[id].frequency = 5
end
#--------------------------------------------------------------------------
def update
update_dash if @sneaking == false
update_sneak if @dashing == false
update_enemies
update_range
update_allies if @ally_ai_active == true
Graphics.frame_reset
end
#--------------------------------------------------------------------------
def update_range
for range in @ranged.values
range.update
end
end
#--------------------------------------------------------------------------
def update_allies
for ally in $game_allies.values
next if ally.under_attack == true
if @player_engaged == true
ally.under_attack = true
ally.forced_attack = true
ally.object = @player_obect
end
end
end
#--------------------------------------------------------------------------
def update_dash
if Kboard.keyb($R_Key_I) == 1
if $game_player.moving?
@dashing = true
$game_player.move_speed = 5
for ally in $game_allies.values
ally.move_speed = 5
end
@dash_restore = false
if @dash_reduce == false
@dash_timer = 50 # Initial time off set
@dash_reduce = true
else
@dash_timer-= 1
end
@dash_sec = (@dash_timer / Graphics.frame_rate)%60
if @dash_sec == 0
if @dash_level != 0
@dash_level -= 1
@dash_timer = 50 # Timer Count
end
end
if @dash_level == 0
@dashing = false
$game_player.move_speed = 4
for ally in $game_allies.values
ally.move_speed = 4
end
end
end
else
@dashing = false
$game_player.move_speed = 4
for ally in $game_allies.values
ally.move_speed = 4
end
@dash_reduce = false
if @dash_restore == false
@dash_timer = 80 # Initial time off set
@dash_restore = true
else
@dash_timer-= 1
end
@dash_sec = (@dash_timer / Graphics.frame_rate)%60
if @dash_sec == 0
if @dash_level != 5
@dash_level+= 1
@dash_timer = 60
end
end
end
end
#--------------------------------------------------------------------------
def update_sneak
if Kboard.keyb($R_Key_O) == 1
if $game_player.moving?
@sneaking = true
$game_player.move_speed = 3
for ally in $game_allies.values
ally.move_speed = 3
end
@sneak_restore = false
if @sneak_reduce == false
@sneak_timer = 50 # Initial time off set
@sneak_reduce = true
else
@sneak_timer-= 1
end
@sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
if @sneak_sec == 0
if @sneak_level != 0
@sneak_level -= 1
@sneak_timer = 100 # Timer Count
end
end
if @sneak_level == 0
@sneaking = false
$game_player.move_speed = 4
for ally in $game_allies.values
ally.move_speed = 4
end
end
end
else
@sneaking = false
$game_player.move_speed = 4
for ally in $game_allies.values
ally.move_speed = 4
end
@sneak_reduce = false
if @sneak_restore == false
@sneak_timer = 80 # Initial time off set
@sneak_restore = true
else
@sneak_timer-= 1
end
@sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
if @sneak_sec == 0
if @sneak_level != 5
@sneak_level+= 1
@sneak_timer = 60 # Timer Count
end
end
end
end
#--------------------------------------------------------------------------
def update_enemies
for enemy in @enemies.values
if enemy.ranged != nil
enemy.ranged.update
end
case enemy.behavior
when 0
if enemy.engaged[0] == true
next if engaged_enemy_detection?(enemy,1) == true
next if engaged_enemy_detection?(enemy, 0) == true
end
when 1
if enemy.engaged[0] == true
next if engaged_enemy_detection?(enemy,1) == true
next if engaged_enemy_detection?(enemy, 0) == true
else
next if enemy_detection_sight?(enemy) == true
next if enemy_detection_sound?(enemy) == true
end
when 2
if enemy.engaged[0] == true
next if engaged_enemy_linking?(enemy, 1) == true
next if engaged_enemy_linking?(enemy, 0) == true
else
next if enemy_linking?(enemy) == true
end
when 3
if enemy.engaged[0] == true
next if engaged_enemy_linking?(enemy,1) == true
next if engaged_enemy_linking?(enemy,0) == true
else
next if enemy_detection_sight?(enemy) == true
next if enemy_detection_sound?(enemy) == true
next if enemy_linking?(enemy) == true
end
end
end
end
#--------------------------------------------------------------------------
def set_event_movement(enemy)
event = $game_map.events[enemy.event_id]
enemy.move_type = event.move_type
enemy.move_frequency = event.move_frequency
enemy.move_speed = event.move_speed
if enemy.engaged[1] == 0
event.object = $game_player
else
event.object = $game_allies[enemy.engaged[1]]
end
event.move_type = 4
event.move_toward_object
event.move_frequency = enemy.frequency
event.move_speed = enemy.speed
end
#--------------------------------------------------------------------------
def return_event_movement(enemy)
event = $game_map.events[enemy.event_id]
event.move_type = enemy.move_type
event.move_frequency = enemy.move_frequency
event.move_speed = enemy.move_speed
end
#--------------------------------------------------------------------------
def engaged_enemy_linking?(enemy, level)
if enemy.detection[level] != 0
if enemy.engaged[1] == 0
object = $game_player
else
object = $game_allies[enemy.engaged[1]]
end
if in_range?($game_map.events[enemy.event_id], object, enemy.detection[level])
enemy.linking = false
enemy_attack(enemy)
return true
else
if enemy.linking == false
enemy.engaged[0] = false
if enemy.engaged[1] == 0
@player_engaged = false
else
$game_allies[enemy.engaged[1]].under_attack = false
end
enemy.engaged[1] = 0
return_event_movement(enemy)
return false
end
end
end
end
#--------------------------------------------------------------------------
def enemy_linking?(enemy)
for key in @enemies.keys
if in_range?($game_map.events[enemy.event_id], $game_map.events[key], enemy.detection[1])
if @enemies[key].engaged[0] == true
enemy.engaged[0] = true
enemy.engaged[1] = @enemies[key].engaged[1]
enemy.linking = true
set_event_movement(enemy)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_detection_sound?(enemy)
if enemy.detection[0] != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection[0])
if @sneaking == true
return false
end
enemy.engaged[0] = true
enemy.engaged[1] = 0
set_event_movement(enemy)
return true
end
for key in $game_allies.keys
if $game_allies[key].map_id == $game_map.map_id
next if $game_allies[key].dead == true
if in_range?($game_map.events[enemy.event_id], $game_allies[key], enemy.detection[0])
if $game_party.actors[key] != nil
if @sneaking == true
return false
end
enemy.engaged[0] = true
enemy.engaged[1] = key
set_event_movement(enemy)
return true
end
end
end
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_detection_sight?(enemy)
if enemy.detection[1] != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection[1])
if facing?($game_map.events[enemy.event_id], $game_player)
enemy.engaged[0] = true
enemy.engaged[1] = 0
set_event_movement(enemy)
return true
end
end
for key in $game_allies.keys
if $game_allies[key].map_id == $game_map.map_id
next if $game_allies[key].dead == true
if in_range?($game_map.events[enemy.event_id], $game_allies[key], enemy.detection[1])
if facing?($game_map.events[enemy.event_id], $game_allies[key])
if $game_party.actors[key] != nil
enemy.engaged[0] = true
enemy.engaged[1] = key
set_event_movement(enemy)
return true
end
end
end
end
end
end
return false
end
#--------------------------------------------------------------------------
def engaged_enemy_detection?(enemy, level)
if enemy.detection[level] != 0
if enemy.engaged[1] == 0
object = $game_player
else
id = enemy.engaged[1]
object = $game_allies[id]
end
if in_range?($game_map.events[enemy.event_id], object, enemy.detection[level])
enemy_attack(enemy)
return true
else
enemy.engaged[0] = false
if enemy.engaged[1] == 0
@player_engaged = false
else
$game_allies[enemy.engaged[1]].under_attack = false
end
enemy.engaged[1] = 0
return_event_movement(enemy)
return false
end
end
end
#--------------------------------------------------------------------------
def in_range?(element, object, range)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x + y
if r <= (range * range)
return true
else
return false
end
end
#--------------------------------------------------------------------------
def in_range(element, range)
objects = []
x = (element.x - $game_player.x) * (element.x - $game_player.x)
y = (element.y - $game_player.y) * (element.y - $game_player.y)
r = x + y
if r <= (range * range)
objects.push($game_party.actors[0])
end
for key in $game_allies.keys
ally = $game_allies[key]
x = (element.x - ally.x) * (element.x - ally.x)
y = (element.y - ally.y) * (element.y - ally.y)
r = x + y
if r <= (range * range)
next if $game_party.actors[key] == nil
objects.push($game_party.actors[key])
end
end
return objects
end
#--------------------------------------------------------------------------
def facing?(element, object)
if element.direction == 2
if object.y >= element.y
return true
end
end
if element.direction == 4
if object.x <= element.x
return true
end
end
if element.direction == 6
if object.x >= element.x
return true
end
end
if element.direction == 8
if object.y <= element.y
return true
end
end
return false
end
#--------------------------------------------------------------------------
def in_line?(element, object)
if element.direction == 2
if object.x == element.x
return true
end
end
if element.direction == 4
if object.y == element.y
return true
end
end
if element.direction == 6
if object.y == element.y
return true
end
end
if element.direction == 8
if object.x == element.x
return true
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_pre_attack(enemy, actions)
if enemy.hp * 100.0 / enemy.maxhp > actions.condition_hp
return true
end
if $game_party.max_level < actions.condition_level
return true
end
switch_id = actions.condition_switch_id
if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
return true
end
n = rand(11)
if actions.rating < n
return true
end
return false
end
#--------------------------------------------------------------------------
def hit_actor(object, enemy)
return if object == nil
object.jump(0, 0)
object.animation_id = enemy.animation2_id
end
#--------------------------------------------------------------------------
def actor_non_dead?(actor, enemy)
if actor.dead?
return_event_movement(enemy)
enemy.engaged[0] = false
enemy.engaged[1] = 0
$game_party.kill_actor(actor.id)
if $game_party.all_dead?
$game_temp.gameover = true
end
return false
end
return true
end
#--------------------------------------------------------------------------
def set_engaged(enemy)
if enemy.engaged[1] == 0
@player_engaged = true
@player_obect = $game_map.events[enemy.event_id]
else
$game_allies[enemy.engaged[1]].object = $game_map.events[enemy.event_id]
$game_allies[enemy.engaged[1]].under_attack = true
end
end
#--------------------------------------------------------------------------
def enemy_attack(enemy)
for actions in enemy.actions
next if enemy_pre_attack(enemy, actions) == true
case actions.kind
when 0 #Basic
if Graphics.frame_count % (enemy.aggressiveness * 20) == 0
case actions.basic
when 0 #Attack
if enemy.engaged[1] == 0
object = $game_player
else
object = $game_allies[enemy.engaged[1]]
end
if in_range?($game_map.events[enemy.event_id], object, 1) and
facing?($game_map.events[enemy.event_id], object)
actor = $game_party.actors[enemy.engaged[1]]
actor.attack_effect(enemy)
set_engaged(enemy)
if $game_party.actors[enemy.engaged[1]].damage != "Miss" and $game_party.actors[enemy.engaged[1]].damage != 0
hit_actor(object, enemy)
end
actor_non_dead?(actor, enemy)
return
end
when 1..3 #Nothing
return
end
end
when 1 #Skill
skill = $data_skills[actions.skill_id]
case skill.scope
when 1 # One Enemy
if Graphics.frame_count % (enemy.aggressiveness * 10) == 0
if enemy.engaged[1] == 0
object = $game_player
actor = $game_party.actors[0]
else
object = $game_allies[enemy.engaged[1]]
actor = $game_party.actors[enemy.engaged[1]]
end
if in_line?($game_map.events[enemy.event_id], object)
next if enemy.can_use_skill?(skill) == false
next if enemy.ranged != nil
enemy.ranged = Game_Ranged.new("Magic", $game_map.events[enemy.event_id], enemy, skill)
enemy.sp -= skill.sp_cost
end
end
when 2 # All Emenies
if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
next if enemy.can_use_skill?(skill) == false
enemy.sp -= skill.sp_cost
actors = in_range($game_map.events[enemy.event_id], 7)
next if actors[0].dead?
$game_map.events[enemy.event_id].animation_id = skill.animation2_id
for actor in actors
actor.effect_skill(enemy, skill)
if $game_party.actors[enemy.engaged[1]].damage != "Miss" and $game_party.actors[enemy.engaged[1]].damage != 0
hit_actor(object, enemy)
end
set_engaged(enemy)
if enemy.engaged[1] == 0
object = $game_player
else
object = $game_allies[enemy.engaged[1]]
end
actor_non_dead?(actor, enemy)
end
return
end
when 3..4 # User
if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
if enemy.hp < skill.power.abs
enemy.effect_skill(enemy, skill)
enemy.sp -= skill.sp_cost
$game_map.events[enemy.event_id].animation_id = skill.animation2_id
end
return
end
when 7 # User
if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
if enemy.hp < skill.power.abs
enemy.effect_skill(enemy, skill)
enemy.sp -= skill.sp_cost
$game_map.events[enemy.event_id].animation_id = skill.animation2_id
end
return
end
end
return
end
end
else
return
end
#--------------------------------------------------------------------------
def hit_event(event, animation)
event.jump(0, 0)
return if animation == 0
event.animation_id = animation
end
#--------------------------------------------------------------------------
def event_non_dead?(enemy)
if enemy.dead?
if enemy.engaged[1] == 0
@player_engaged = false
else
$game_allies[enemy.engaged[1]].under_attack = false
end
treasure(enemy)
id = enemy.event_id
@enemies.delete(id)
event = $game_map.events[enemy.event_id]
event.character_name = ""
case enemy.trigger[0]
when 0
event.erase
when 1
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
$game_switches[enemy.trigger[1]] = true
$game_map.need_refresh = true
when 2
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
if enemy.trigger[2] == 0
$game_variables[enemy.trigger[1]] += 1
$game_map.need_refresh = true
else
$game_variables[enemy.trigger[1]] = enemy.trigger[2]
$game_map.need_refresh = true
end
when 3
value = "A" if enemy.trigger[1] == 1
value = "B" if enemy.trigger[1] == 2
value = "C" if enemy.trigger[1] == 3
value = "D" if enemy.trigger[1] == 4
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
key = [$game_map.map_id, event.id, value]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
return false
end
return true
end
#--------------------------------------------------------------------------
def treasure(enemy)
exp = 0
gold = 0
treasures = []
unless enemy.hidden
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
treasures = treasures[0..5]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@display[0] = true
@display[1] = "LEVEL UP ~!"
actor.hp = actor.maxhp
actor.sp = actor.maxsp
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
end
#--------------------------------------------------------------------------
def player_attack
if $RANGE_DISPLAY[$game_party.actors[0].weapon_id] == nil
if Graphics.frame_count % 2 == 0
for enemy in @enemies.values
event = $game_map.events[enemy.event_id]
if facing?($game_player, event) and in_range?($game_player, event, 1)
actor = $game_party.actors[0]
enemy.attack_effect(actor)
if enemy.damage != "Miss" and enemy.damage != 0
hit_event(event, $data_weapons[actor.weapon_id].animation2_id)
end
if event_non_dead?(enemy)
@player_engaged = false
if enemy.engaged[0] == false
enemy.engaged[0] = true
enemy.engaged[1] = 0
set_event_movement(enemy)
end
end
end
end
end
end
end
#--------------------------------------------------------------------------
def player_ranged
weapon = $data_weapons[$game_party.actors[0].weapon_id]
return if weapon == nil
if weapon.element_set.include?($RANGE_ELEMENT_ID)
ammo = $RANGE_DISPLAY[weapon.id]
return if ammo == nil
if $game_party.item_number(ammo[2]) != 0
if @ranged[0] == nil
$game_party.lose_item(ammo[2], 1)
@ranged[0] = Game_Ranged.new("Weapon", $game_player, $game_party.actors[0], $game_party.actors[0].weapon_id)
end
end
end
end
#--------------------------------------------------------------------------
def player_skill(skill_key_id)
skill = $data_skills[@skill_key[skill_key_id]]
return if skill == nil
actor = $game_party.actors[0]
return if not actor.skills.include?(skill.id)
case skill.scope
when 1 # One Enemy
if skill.element_set.include?($RANGE_ELEMENT_ID)
if @ranged[0] == nil
return if actor.can_use_skill?(skill) == false
@ranged[0] = Game_Ranged.new("Magic", $game_player, actor, skill)
actor.sp -= skill.sp_cost
return
end
else
return if actor.can_use_skill?(skill) == false
actor.sp -= skill.sp_cost
for enemy in @enemies.values
next if enemy == nil
event = $game_map.events[enemy.event_id]
if facing?($game_player, event) and in_range?($game_player, event, 1)
enemy.effect_skill(actor, skill)
if enemy.damage != "Miss" and enemy.damage != 0
hit_event(event, skill.animation2_id)
end
if event_non_dead?(enemy)
if enemy.engaged[0] == false
enemy.engaged[0] = true
enemy.engaged[1] = 0
set_event_movement(enemy)
return
end
end
end
end
end
when 2 # All Emenies
return if actor.can_use_skill?(skill) == false
$game_player.animation_id = skill.animation2_id
actor.sp -= skill.sp_cost
for enemy in @enemies.values
next if enemy == nil
enemy.effect_skill(actor, skill)
if enemy.damage != "Miss" and enemy.damage != 0
event = $game_map.events[enemy.event_id]
hit_event(event, 0)
end
if event_non_dead?(enemy)
if enemy.engaged[0] == false
enemy.engaged[0] = true
enemy.engaged[1] = 0
set_event_movement(enemy)
end
end
end
return
when 3..4 # User
return if actor.can_use_skill?(skill) == false
actor.effect_skill(actor, skill)
actor.sp -= skill.sp_cost
$game_player.animation_id = skill.animation2_id
return
when 7 # User
return if actor.can_use_skill?(skill) == false
actor.effect_skill(actor, skill)
actor.sp -= skill.sp_cost
$game_player.animation_id = skill.animation2_id
end
end
#--------------------------------------------------------------------------
def ally_melee_attack(ally, id)
enemy = @enemies[id]
actor = $game_party.actors[ally.actor_id]
random = rand(100)
return if random >= 20
return if $RANGE_DISPLAY[actor.weapon_id] != nil
return if not Graphics.frame_count % 5 == 0
enemy.attack_effect(actor)
if enemy.damage != "Miss" and enemy.damage != 0
event = $game_map.events[enemy.event_id]
hit_event(event, $data_weapons[actor.weapon_id].animation2_id)
end
if not event_non_dead?(enemy)
ally.under_attack = false
end
end
#--------------------------------------------------------------------------
def ally_ranged_weapon?(ally, id)
event = $game_map.events[id]
actor = $game_party.actors[ally.actor_id]
return false if in_line?(ally, event) == false
for allies in $game_allies.values
next if allies == ally
return false if in_line?(ally, allies)
end
return false if $RANGE_DISPLAY[actor.weapon_id] == nil
weapon = $data_weapons[actor.weapon_id]
return false if weapon == nil
return false if weapon.element_set.include?($RANGE_ELEMENT_ID) == false
return false if @ranged[ally.actor_id] != nil
ammo = $RANGE_DISPLAY[weapon.id]
return false if ammo == nil
return false if $game_party.item_number(ammo[2]) == 0
$game_party.lose_item(ammo[2], 1)
@ranged[ally.actor_id] = Game_Ranged.new("Weapon", ally, actor, actor.weapon_id)
return true
end
#--------------------------------------------------------------------------
def ally_ranged_spell?(ally, id)
event = $game_map.events[id]
actor = $game_party.actors[ally.actor_id]
return false if @ranged[ally.actor_id] != nil
return false if in_line?(ally, event) == false
for allies in $game_allies.values
next if allies == ally
return false if in_line?(ally, allies)
end
for id in actor.skills
skill = $data_skills[id]
next if skill.scope > 1
next if skill.element_set.include?($RANGE_ELEMENT_ID) == false
next if skill.sp_cost > actor.sp
next if facing?(ally, event) == false
@ranged[ally.actor_id] = Game_Ranged.new("Magic", ally, actor, skill)
actor.sp -= skill.sp_cost
return true
end
return false
end
#--------------------------------------------------------------------------
def ally_heal?(ally)
lowest_actor = $game_party.actors[0]
for actor in $game_party.actors
if lowest_actor.hp > actor.hp and actor.hp != actor.maxhp and actor.dead? == false
lowest_actor = actor
end
end
return false if lowest_actor.hp == lowest_actor.maxhp and !lowest_actor.dead?
ally_actor = $game_party.actors[ally.actor_id]
for id in ally_actor.skills
skill = $data_skills[id]
next if skill.scope != 3
next if skill.element_set.include?($RANGE_ELEMENT_ID) == true
next if skill.sp_cost > ally_actor.sp
next if skill.power >= 0
next if (lowest_actor.hp/2) > skill.power.abs
lowest_actor.effect_skill(ally_actor, skill)
ally_actor.sp -= skill.sp_cost
index = $game_party.actors.index(lowest_actor)
if index == 0
$game_player.animation_id = skill.animation2_id
else
$game_allies[index].animation_id = skill.animation2_id
end
return true
end
return false
end
#--------------------------------------------------------------------------
def ally_cure?(ally)
lowest_actor = $game_party.actors[0]
for actor in $game_party.actors
if lowest_actor.states.size > actor.states.size and actor.dead? == false
lowest_actor = actor
end
end
return false if lowest_actor.states.size == 0
ally_actor = $game_party.actors[ally.actor_id]
for id in ally_actor.skills
skill = $data_skills[id]
next if skill.scope != 3
next if skill.element_set.include?($RANGE_ELEMENT_ID) == true
next if skill.sp_cost > ally_actor.sp
next if skill.minus_state_set == []
next if skill.plus_state_set != []
lowest_actor.effect_skill(ally_actor, skill)
ally_actor.sp -= skill.sp_cost
index = $game_party.actors.index(lowest_actor)
if index == 0
$game_player.animation_id = skill.animation2_id
else
$game_allies[index].animation_id = skill.animation2_id
end
return true
end
return false
end
#--------------------------------------------------------------------------
def ally_range_attack?(ally, id)
return true if ally_ranged_weapon?(ally, id)
return true if ally_ranged_spell?(ally, id)
return true if ally_heal?(ally)
return true if ally_cure?(ally)
return false
end
#--------------------------------------------------------------------------
def ally_range_help(ally)
return if ally_heal?(ally)
return if ally_cure?(ally)
end
end


Next three coming soon!


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
123q
post Jun 13 2006, 03:13 PM
Post #2


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




CODE
#======================================
# ■ Game ABS Enemy
#======================================

class Game_ABS_Enemy < Game_Battler
#--------------------------------------------------------------------------
attr_accessor :event_id
attr_accessor :behavior
attr_accessor :detection
attr_accessor :aggressiveness
attr_accessor :trigger
attr_accessor :speed
attr_accessor :frequency
attr_accessor :engaged
attr_accessor :linking
attr_accessor :move_type
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :ranged
#--------------------------------------------------------------------------
def initialize(enemy_id)
super()
@event_id= 0
@behavior = 0
@detection = []
@aggressiveness = 1
@trigger = []
@enemy_id = enemy_id
@engaged = []
@linking = false
@speed = 0
@frequency = 0
@move_type = 0
@move_frequency = 0
@move_speed = 0
@ranged = nil
@hp = maxhp
@sp = maxsp
end
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
def index
return @member_index
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
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
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

#======================================
# ■ Game Battler
#======================================

class Game_Battler
#--------------------------------------------------------------------------
def can_use_skill?(skill)
if skill.sp_cost > self.sp
return false
end
if dead?
return false
end
if skill.atk_f == 0 and self.restriction == 1
return false
end
occasion = skill.occasion
case occasion
when 0..1
return true
when 2..3
return false
end
end
#--------------------------------------------------------------------------
def effect_skill(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

#======================================
# ■ Game Party
#======================================

class Game_Party
#--------------------------------------------------------------------------
alias abs_game_party_initialize initialize
#--------------------------------------------------------------------------
attr_accessor :party_max
#--------------------------------------------------------------------------
def initialize
@allies_active = true
@party_max = 6
@player_trans = false
@locked = false
abs_game_party_initialize
end
#--------------------------------------------------------------------------
def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < @party_max and not @actors.include?(actor)
@actors.push(actor)
$game_player.refresh
id = @actors.size-1
$game_allies[id] = Game_Ally.new(id)
$game_allies[id].refresh
$game_allies[id].moveto($game_player.x,$game_player.y)
if $scene.spriteset != nil
$scene.spriteset.add_ally(id)
end
end
end
#--------------------------------------------------------------------------
def kill_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.include?(actor)
id = @actors.index(actor)
if id == 0
if all_dead? == false
shift_forward
$game_allies[$game_party.actors.size-1].dead = true
$game_allies[$game_party.actors.size-1].refresh
end
else
$game_allies[id].dead = true
$game_allies[id].refresh
end
end
end
#--------------------------------------------------------------------------
def remove_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.include?(actor)
id = @actors.size - 1
@actors.delete(actor)
$game_player.refresh
for key in $game_allies.keys
$game_allies[key].refresh
end
$game_allies.delete(id)
end
end
#--------------------------------------------------------------------------
def shift_forward
new_x = 0
new_y = 0
loop do
temp = @actors.shift
@actors.push(temp)
if $game_party.actors.size <= 1
return
end
x = $game_player.x
y = $game_player.y
direction = $game_player.direction
wait = $game_player.wait_command
map_id = $game_player.map_id
transparent = $game_player.transparent
$game_player.move_to($game_allies[1].x,$game_allies[1].y)
$game_player.center($game_allies[1].x, $game_allies[1].y)
new_x = $game_allies[1].x
new_y = $game_allies[1].y
$game_player.direction = $game_allies[1].direction
$game_player.wait_command = false
$game_player.map_id = $game_allies[1].map_id
$game_player.transparent = false
@player_trans = $game_allies[1].transparent
for i in 1...$game_party.actors.size-1
$game_allies[i].move_to($game_allies[i+1].x,$game_allies[i+1].y)
$game_allies[i].direction = $game_allies[i+1].direction
$game_allies[i].wait_command = $game_allies[i+1].wait_command
$game_allies[i].map_id = $game_allies[i+1].map_id
$game_allies[i].transparent = $game_allies[i+1].transparent
end
$game_allies[$game_party.actors.size-1].move_to(x,y)
$game_allies[$game_party.actors.size-1].direction = direction
$game_allies[$game_party.actors.size-1].wait_command = wait
$game_allies[$game_party.actors.size-1].map_id = map_id
$game_allies[$game_party.actors.size-1].transparent = @player_trans
$game_player.refresh
for ally in $game_allies.values
ally.refresh
end
if @actors[0].dead? == false
break
end
end
new_map(new_x, new_y)
end
#--------------------------------------------------------------------------
def shift_backward
new_x = 0
new_y = 0
loop do
temp = @actors.pop
@actors.unshift(temp)
if $game_party.actors.size <= 1
return
end
x = $game_player.x
y = $game_player.y
direction = $game_player.direction
wait = $game_player.wait_command
map_id = $game_player.map_id
transparent = $game_player.transparent
id = $game_party.actors.size-1
$game_player.move_to($game_allies[id].x, $game_allies[id].y)
$game_player.direction = $game_allies[id].direction
$game_player.wait_command = false
$game_player.map_id = $game_allies[id].map_id
$game_player.transparent = false
@player_trans = $game_allies[id].transparent
for i in 1...$game_party.actors.size-1
id = $game_party.actors.size-i
$game_allies[id].move_to($game_allies[id -1].x,$game_allies[id-1].y)
$game_allies[id].direction = $game_allies[id -1].direction
$game_allies[id].wait_command = $game_allies[id -1].wait_command
$game_allies[id].map_id = $game_allies[id -1].map_id
$game_allies[id].transparent = $game_allies[id -1].transparent
end
$game_allies[1].move_to(x,y)
$game_allies[1].direction = direction
$game_allies[1].wait_command = wait
$game_allies[1].map_id = map_id
$game_allies[1].transparent = @player_trans
$game_player.refresh
for ally in $game_allies.values
ally.refresh
end
if @actors[0].dead? == false
break
end
end
new_map(new_x, new_y)
end
#--------------------------------------------------------------------------
def new_map(new_x, new_y)
if $game_player.map_id != $game_map.map_id
$game_map.setup($game_player.map_id)
$game_player.moveto(new_x,new_y)
for ally in $game_allies.values
if ally.map_id != $game_map.map_id
ally.wait_command = true
end
end
$ABS.transer_player = true
$game_temp.transition_processing = true
end
end
end

#=====================================
# ■ Game Character
#=====================================

class Game_Character
#--------------------------------------------------------------------------
attr_accessor :character_name
attr_accessor :character_hue
attr_accessor :direction
attr_accessor :direction_fix
attr_accessor :wait_command
attr_accessor :map_id
attr_accessor :move_type
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :object
#--------------------------------------------------------------------------
alias abs_game_character_initialize initialize
alias abs_game_character_update update
#--------------------------------------------------------------------------
def initialize
abs_game_character_initialize
@wait_command = false
@map_id = 0
@object = nil
end
#--------------------------------------------------------------------------
def move_to(x, y)
@x = x
@y = y
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end
#--------------------------------------------------------------------------
def update
abs_game_character_update
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
if @move_type == 4
move_toward_object
end
end
end
#--------------------------------------------------------------------------
def move_toward_object
sx = @x - @object.x
sy = @y - @object.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_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
def move_away_from_object
sx = @x - @object.x
sy = @y - @object.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? and sy != 0
sy > 0 ? move_down : move_up
end
else
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
#--------------------------------------------------------------------------
def turn_toward_object
sx = @x - @object.x
sy = @y - @object.y
if sx == 0 and sy == 0
return
end
if sx.abs > sy.abs
sx > 0 ? turn_left : turn_right
else
sy > 0 ? turn_up : turn_down
end
end
#--------------------------------------------------------------------------
def move_ally(ally)
ally.move_away_from_player
end
#--------------------------------------------------------------------------
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
unless $game_map.valid?(new_x, new_y)
return false
end
if @through
return true
end
unless $game_map.passable?(x, y, d, self)
return false
end
unless $game_map.passable?(new_x, new_y, 10 - d)
return false
end
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if self != $game_player and !self.is_a?(Game_Ally)
return false
end
if event.character_name != ""
return false
end
end
end
end
for ally in $game_allies.values
if ally.map_id == $game_map.map_id
if ally.x == new_x and ally.y == new_y
unless ally.through
if self != $game_player and ally.dead == false
return false
else
move_ally(ally) if ally.dead == false
return true
end
end
end
end
end
if $game_player.x == new_x and $game_player.y == new_y
unless $game_player.through
if @character_name != ""
return false
end
end
end
return true
end
end

#=====================================
# ■ Game Ranged
#=====================================

class Game_Ranged < Game_Character
#--------------------------------------------------------------------------
attr_accessor :running
attr_accessor :ending
#--------------------------------------------------------------------------
def initialize(type, event, enemy, attack = nil)
super()
@move_speed = 5
@type = type
@event = event
@enemy = enemy
@move_direction = event.direction
@attack = attack
@running = false
@ending = false
refresh(event)
end
#--------------------------------------------------------------------------
def refresh(event)
moveto(event.x, event.y)
case @type
when "Magic"
@character_name = "Magic Balls.png"
when "Weapon"
display = $RANGE_DISPLAY[@attack]
@character_name = display[0]
end
end
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
if turn_enabled
turn_down
end
if passable?(@x, @y, 2)
turn_down
@y += 1
end
end
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
if turn_enabled
turn_left
end
if passable?(@x, @y, 4)
turn_left
@x -= 1
end
end
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
if turn_enabled
turn_right
end
if passable?(@x, @y, 6)
turn_right
@x += 1
end
end
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
if turn_enabled
turn_up
end
if passable?(@x, @y, 8)
turn_up
@y -= 1
end
end
#--------------------------------------------------------------------------
def hit_actor(object, enemy)
object.jump(0, 0)
end
#--------------------------------------------------------------------------
def set_event_movement(enemy)
event = $game_map.events[enemy.event_id]
enemy.move_type = event.move_type
enemy.move_frequency = event.move_frequency
enemy.move_speed = event.move_speed
if enemy.engaged[1] == 0
event.object = $game_player
else
event.object = $game_allies[enemy.engaged[1]]
end
event.move_type = 4
event.move_toward_object
event.move_frequency = enemy.frequency
event.move_speed = enemy.speed
end
#--------------------------------------------------------------------------
def return_event_movement(enemy)
event = $game_map.events[enemy.event_id]
event.move_type = enemy.move_type
event.move_frequency = enemy.move_frequency
event.move_speed = enemy.move_speed
end
#--------------------------------------------------------------------------
def actor_non_dead?(actor, enemy)
if actor.dead?
return true if enemy.is_a?(Game_Actor)
if enemy.engaged[1] == 0
$ABS.player_engaged = false
else
$game_allies[enemy.engaged[1]].under_attack = false
end
return_event_movement(enemy)
enemy.engaged[0] = false
enemy.engaged[1] = 0
$game_party.kill_actor(actor.id)
if $game_party.all_dead?
$game_temp.gameover = true
end
return false
end
return true
end
#--------------------------------------------------------------------------
def event_non_dead?(actor, event, event_actor)
if actor.dead?
if event_actor.engaged[1] == 0
$ABS.player_engaged = false
else
$game_allies[event_actor.engaged[1]].under_attack = false
end
id = event_actor.event_id
$ABS.enemies.delete(id)
event = $game_map.events[event_actor.event_id]
event.character_name = ""
case event_actor.trigger[0]
when 0
event.erase
when 1
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if event_actor.trigger[1] == 0
$game_switches[event_actor.trigger[1]] = true
$game_map.need_refresh = true
when 2
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if event_actor.trigger[1] == 0
if event_actor.trigger[2] == 0
$game_variables[event_actor.trigger[1]] += 1
$game_map.need_refresh = true
else
$game_variables[event_actor.trigger[1]] = event_actor.trigger[2]
$game_map.need_refresh = true
end
when 3
value = "A" if event_actor.trigger[1] == 1
value = "B" if event_actor.trigger[1] == 2
value = "C" if event_actor.trigger[1] == 3
value = "D" if event_actor.trigger[1] == 4
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
key = [$game_map.map_id, event.id, value]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
return false
end
return true
end
#--------------------------------------------------------------------------
def set_engaged(enemy,type)
if type == 0
@player_engaged = true
@player_obect = $game_map.events[enemy.event_id]
else
$game_allies[type].object = $game_map.events[enemy.event_id]
$game_allies[type].under_attack = true
end
end
#--------------------------------------------------------------------------
def update
super
if !moving?
if !passable?(@x, @y, @move_direction) and @ending == false
@ending = true
@through = true
case @move_direction
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
@transparent = true
if @x == $game_player.x and @y == $game_player.y
actor = $game_party.actors[0]
case @type
when "Magic"
actor.effect_skill(@enemy, @attack)
if $game_party.actors[0].damage != "Miss" and $game_party.actors[0].damage != 0
@animation_id = @attack.animation2_id
end
if not @enemy.is_a?(Game_Actor)
set_engaged(@enemy, 0)
end
when "Weapon"
actor.attack_effect(@enemy)
if $game_party.actors[0].damage != "Miss" and $game_party.actors[0].damage != 0
hit_actor($game_player, @enemy)
display = $RANGE_DISPLAY[@enemy.weapon_id]
if display == nil
animation = @enemy.animation2_id
else
animation = display[1]
end
@animation_id = animation
end
end
if not @enemy.is_a?(Game_Actor)
set_engaged(@enemy, 0)
end
actor_non_dead?(actor, @enemy)
end
for event in $game_map.events.values
if @x == event.x and @y == event.y
event_actor = $ABS.enemies[event.id]
next if event_actor == nil
case @type
when "Magic"
event_actor.effect_skill(@enemy, @attack)
if event_actor.damage != "Miss" and event_actor.damage != 0
@animation_id = @attack.animation2_id
end
when "Weapon"
event_actor.attack_effect(@enemy)
if event_actor.damage != "Miss" and event_actor.damage != 0
hit_actor(event, @enemy)
display = $RANGE_DISPLAY[@enemy.weapon_id]
if display == nil
animation = @enemy.animation2_id
else
animation = display[1]
end
@animation_id = animation
end
end
if event_non_dead?(event_actor, event, event_actor)
if @event.is_a?(Game_Player)
event_actor.engaged[0] = true
event_actor.engaged[1]= 0
set_event_movement(event_actor)
elsif @event.is_a?(Game_Ally)
event_actor.engaged[0] = true
event_actor.engaged[1]= @event.actor_id
set_event_movement(event_actor)
end
end
end
end
for ally in $game_allies.values
if @x == ally.x and @y == ally.y
ally_actor = $game_party.actors[ally.actor_id]
next if ally.dead
case @type
when "Magic"
ally_actor.effect_skill(@enemy, @attack)
if ally_actor.damage != "Miss" and ally_actor.damage != 0
@animation_id = @attack.animation2_id
end
if not @enemy.is_a?(Game_Actor)
set_engaged(@enemy, ally.actor_id)
end
when "Weapon"
ally_actor.attack_effect(@enemy)
if ally_actor.damage != "Miss" and ally_actor.damage != 0
hit_actor(ally, @enemy)
display = $RANGE_DISPLAY[@enemy.weapon_id]
if display == nil
animation = @enemy.animation2_id
else
animation = display[1]
end
@animation_id = animation
end
end
if not @enemy.is_a?(Game_Actor)
set_engaged(@enemy, ally.actor_id)
end
actor_non_dead?(ally_actor, @enemy)
end
end
end
return if @ending
case @move_direction
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
end
end

#=====================================
# ■ Game Ally
#=====================================

class Game_Ally < Game_Character
#--------------------------------------------------------------------------
attr_accessor :actor_id
attr_accessor :dead
attr_accessor :under_attack
attr_accessor :forced_attack
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
@forced_attack = false
@actor_id = actor_id
@map_id = $game_player.map_id
@dead = false
@under_attack = false
@attacker = 0
refresh
end
#--------------------------------------------------------------------------
def refresh
if $game_party.actors.size == 0
@character_name = ""
@character_hue = 0
return
end
if $game_party.actors[@actor_id] == nil
@character_name = ""
@character_hue = 0
return
end
if $game_party.actors[@actor_id].dead?
@dead = true
else
@dead = false
end
if @dead == true
actor = $game_party.actors[@actor_id]
if $DEAD_DISPLAY[actor.id] != nil
display = $DEAD_DISPLAY[actor.id]
@character_name = display[0]
@direction = display[1]
@direction_fix = true
@pattern = display[2]
@original_pattern = display[2]
else
@character_name = ""
end
return
end
actor = $game_party.actors[@actor_id]
@character_name = actor.character_name
@character_hue = actor.character_hue
@opacity = 255
@blend_type = 0
@direction_fix = false
end
#--------------------------------------------------------------------------
def update
if $game_party.actors[@actor_id].dead? and @dead == false
refresh
end
if @wait_command == false and @map_id == $game_map.map_id and @dead == false and moving? == false
if @forced_attack == true and $ABS.player_engaged == false
@forced_attack = false
@under_attack = false
end
if $ABS.ally_ai_active == true and @under_attack == true
return if @object == nil
position = $data_classes[$game_party.actors[@actor_id].class_id].position
return if $ABS.enemies[@object.id] == nil
max_range = [$ABS.enemies[@object.id].detection[0], $ABS.enemies[@object.id].detection[1]].max
case position
when 0
return if $ABS.ally_range_attack?(self, @object.id)
if $RANGE_DISPLAY[$game_party.actors[@actor_id].weapon_id] == nil
if in_range?(1, @object)
move_toward_object
$ABS.ally_melee_attack(self, @object.id)
else
move_toward_object
end
else
if in_range?(1, @object)
move_away_from_object
elsif in_range?(max_range, @object)
move_away_from_object
elsif in_range?(max_range+1, @object)
turn_toward_object
@under_attack = false
else
move_toward_object
end
end
when 1
return if $ABS.ally_range_attack?(self, @object.id)
if $RANGE_DISPLAY[$game_party.actors[@actor_id].weapon_id] == nil
if in_range?(1, @object)
move_toward_object
$ABS.ally_melee_attack(self, @object.id)
else
move_toward_object
end
else
if in_range?(1, @object)
move_away_from_object
elsif in_range?(max_range, @object)
move_away_from_object
elsif in_range?(max_range+1, @object)
turn_toward_object
@under_attack = false
else
move_toward_object
end
end
when 2
return if $ABS.ally_range_attack?(self, @object.id)
if in_range?(1, @object)
move_away_from_object
elsif in_range?(max_range, @object)
move_away_from_object
elsif in_range?(max_range+1, @object)
turn_toward_object
@under_attack = false
else
move_toward_object
end
end
else
$ABS.ally_range_help(self) if Graphics.frame_count % 80 == 0
normal_movement
end
end
super
end
#--------------------------------------------------------------------------
def normal_movement
range = $data_classes[$game_party.actors[@actor_id].class_id].position
if $ABS.close_follow == false
range += 2
end
if !in_range?(range)
move_toward_player
end
end
#--------------------------------------------------------------------------
def in_range?(range, element = $game_player, object = self)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x +y
if r <= (range * range)
return true
else
return false
end
end
#--------------------------------------------------------------------------
def facing?(object = $game_player)
playerx = object.x
playery = object.y
if @direction == 2
if playery >= @y
return true
end
end
if @direction == 4
if playerx <= @x
return true
end
end
if @direction == 6
if playerx >= @x
return true
end
end
if @direction == 8
if playery <= @y
return true
end
end
return false
end
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
end


Two more to go.


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
123q
post Jun 13 2006, 03:14 PM
Post #3


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




Script three:

CODE
#=====================================
# ■ Game Map
#=====================================

class Game_Map
#--------------------------------------------------------------------------
alias abs_game_map_setup setup
#--------------------------------------------------------------------------
def setup(map_id)
$ABS.enemies = {}
abs_game_map_setup(map_id)
end
#--------------------------------------------------------------------------
def passable?(x, y, d, self_event = nil)
unless valid?(x, y)
return false
end
bit = (1 << (d / 2 - 1)) & 0x0f
for event in events.values
if event.tile_id >= 0 and event != self_event and
event.x == x and event.y == y and not event.through
if @passages[event.tile_id] & bit != 0
return false
elsif @passages[event.tile_id] & 0x0f == 0x0f
return false
elsif @priorities[event.tile_id] == 0
return true
end
end
end
for ally in $game_allies.values
if ally.map_id == $game_map.map_id
if ally.dead == false
if ally.tile_id >= 0 and ally != self_event and
ally.x == x and ally.y == y and not ally.through
if @passages[ally.tile_id] & bit != 0
return false
elsif @passages[ally.tile_id] & 0x0f == 0x0f
return false
elsif @priorities[ally.tile_id] == 0
return true
end
end
end
end
end
for i in [2, 1, 0]
tile_id = data[x, y, i]
if tile_id == nil
return false
elsif @passages[tile_id] & bit != 0
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
end

#======================================
# ■ Game Event
#======================================

class Game_Event < Game_Character
#--------------------------------------------------------------------------
alias abs_game_event_refresh refresh
#--------------------------------------------------------------------------
def name
return @event.name
end
#--------------------------------------------------------------------------
def id
return @id
end
#--------------------------------------------------------------------------
def refresh
abs_game_event_refresh
$ABS.refresh(@event, @list, @character_name)
end
end

#======================================
# ■ Game Player
#======================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
alias abs_game_player_update update
#--------------------------------------------------------------------------
def update
abs_game_player_update
if $game_party.actors[0].dead?
actor = $game_party.actors[0]
$game_party.kill_actor(actor.id)
end
end
end

#======================================
# ■ Sprite Display
#======================================

class Sprite_Display < Sprite
#--------------------------------------------------------------------------
def initialize
@counter = 0
super
self.bitmap = Bitmap.new(120, 48)
self.bitmap.font.name = $defaultfonttype
self.bitmap.font.size = $defaultfontsize
self.x = 0
self.y = 0
self.z = 500
update
end
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
def update
super
if @counter == 1
self.x = (-0.25 * $game_map.display_x) + ($game_player.x * 32) - 40
self.y = (-0.25 * $game_map.display_y) + ($game_player.y * 32) - 40
end
if $ABS.display[0]
@counter += 1
end
self.visible = $ABS.display[0]
self.bitmap.clear
if @counter != 60 and $ABS.display[0] == true
text = $ABS.display[1]
self.bitmap.font.color.set(255, 255, 255)
self.bitmap.draw_text(self.bitmap.rect, text, 1)
else
self.visible = false
@counter = 0
self.bitmap.clear
$ABS.display[0] = false
end
end
end

#======================================
# ■ Sprite Character
#======================================

class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
attr_accessor :enemy_id
attr_accessor :actor_id
#--------------------------------------------------------------------------
alias abs_spriteset_character_update update
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@enemy_id = 0
@actor_id = -1
@character = character
update
end
#--------------------------------------------------------------------------
def update
abs_spriteset_character_update
if @character.is_a?(Game_Player)
if !$game_party.actors[0].dead?
if $game_party.actors[0].damage != nil
self.damage($game_party.actors[0].damage, $game_party.actors[0].critical)
$game_party.actors[0].damage = nil
end
animation = $data_animations[$game_party.actors[0].state_animation_id]
self.loop_animation(animation)
end
end
if @character.is_a?(Game_Event)
if $ABS.enemies[@character.id] != nil
if $ABS.enemies[@character.id].damage != nil
self.damage($ABS.enemies[@character.id].damage, $ABS.enemies[@character.id].critical)
$ABS.enemies[@character.id].damage = nil
end
animation = $data_animations[$ABS.enemies[@character.id].state_animation_id]
self.loop_animation(animation)
end
end
if @character.is_a?(Game_Ally)
if @character.dead == false
return if $game_party.actors[@character.actor_id]. == nil
if $game_party.actors[@character.actor_id].damage != nil
self.damage($game_party.actors[@character.actor_id].damage, $game_party.actors[@character.actor_id].critical)
$game_party.actors[@character.actor_id].damage = nil
end
animation = $data_animations[$game_party.actors[@character.actor_id].state_animation_id]
self.loop_animation(animation)
else
self.dispose_loop_animation
self.z = 10
end
end
end
end

#======================================
# ■ Spriteset Map
#======================================

class Spriteset_Map
#--------------------------------------------------------------------------
alias abs_spriteset_map_initialize initialize
alias abs_spriteset_map_dispose dispose
alias abs_spriteset_map_update update
#--------------------------------------------------------------------------
def initialize
@ranged = []
@display = Sprite_Display.new
abs_spriteset_map_initialize
for ally in $game_allies.values
if ally.map_id != $game_map.map_id
ally.transparent = true
else
ally.transparent = false
end
sprite = Sprite_Character.new(@viewport1, ally)
@character_sprites.push(sprite)
end
end
#--------------------------------------------------------------------------
def dispose
@display.dispose
for range in @ranged
range.dispose
end
for enemy in $ABS.enemies.values
enemy.ranged = nil
end
for range in $ABS.ranged.values
range = nil
end
abs_spriteset_map_dispose
end
#--------------------------------------------------------------------------
def update
@display.update
for sprite in @character_sprites
if sprite.character.is_a?(Game_Ally)
if $game_party.actors[sprite.character.actor_id] == nil
temp = @character_sprites.delete(sprite)
temp.dispose
end
end
end
abs_spriteset_map_update
for range in @ranged
range.update
next if range.enemy_id == 0
if $ABS.enemies[range.enemy_id] == nil
temp = @ranged.delete(range)
temp.dispose
end
end
for actor_ranged in $ABS.ranged.values
next if actor_ranged == nil
if actor_ranged.running == false
actor_ranged.running = true
sprite = Sprite_Character.new(@viewport1, actor_ranged)
sprite.actor_id = $ABS.ranged.index(actor_ranged)
@ranged.push(sprite)
end
end
for enemy in $ABS.enemies.values
next if enemy.ranged == nil
if enemy.ranged.running == false
enemy.ranged.running = true
sprite = Sprite_Character.new(@viewport1, enemy.ranged)
sprite.enemy_id = $ABS.enemies.index(enemy)
@ranged.push(sprite)
end
end
for sprite in @ranged
next if sprite.enemy_id == 0
enemy= $ABS.enemies[sprite.enemy_id]
return if enemy == nil or enemy.ranged == nil or enemy.ranged.ending == nil
if enemy.ranged.ending == true
if !sprite.effect?
$ABS.enemies[sprite.enemy_id].ranged = nil
temp = @ranged.delete(sprite)
temp.dispose
end
end
end
for sprite in @ranged
next if sprite.actor_id == -1
range = $ABS.ranged[sprite.actor_id]
if range.ending == true
if !sprite.effect?
$ABS.ranged.delete(sprite.actor_id)
temp = @ranged.delete(sprite)
temp.dispose
end
end
end
end
#--------------------------------------------------------------------------
def add_ally(id)
sprite = Sprite_Character.new(@viewport1, $game_allies[id])
@character_sprites.push(sprite)
end
end

#======================================
# ■ Window Base
#======================================

class Window_Base < Window
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 70, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
return if actor.maxhp == 0
w = width * actor.hp / actor.maxhp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y, width = 70, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
return if actor.maxsp == 0
w = width * actor.sp / actor.maxsp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_dash_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.dash_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.dash_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_sneak_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.sneak_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.sneak_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
end

#======================================
# ■ Window HUB
#======================================

class Window_HUD < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.opacity = 100
update
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(-20, 0, 50, 30, "L", 1)
self.contents.draw_text(-20, 15, 50, 30, "E", 1)
self.contents.draw_text(-10, 0, 50, 30, "A", 1)
self.contents.draw_text(-10, 15, 50, 30, "D", 1)
for i in 0...4
actor = $game_party.actors[i]
next if actor == nil
if $game_allies[i] != nil
if $game_allies[i].under_attack == true and actor.dead? == false
self.contents.draw_text(60 + (i*110), -5, 70, 32, "Engaged", 1)
else
draw_actor_state(actor, 60 + (i*110), -5, width = 70)
end
else
if $ABS.player_engaged == true and actor.dead? == false
self.contents.draw_text(60 + (i*110), -5, 70, 32, "Engaged", 1)
else
draw_actor_state(actor, 60 + (i*110), -5, width = 70)
end
end
self.contents.font.color = normal_color
draw_actor_graphic(actor, 40 + (i*110), 45)
draw_actor_hp_bar(actor, 60 + (i*110), 25)
draw_actor_sp_bar(actor, 60 + (i*110), 40)
end
self.contents.draw_text(480, -5, 50, 32, "Dash", 1)
draw_dash_bar(480, 30)
self.contents.draw_text(550, -5, 50, 32, "Sneak", 1)
draw_sneak_bar(550, 30)
Graphics.frame_reset
end
#--------------------------------------------------------------------------
def update
return if Graphics.frame_count % 20 != 0
return if self.visible == false
refresh
Graphics.frame_reset
end
end

#======================================
# ■ Scene Title
#======================================

class Scene_Title
#--------------------------------------------------------------------------
alias abs_scene_title_cng command_new_game
#--------------------------------------------------------------------------
def command_new_game
$game_system.se_play($data_system.decision_se)
Audio.bgm_stop
Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new

$ABS = Action_Battle_System.new
$game_allies = {}
for i in 1...$data_system.party_members.size
$game_allies[i] = Game_Ally.new(i)
end
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
for ally in $game_allies.values
ally.moveto($data_system.start_x, $data_system.start_y)
ally.refresh
ally.map_id = $data_system.start_map_id
end

$game_player.map_id = $data_system.start_map_id
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
end

#======================================
# ■ Scene Skill
#======================================

class Scene_Skill
#--------------------------------------------------------------------------
alias abs_scene_skill_main main
alias abs_scene_skill_update update
alias abs_scene_skill_update_skill update_skill
#--------------------------------------------------------------------------
def main
@shk_window = Window_Command.new(250, ["Skill Assigned to Hot Key"])
@shk_window.visible = false
@shk_window.active = false
@shk_window.x = 200
@shk_window.y = 250
@shk_window.z = 1500
abs_scene_skill_main
@shk_window.dispose
end
#--------------------------------------------------------------------------
def update
@shk_window.update
abs_scene_skill_update
if @shk_window.active
update_shk
return
end
end
#--------------------------------------------------------------------------
def update_skill
abs_scene_skill_update_skill
if Kboard.keyboard($R_Key_H)
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_key[1] = @skill_window.skill.id
end
if Kboard.keyboard($R_Key_J)
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_key[2] = @skill_window.skill.id
end
if Kboard.keyboard($R_Key_K)
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_key[3] = @skill_window.skill.id
end
if Kboard.keyboard($R_Key_L)
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_key[3] = @skill_window.skill.id
end
end
#--------------------------------------------------------------------------
def update_shk
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@shk_window.active = false
@shk_window.visible = false
@skill_window.active = true
$scene = Scene_Skill.new(@actor_index)
return
end
end
end

#======================================
# ■ Scene Load
#======================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
alias abs_scene_load_read_save_data read_save_data
#--------------------------------------------------------------------------
def read_save_data(file)
$ABS = Action_Battle_System.new
abs_scene_load_read_save_data(file)
$game_allies = Marshal.load(file)
$game_map.setup($game_map.map_id)
end
end

#======================================
# ■ Scene Save
#======================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
alias abs_scene_save_write_save_data write_save_data
#--------------------------------------------------------------------------
def write_save_data(file)
abs_scene_save_write_save_data(file)
Marshal.dump($game_allies, file)
end
end

#======================================
# ■ Keyboard Script
#---------------------------------------------------------------------------
#  By: Cybersam
# Date: 25/05/05
# Version 4
#======================================

module Kboard
#--------------------------------------------------------------------------
$RMouse_BUTTON_L = 0x01 # left mouse button
$RMouse_BUTTON_R = 0x02 # right mouse button
$RMouse_BUTTON_M = 0x04 # middle mouse button
$RMouse_BUTTON_4 = 0x05 # 4th mouse button
$RMouse_BUTTON_5 = 0x06 # 5th mouse button
#--------------------------------------------------------------------------
$R_Key_BACK = 0x08 # BACKSPACE key
$R_Key_TAB = 0x09 # TAB key
$R_Key_RETURN = 0x0D # ENTER key
$R_Key_SHIFT = 0x10 # SHIFT key
$R_Key_CTLR = 0x11 # CTLR key
$R_Key_ALT = 0x12 # ALT key
$R_Key_PAUSE = 0x13 # PAUSE key
$R_Key_CAPITAL = 0x14 # CAPS LOCK key
$R_Key_ESCAPE = 0x1B # ESC key
$R_Key_SPACE = 0x20 # SPACEBAR
$R_Key_PRIOR = 0x21 # PAGE UP key
$R_Key_NEXT = 0x22 # PAGE DOWN key
$R_Key_END = 0x23 # END key
$R_Key_HOME = 0x24 # HOME key
$R_Key_LEFT = 0x25 # LEFT ARROW key
$R_Key_UP = 0x26 # UP ARROW key
$R_Key_RIGHT = 0x27 # RIGHT ARROW key
$R_Key_DOWN = 0x28 # DOWN ARROW key
$R_Key_SELECT = 0x29 # SELECT key
$R_Key_PRINT = 0x2A # PRINT key
$R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
$R_Key_INSERT = 0x2D # INS key
$R_Key_DELETE = 0x2E # DEL key
#--------------------------------------------------------------------------
$R_Key_0 = 0x30 # 0 key
$R_Key_1 = 0x31 # 1 key
$R_Key_2 = 0x32 # 2 key
$R_Key_3 = 0x33 # 3 key
$R_Key_4 = 0x34 # 4 key
$R_Key_5 = 0x35 # 5 key
$R_Key_6 = 0x36 # 6 key
$R_Key_7 = 0x37 # 7 key
$R_Key_8 = 0x38 # 8 key
$R_Key_9 = 0x39 # 9 key
#--------------------------------------------------------------------------
$R_Key_A = 0x41 # A key
$R_Key_B = 0x42 # B key
$R_Key_C = 0x43 # C key
$R_Key_D = 0x44 # D key
$R_Key_E = 0x45 # E key
$R_Key_F = 0x46 # F key
$R_Key_G = 0x47 # G key
$R_Key_H = 0x48 # H key
$R_Key_I = 0x49 # I key
$R_Key_J = 0x4A # J key
$R_Key_K = 0x4B # K key
$R_Key_L = 0x4C # L key
$R_Key_M = 0x4D # M key
$R_Key_N = 0x4E # N key
$R_Key_O = 0x4F # O key
$R_Key_P = 0x50 # P key
$R_Key_Q = 0x51 # Q key
$R_Key_R = 0x52 # R key
$R_Key_S = 0x53 # S key
$R_Key_T = 0x54 # T key
$R_Key_U = 0x55 # U key
$R_Key_V = 0x56 # V key
$R_Key_W = 0x57 # W key
$R_Key_X = 0x58 # X key
$R_Key_Y = 0x59 # Y key
$R_Key_Z = 0x5A # Z key
#--------------------------------------------------------------------------
$R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
$R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
$R_Key_APPS = 0x5D # Applications key (Natural keyboard)
#--------------------------------------------------------------------------
$R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
$R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
$R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
$R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
$R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
$R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
$R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
$R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
$R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
$R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
$R_Key_MULTIPLY = 0x6A # Multiply key (*)
$R_Key_ADD = 0x6B # Add key (+)
$R_Key_SEPARATOR = 0x6C # Separator key
$R_Key_SUBTRACT = 0x6D # Subtract key (-)
$R_Key_DECIMAL = 0x6E # Decimal key
$R_Key_DIVIDE = 0x6F # Divide key (/)
#--------------------------------------------------------------------------
$R_Key_F1 = 0x70 # F1 key
$R_Key_F2 = 0x71 # F2 key
$R_Key_F3 = 0x72 # F3 key
$R_Key_F4 = 0x73 # F4 key
$R_Key_F5 = 0x74 # F5 key
$R_Key_F6 = 0x75 # F6 key
$R_Key_F7 = 0x76 # F7 key
$R_Key_F8 = 0x77 # F8 key
$R_Key_F9 = 0x78 # F9 key
$R_Key_F10 = 0x79 # F10 key
$R_Key_F11 = 0x7A # F11 key
$R_Key_F12 = 0x7B # F12 key
#--------------------------------------------------------------------------
$R_Key_NUMLOCK = 0x90 # NUM LOCK key
$R_Key_SCROLL = 0x91 # SCROLL LOCK key
#--------------------------------------------------------------------------
$R_Key_LSHIFT = 0xA0 # Left SHIFT key
$R_Key_RSHIFT = 0xA1 # Right SHIFT key
$R_Key_LCONTROL = 0xA2 # Left CONTROL key
$R_Key_RCONTROL = 0xA3 # Right CONTROL key
$R_Key_L_ALT = 0xA4 # Left ALT key
$R_Key_R_ALT = 0xA5 # Right ALT key
#--------------------------------------------------------------------------
$R_Key_SEP = 0xBC # , key
$R_Key_DASH = 0xBD # - key
$R_Key_DOTT = 0xBE # . key
#--------------------------------------------------------------------------
GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
#--------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
def keyb(rkey)
if GetKeyState.call(rkey) != 0
return 1
end
return 0
end
#--------------------------------------------------------------------------
def keyboard(rkey)
GetKeyState.call(rkey) & 0x01 == 1 #
end
#--------------------------------------------------------------------------
def key(rkey, key = 0)
GetKeyboardState.call(rkey) & 0x01 == key #
end
end


One more to go.


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
123q
post Jun 13 2006, 03:18 PM
Post #4


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




CODE
#==============================================================================
# Kingdom Hearts Battle System
#--------------------------------------------------------------------------
#   Orginal Battle System Created By Near Fantastica. Give Him most of the credit. My job was easy
#   Created By SephirothSpawn (11.30.05)
#   Last Updated: 11.30.05
#--------------------------------------------------------------------------
#   Instructions:
# ~ Insert Above Main, and Below Nears ABS.
# ~ Delete Scene Battle In Near's Code
# ~ In Scene Map, find the lines and delete them:
#    # If B button was pressed
#    if Input.trigger?(Input::B)
#      # If event is running, or menu is not forbidden
#      unless $game_system.map_interpreter.running? or
#             $game_system.menu_disabled
#        # Set menu calling flag or beep flag
#        $game_temp.menu_calling = true
#        $game_temp.menu_beep = true
#      end
#    end
#==============================================================================

#==============================================================================
# ** Class Window_Base
#==============================================================================
class Window_Base
 #--------------------------------------------------------------------------
 # Draw Inverted Bar
 #   Credit Near Fantastica for Orginal Script
 #--------------------------------------------------------------------------
 def draw_invert_bar(x, y, min, max, width = 152, height = 20, bar_color = Color.new(0, 0, 200, 255))
   w = width * min / max
   for i in 0..height
     r = bar_color.red * (height -i)/height + 0 * i/height
     g = bar_color.green * (height -i)/height + 0 * i/height
     b = bar_color.blue * (height -i)/height + 0 * i/height
     a = bar_color.alpha * (height -i)/height + 255 * i/height
     self.contents.fill_rect(x - w, y+i, w , 1, Color.new(r, g, b, a))
   end    
 end
 #--------------------------------------------------------------------------
 # * Draw Face
 #     actor : actor's face
 #--------------------------------------------------------------------------
 def draw_face(x, y, actor, border = true)
   if border
     bitmap = RPG::Cache.character("Faces/Background", 0)
     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
     self.contents.blt(x, y, bitmap, src_rect)
   end
   bitmap = RPG::Cache.character("Faces/#{actor.character_name}", actor.character_hue)
   src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
   self.contents.blt(x, y, bitmap, src_rect)
   if border
     bitmap = RPG::Cache.character("Faces/Border", 0)
     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
     self.contents.blt(x - 6, y - 6, bitmap, src_rect)
   end
 end
end  

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
 # Changes Commands to an Accessor, for refreshing
 attr_accessor :commands
end

#==============================================================================
# ** Window_ABS_Skill
#==============================================================================
class Window_ABS_Skill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     actor : actor
 #--------------------------------------------------------------------------
 def initialize
   super(4, 316, 240, 160)
     self.opacity = 175
   refresh
   self.index = 0
 end
 #--------------------------------------------------------------------------
 # * Acquiring Skill
 #--------------------------------------------------------------------------
 def skill
   return @skills[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh(actor= $game_party.actors[0])
   @actor = actor
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @skills = []
   for i in 0...@actor.skills.size
     skill = $data_skills[@actor.skills[i]]
     if skill != nil
       @skills.push(skill)
     end
   end
   # If item count is not 0, make a bit map and draw all items
   @item_max = @skills.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
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   skill = @skills[index]
   self.contents.font.name = $defaultfonttype
   self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
   x = 4
   y = index * 32
   rect = Rect.new(x, y, self.width - 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, contents.width - 28, 32, skill.name)
   self.contents.draw_text(-x, y, contents.width, 32, skill.sp_cost.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # * Check Skill
 #--------------------------------------------------------------------------
 def check_skill(skill)
   actor = $game_party.actors[0]
   if skill == nil or not actor.skills.include?(skill.id) or actor.sp < skill.sp_cost
     return false
   else
     return true
   end
 end
 #--------------------------------------------------------------------------
 # * Help Text Update
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.skill == nil ? "" : self.skill.description)
 end
end

#==============================================================================
# ** Window_ABS_Item
#==============================================================================

class Window_ABS_Item < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(4, 316, 240, 160)
     self.opacity = 175
   refresh
   self.index = 0
 end
 #--------------------------------------------------------------------------
 # * Get Item
 #--------------------------------------------------------------------------
 def item
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   # Add item
   for i in 1...$data_items.size
     if $game_party.item_number(i) > 0
       @data.push($data_items[i])
     end
   end
   # If item count is not 0, make a bit map and draw all items
   @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
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   item = @data[index]
   number = $game_party.item_number(item.id)
   self.contents.font.name = $defaultfonttype
   self.contents.font.color = $game_party.item_can_use?(item.id) ? normal_color : disabled_color
   x = 4
   y = index * 32
   rect = Rect.new(x, y, self.width - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.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, 212, 32, item.name, 0)
   self.contents.draw_text(-x - 28, y, contents.width, 32, ":", 2)
   self.contents.draw_text(-x, y, contents.width, 32, number.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # * Help Text Update
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
 end
end

#==============================================================================
# ** Window_HotKeys
#==============================================================================

class Window_HotKeys < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(200, 160, 240, 160)
     self.opacity = 178
     self.visible = false
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   # Hot Key 1
   unless $ABS.skill_key[1] == 0
     skill = $data_skills[$ABS.skill_key[1]]
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 0, contents.width, 32, " (H) #{skill.name}")
   else
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 0, contents.width, 32, " (H) Unassigned Skill")
   end
   # Hot Key 2
   unless $ABS.skill_key[2] == 0
     skill = $data_skills[$ABS.skill_key[2]]
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 32, contents.width, 32, " (J) #{skill.name}")
   else
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 32, contents.width, 32, " (J) Unassigned Skill")
   end
   # Hot Key 3
   unless $ABS.skill_key[3] == 0
     skill = $data_skills[$ABS.skill_key[3]]
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 64, contents.width, 32, " (K) #{skill.name}")
   else
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 64, contents.width, 32, " (K) Unassigned Skill")
   end
   # Hot Key 4
   unless $ABS.skill_key[4] == 0
     skill = $data_skills[$ABS.skill_key[4]]
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 96, contents.width, 32, " (L) #{skill.name}")
   else
     self.contents.font.color = check_skill(skill) ? normal_color : disabled_color
     self.contents.draw_text(4, 96, contents.width, 32, " (L) Unassigned Skill")
   end
 end
 #--------------------------------------------------------------------------
 # * Check Skill
 #--------------------------------------------------------------------------
 def check_skill(skill)
   actor = $game_party.actors[0]
   if skill == nil or not actor.skills.include?(skill.id) or actor.sp < skill.sp_cost
     return false
   else
     return true
   end
 end
end

#==============================================================================
# ** Window_ABS_Controls
#==============================================================================

class Window_ABS_Controls < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(160, 30, 320, 416)
     self.opacity = 175
     self.z = 1000
     self.visible = false
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   contents.font.color = system_color
   contents.draw_text(0, 0, contents.width, 24, "Kingdom Hearts Controls", 1)
   contents.font.color = normal_color
   keys = ["F", "G", "H", "J", "K", "L", "I", "O", "E", "R", "T", "Y", "U", "N", "M"]
   controls = ["Melee Attack", "Range Attack", "Skill Key 1", "Skill Key 2",
               "Skill Key 3", "Skill Key 4", "Dash", "Sneak", "Change Lead Forward",
               "Change Lead Backwards", "Waits Leader", "Waits Allies", "Gathers Allies",
               "Wide Follow", "Close Follow"]
   for i in 0...keys.size
     self.contents.draw_text(4, (i + 1) * 24, contents.width, 24, "(#{keys[i]})")
     self.contents.draw_text(40, (i + 1) * 24, contents.width, 24, controls[i])
   end
 end
end

#==============================================================================
# ** Window_KH_Controls
#==============================================================================

class Window_KH_Controls < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(140, 104, 360, 272)
     self.opacity = 175
     self.z = 1000
     self.visible = false
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   contents.font.color = system_color
   contents.draw_text(0, 0, contents.width, 24, "Kingdom Hearts Controls", 1)
   contents.font.color = normal_color
   keys = ["Enter", "Esc", "Shift", "P", "[", "]", "Q", "W", "A"]
   controls = ["Actions From Command", "Returns Previous Menu",
               "Activates Command Window", "Toggles Player HUD", "Toggles Ally HUD",
               "Toggles Help Window", "Shows ABS Keys", "Shows KH Keys", "Shows Hot Keys"]
   for i in 0...keys.size
     self.contents.draw_text(4, (i + 1) * 24, contents.width, 24, "(#{keys[i]})")
     self.contents.draw_text(80, (i + 1) * 24, contents.width, 24, controls[i])
   end
 end
end

#==============================================================================
# ** Window_KH_PlayerHUD
#==============================================================================

class Window_KH_PlayerHUD < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(28, 320, 640, 172)
     self.opacity = 0
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   update
 end
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 def update
   super
   self.contents.clear
   actor = $game_party.actors[0]
   # Draw HP Bar
   draw_invert_bar(458, 0, actor.hp, actor.maxhp, actor.maxhp / 25, 34, bar_color = Color.new(0, 255, 0, 255))
   # Draw SP Bar
   draw_invert_bar(458, 35, actor.sp, actor.maxsp, actor.maxsp / 25, 34, bar_color = Color.new(0, 0, 255, 255))
   # Draw Dash Bar
   case $ABS.dash_level
   when 0 .. 1        ;bar_color = Color.new(255, 255, 0, 255)
   when 2 .. 3        ;bar_color = Color.new(255, 150, 0, 255)
   else                   ;bar_color = Color.new(255, 0, 0, 255)
   end
   draw_invert_bar(458, 70, $ABS.dash_level, 5, 75, 34, bar_color)
   # Draw Sneak Bar
   case $ABS.sneak_level
   when 0 .. 1        ;bar_color = Color.new(255, 255, 0, 255)
   when 2 .. 3        ;bar_color = Color.new(255, 150, 0, 255)
   else                   ;bar_color = Color.new(255, 0, 0, 255)
   end
   draw_invert_bar(458, 105, $ABS.sneak_level, 5, 50, 34, bar_color)
   # Draws Face
   draw_face(460, 6, actor)
 end
end

#==============================================================================
# ** Window_KH_PlayerHUD
#==============================================================================

class Window_KH_AlliesHUD < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(158, 0, 482, 80)
     self.opacity = 0
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   update
 end
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 def update
   self.contents.clear
   for i in 1...$game_party.actors.size
     x = i * 150 - 16
     actor = $game_party.actors[i]
     draw_actor_graphic(actor, x, 48)
     draw_invert_bar(x - 24, 3, actor.hp, actor.maxhp, 100, 18, bar_color = Color.new(0, 255, 0, 255))
     draw_invert_bar(x - 24, 27, actor.sp, actor.maxsp, 100, 18, bar_color = Color.new(0, 0, 255, 255))
   end
 end
end

#======================================
# ** Scene Map
#======================================

class Scene_Map
 #--------------------------------------------------------------------------
 alias abs_scene_map_main main
 alias abs_scene_map_update update
 alias abs_scene_map_transfer_player transfer_player
 #--------------------------------------------------------------------------
 attr_accessor   :spriteset
 #--------------------------------------------------------------------------
 def main
   # Help Window
   @help_window = Window_Help.new
     @help_window.z = 100
     @help_window.opacity = 150
     @help_window.visible = false
   # Command Window
   commands = ["Melee Attack", "Ranged Attack", "Skill", "Item"]
   @command_window = Window_Command.new(160, commands)
     @command_window.x = 4
     @command_window.y = 316
     @command_window.opacity = 175
   # Skills Window
   @skills_window = Window_ABS_Skill.new
     @skills_window.active = @skills_window.visible = false
   # Items Window
   @items_window = Window_ABS_Item.new
     @items_window.active = @items_window.visible = false
   # Actors Window
   commands = []
   for actor in $game_party.actors
     commands.push(actor.name)
   end
   @actors_window = Window_Command.new(160, commands)
     @actors_window.x = 4
     @actors_window.y = 316
     @actors_window.opacity = 175
     @actors_window.active = @actors_window.visible = false
   # Hot Keys Window
   @hot_keys_window = Window_HotKeys.new
   # ABS Controls Window
   @abs_controls_window = Window_ABS_Controls.new
   # Window_KH_Controls      
   @kh_controls_window = Window_KH_Controls.new
   # Player HUD
   @player_hud = Window_KH_PlayerHUD.new
   # Allies HUD
   @allies_hud = Window_KH_AlliesHUD.new
   # Stores ABS Window Objects
   @objects = [@help_window, @command_window, @skills_window,
     @items_window, @actors_window, @hot_keys_window, @abs_controls_window,
     @kh_controls_window, @player_hud, @allies_hud]
   # Default Main Method
   abs_scene_map_main
   # Disposes ABS Obejcts
   @objects.each {|x| x.dispose}
 end
 #--------------------------------------------------------------------------
 def update
   # Updates HUD's
   @player_hud.update if @player_hud.visible
   @allies_hud.update if @allies_hud.visible
   # Changes Main Option to Talk if game Event
   @command_window.commands[0] = "Melee Attack"
   switch = false
   for event in $game_map.events.values
     unless $ABS.enemies.include?(event.id) || event.is_a?(Game_Ally)
       if $ABS.in_range?(event, $game_player, 1)
          switch = true
       end
     end
   end
   if switch
     unless @command_window.commands[0] == "Talk"
       @command_window.commands[0] = "Talk"
       @command_window.refresh
     end
   else
     unless @command_window.commands == "Melee Attack"
       @command_window.commands[0] = "Melee Attack"
       @command_window.refresh
     end
   end
   # Update Help Window
   if @help_window.visible
     if @command_window.active
       case @command_window.index
       when 0  ;text = "Melee Attack an Enemy with a basic Attack"
       when 1  ;text = "Attack Enemy with a ranged Attack"
       when 2  ;text = "Select a Skill to use against your enemies"
       when 3  ;text = "Use an Item to Support the Battle"
       end
       @help_window.set_text(text)
     elsif @skills_window.active
       @skills_window.help_window = @help_window
     elsif @items_window.active
       @items_window.help_window = @help_window
     else
       @help_window.set_text("Select Member to Use Item on")
     end
   end
   # Updates Command Window
   if Input.press?(Input::A)
     @command_window.update if @command_window.active
     @skills_window.update if @skills_window.active
     @items_window.update if @items_window.active
     @actors_window.update if @actors_window.active
   end
   # Returns to Previous Menu, or Main Menu
   if Input.trigger?(Input::B)
     if @command_window.active
       unless $game_system.map_interpreter.running? or $game_system.menu_disabled
         $game_temp.menu_calling = true
         $game_temp.menu_beep = true
       end
     elsif @skills_window.active
       @skills_window.active = @skills_window.visible = false
       @command_window.active = @command_window.visible = true
     elsif @items_window.active
       @items_window.active = @items_window.visible = false
       @command_window.active = @command_window.visible = true
     else
       @actors_window.active = @actors_window.visible = false
       @items_window.active = @items_window.visible = true
     end
   end
   # Performs Action from Command Window, Skill Window or Item Window
   if Input.trigger?(Input::C)
     # Command Window
     if @command_window.active
       case @command_window.index
       when 0  # Attack
         $ABS.player_attack
       when # Ranged Attack
         $ABS.player_ranged
       when 2  # Open Skills Menu
         @command_window.active = @command_window.visible = false
         @skills_window.refresh
         @skills_window.active = @skills_window.visible = true
       when 3  # Open Items Menu
         @command_window.active = @command_window.visible = false
         @items_window.refresh
         @items_window.active = @items_window.visible = true
       end
     # Skill Window
     elsif @skills_window.active
       temp = $ABS.skill_key[1]
       $ABS.skill_key[1] = $game_party.actors[0].skills[@skills_window.index]
       $ABS.player_skill(1)
       $ABS.skill_key[1] = temp
       @skills_window.refresh
     # Item Window
     elsif @items_window.active
       @item = @items_window.item
       unless @item.is_a?(RPG::Item) or $game_party.item_can_use?(@item.id)
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       $game_system.se_play($data_system.decision_se)
       if @item.scope >= 3
         @items_window.active = @items_window.visible = false
         @actors_window.active = @actors_window.visible = true
       else
         if @item.common_event_id > 0
           $game_temp.common_event_id = @item.common_event_id
           $game_system.se_play(@item.menu_se)
           if @item.consumable
             $game_party.lose_item(@item.id, 1)
             @item_window.draw_item(@item_window.index)
           end
         end
       end
     else
       target = $game_party.actors[@actors_window.index]
       used = target.item_effect(@item)
       if used
         $game_system.se_play(@item.menu_se)
         if @item.consumable
           $game_party.lose_item(@item.id, 1)
         end
         @actors_window.active = @actors_window.visible = false
         @command_window.active = @command_window.visible = true
       end
       unless used
         $game_system.se_play($data_system.buzzer_se)
       end
     end
   end
   # Toggle HUD Window
   if Kboard.keyboard($R_Key_P)
     @player_hud.visible = @player_hud.visible ? false : true
   end
   # Toggle Ally Window
   if Kboard.keyboard(0xDB)
     @allies_hud.visible = @allies_hud.visible ? false : true
   end
   # Toggle Help Window
   if Kboard.keyboard(0xDD)
     @help_window.visible = @help_window.visible ? false : true
   end
   # Toggles Hot Keys
   if Input.press?(Input::X)
     @hot_keys_window.visible = true
   else
     @hot_keys_window.visible = false
   end
   # Toggles ABS Controls Window
   if Input.press?(Input::L)
     @abs_controls_window.visible = true
   else
     @abs_controls_window.visible = false
   end
   # Toggles KH Controls Window
   if Input.press?(Input::R)
     @kh_controls_window.visible = true
   else
     @kh_controls_window.visible = false
   end
   #   F    ● Melee Attack
   if Kboard.keyboard($R_Key_F)
     $ABS.player_attack
   end
   #   G   ● Range Attack
   if Kboard.keyboard($R_Key_G)
     $ABS.player_ranged
   end
   #   H   ● Skill Key 1
   if Kboard.keyboard($R_Key_H)
     $ABS.player_skill(1)
   end
   #   J    ● Skill Key 2
   if Kboard.keyboard($R_Key_J)
     $ABS.player_skill(2)
   end
   #   K    ● Skill Key 3
   if Kboard.keyboard($R_Key_K)
     $ABS.player_skill(3)
   end
   #   L    ● Skill Key 4
   if Kboard.keyboard($R_Key_L)
     $ABS.player_skill(4)
   end
   #   E   ● Change Lead Forward
   if Kboard.keyboard($R_Key_E)
     $game_party.shift_forward
   end
   #   R   ● Change Lead Backwards
   if Kboard.keyboard($R_Key_R)
     $game_party.shift_backward
   end
   #   T   ● Waits Leader
   if Kboard.keyboard($R_Key_T)
     $game_player.wait_command = true
     $game_party.shift_forward
   end
   #   Y   ● Waits Allies
   if Kboard.keyboard($R_Key_Y)
     for ally in $game_allies.values
       if ally.map_id == $game_map.map_id
         ally.wait_command = true
       end
     end
   end
   #   U   ● Gathers Allies
   if Kboard.keyboard($R_Key_U)
     $ABS.player_engaged = false
     for ally in $game_allies.values
       if ally.map_id == $game_map.map_id
         ally.wait_command = false
         ally.under_attack = false
         ally.refresh
       end
     end
   end
   #   N    ● Wide Follow
   if Kboard.keyboard($R_Key_N)
     $ABS.close_follow = true
   end
   #   M    ● Close Follow
   if Kboard.keyboard($R_Key_M)
     $ABS.close_follow = false
   end
   for key in $game_allies.keys
     $game_allies[key].update
   end
   $ABS.update
   if $ABS.transer_player == true
     transfer
   end
   abs_scene_map_update
 end
 #--------------------------------------------------------------------------
 def transfer
   $ABS.transer_player = false
   $game_map.update
   @spriteset.dispose
   @spriteset = Spriteset_Map.new
   if $game_temp.transition_processing
     $game_temp.transition_processing = false
     Graphics.transition(20)
   end
   $game_map.autoplay
   Graphics.frame_reset
   Input.update
 end
 #--------------------------------------------------------------------------
 def transfer_player
   for ally in $game_allies.values
     if ally.wait_command == false and ally.dead == false
       ally.moveto($game_temp.player_new_x, $game_temp.player_new_y)
       ally.map_id = $game_temp.player_new_map_id
     end
   end
   $game_player.map_id = $game_temp.player_new_map_id
   abs_scene_map_transfer_player
 end
end


That is all for the scripts now.

jens009 had better get over here to finish off what needs to happen for the monsters!


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
omegapirate2000
post Jun 13 2006, 07:35 PM
Post #5


Now with 10% more awesome
Group Icon

Group: Member
Posts: 1,408
Type: Event Designer
RM Skill: Advanced




Whoa this is a massive script... mind telling us how to use it?


__________________________

Go to the top of the page
 
+Quote Post
   
Rast
post Jun 13 2006, 07:49 PM
Post #6


Level 71
Group Icon

Group: +Gold Member
Posts: 3,286
Type: Musician
RM Skill: Advanced
Rev Points: 10




Theres instuctions(that I haven't tested) in the beggining of script#4


__________________________
Go to the top of the page
 
+Quote Post
   
123q
post Jun 13 2006, 07:53 PM
Post #7


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




You're right, Rast, there are instructions.

I got a good idea on how to set it all up. Here it goes:

QUOTE
Now that you got all those

Make a normal event that could be triggered by action button

Make an appropiate graphic

and do the following:

Insert a comment command found in the first tab of the event command list

In the comment put in ABS Event Command List
Example
QUOTE

Comment:ABS Event Command List

Now under that make another comment command
this time place Name*then the monsters name*
So say my monsters name in the database is Ghost
so i place in
QUOTE
Comment:Name Ghost

Now make another comment command this time:
name it behavior
QUOTE
Comment: Behavior 1

Another one is for the sound
QUOTE
Comment: Sound 2

The next one is the sight of the monster
QUOTE
Comment: Sight 5

The next one is how the monster is aggressive
QUOTE
Comment:Aggressiveness 1

Another one for speed of the monster
QUOTE
Commnet:Speed 4

Damn this is too long, the next one is frequency or how much the event could move or something like that
QUOTE
Comment:Frequency 5

This next one is the trigger (like a switch) set this to 0 unless you want to do something special
QUOTE
Comment: Trigger 0


Now it all should look like this
user posted image

Well then for more info about how to setup the monster look in to the SBABS 1 or the first script, scroll down a bit and you would find about it


Hope this works (had to copy all the quote thing from jens009's fourth post in my help topic. I don't cuss at all just to let you know)!


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
Rast
post Jun 13 2006, 08:06 PM
Post #8


Level 71
Group Icon

Group: +Gold Member
Posts: 3,286
Type: Musician
RM Skill: Advanced
Rev Points: 10




QUOTE
Insert Above Main, and Below Nears ABS.


Where do I find this script? I can't find it.

Also, I was trying to test the ABS system, but I kept getting the error message, " File graphics/characters/faces/backround not found". this would happen whenever I selected "New Game" or "Load Game" from the title screen.


__________________________
Go to the top of the page
 
+Quote Post
   
Quinn
post Jun 14 2006, 01:16 AM
Post #9


A dude who loves to play with the Bustersword!
Group Icon

Group: Member
Posts: 298
Type: Artist
RM Skill: Skilled




I know how to solve this, just make a face directory in your characters directory and put a few face graphics in there with the same names of your character sets.

I can post a link to download the demo if you guys want. That would make it a lot easier!


__________________________




You might think I am crazy, you might think I'm insane, but you can't say I'm stupid, that would be a shame.....
Go to the top of the page
 
+Quote Post
   
123q
post Jun 14 2006, 06:53 AM
Post #10


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




Yeah, Quinn, good idea.

Get the link and get all the people happy.


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
Rast
post Jun 14 2006, 09:09 AM
Post #11


Level 71
Group Icon

Group: +Gold Member
Posts: 3,286
Type: Musician
RM Skill: Advanced
Rev Points: 10




Yes, a link would be good.


__________________________
Go to the top of the page
 
+Quote Post
   
jens009
post Jun 14 2006, 08:49 PM
Post #12


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Lol I acctually submitted this you know....

And the instructions were by me also

Oh well have fun with Near' Fantastica's script

Hmm I dont see why you get errors like that...

Put them in order to make it work from choco's first posted script to the last

EDITED:
Okay I was looking at it very carefully and found the problem

The fourth script was unnecessary*Spell Check*

It was a different version of SBABS... The first 3 scripts is the only thing required to make it work

As for the 4th script which is Kingdom Heart's ABS by Sephirot, is a different version


This post has been edited by jens009: Jun 14 2006, 08:59 PM


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Rast
post Jun 14 2006, 09:19 PM
Post #13


Level 71
Group Icon

Group: +Gold Member
Posts: 3,286
Type: Musician
RM Skill: Advanced
Rev Points: 10




Okay, it isn't showng any errors now that the fourth script is deleted. Next question: How do you activate the ABS system? How does it work?


__________________________
Go to the top of the page
 
+Quote Post
   
Quinn
post Jun 15 2006, 09:22 AM
Post #14


A dude who loves to play with the Bustersword!
Group Icon

Group: Member
Posts: 298
Type: Artist
RM Skill: Skilled




Not usre if you guys still need the fucking link, but here it is: KH ABS

This is insane! This the 1000000st time that I post a link for this on a site.

Lol, have fun with the script dudes!


__________________________




You might think I am crazy, you might think I'm insane, but you can't say I'm stupid, that would be a shame.....
Go to the top of the page
 
+Quote Post
   
jens009
post Jun 15 2006, 11:02 AM
Post #15


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




QUOTE (Rast @ Jun 14 2006, 09:19 PM)
Okay, it isn't showng any errors now that the fourth script is deleted. Next question: How do you activate the ABS system? How does it work?
*


Press F to Attack and if you want to use skills

Go to the skill menu and pick a skill then click either "H" "J" K" or "L"

To make select a hot key for the skill

As for the monsters follow the instructions above

@Quinn: Well the Kingdom hearts ABS of Sephirot Spawn.. is a different version


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Soku
post Jun 16 2006, 12:24 AM
Post #16


Level 7
Group Icon

Group: Member
Posts: 99
Type: Developer
RM Skill: Skilled




you are MY GOD!!!! holy shat!? a KH battle sys? lol sweeet :Thumbsup1:


__________________________
A far off memory, like a scattered dream...
A scattered dream, like a far off memory...
Go to the top of the page
 
+Quote Post
   
Quinn
post Jun 16 2006, 03:18 AM
Post #17


A dude who loves to play with the Bustersword!
Group Icon

Group: Member
Posts: 298
Type: Artist
RM Skill: Skilled




Yeah, the KH ABS is awsome! That's why I have to post million links for a lot of people! lol


__________________________




You might think I am crazy, you might think I'm insane, but you can't say I'm stupid, that would be a shame.....
Go to the top of the page
 
+Quote Post
   
123q
post Jun 16 2006, 08:02 AM
Post #18


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




Thank's for the backup, guys, I really needed it.

I feel that the fourth script is needed, though, but no big deal. It's just a matter of opinion.


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   
contatine
post Jul 14 2006, 07:39 AM
Post #19


Level 2
Group Icon

Group: Member
Posts: 28
Type: None
RM Skill: Undisclosed




can anyone upload the demo again pls...i was not around when this was post...when i press on the old demo posted...there was a error in the database...
Go to the top of the page
 
+Quote Post
   
123q
post Jul 19 2006, 08:48 AM
Post #20


Level 8
Group Icon

Group: Banned
Posts: 115
Type: None
RM Skill: Beginner




I think the link is still good (Most likely the site was down earlier but it's back up).

Give it a try. I'm sure you'll use the scripts.


__________________________
Duplicate account
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 03:28 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker