몬스터 리젠 하는법하고
몬스터 사용법좀
가르쳐주시면감사하겠습니다 ㅜㅜ
abs 스크립트인데 가르쳐주세요 ㅜ
-----------------
1째 스크립트
#======================================
# ■ Squad Based Action Battle System
#======================================
# By: Near Fantastica
# Date: 8.06.05
# Version: 3.2
# 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
#======================================
#
# 행동
# 공격 때 # 수동적 = 0 ● 이벤트 (적)은 오직 공격
# 의 감지 수준 중 하나이 true로 설정되면 # 적극적인 = 1 ● 이벤트 공격
# 또 다른 이벤트의 감지 수준으로 공격 때 ● 이벤트에만 공격 = 2에 연결
# 공격 또는 연결 중 하나에 해당하면 # = 3을 연결하는 적극 ● 이벤트 공격
# ------------------------------------------------- --------------------------
# 감지
# 소리 ● 범위 적이들을 수 = 범위를 울려라 비활성 경우 0으로 설정
# 시력이 = 범위 ● sightthe 적의 범위는 비활성 볼 수있는 경우 0으로 설정
# ------------------------------------------------- --------------------------
# 공격성
# 공격성 ??= 레벨 ● 높으면 덜 적극적인 이벤트
# ------------------------------------------------- --------------------------
# 운동
# 속도 = 레벨 이벤트 ● movment 속도를 만났을 때
# 주파수 = 레벨 이벤트 ● movment 주파수를 만났을 때
# ------------------------------------------------- --------------------------
# Switch_id
# Switch_id = 아이디 ● 이벤트가 비활성 살해 사실이되고 스위치가있는 경우 0으로 설정
#
#======================================
# ■ 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 set_ally_ai(tirgger)
@ally_ai_active = tirgger
return
end
#--------------------------------------------------------------------------
def setup
@enemies = {}
for event in $game_map.events.values
for i in 0...event.list.size
if event.list[i].code == 108 and event.list[i].parameters == ["ABS Event Command List"]
name = event.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 = event.list[i+2].parameters[0].split
@enemies[event.id].behavior = behavior[1].to_i
sound = event.list[i+3].parameters[0].split
@enemies[event.id].detection[0] = sound[1].to_i
sight = event.list[i+4].parameters[0].split
@enemies[event.id].detection[1] = sight[1].to_i
aggressiveness = event.list[i+5].parameters[0].split
@enemies[event.id].aggressiveness = aggressiveness[1].to_i
speed = event.list[i+6].parameters[0].split
@enemies[event.id].speed = speed[1].to_i
frequency = event.list[i+7].parameters[0].split
@enemies[event.id].frequency = frequency[1].to_i
switch_id = event.list[i+8].parameters[0].split
@enemies[event.id].switch_id = switch_id[1].to_i
end
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)
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
event = $game_map.events[enemy.event_id]
event.erase
treasure(enemy)
id = enemy.event_id
@enemies.delete(id)
if enemy.switch_id != 0
$game_switches[enemy.switch_id] = 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
lowest_actor = actor
end
end
return false if lowest_actor.hp == lowest_actor.maxhp
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
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
2째스크립트
#======================================
# ■ Game ABS Enemy
#======================================
class Game_ABS_Enemy < Game_Battler
#--------------------------------------------------------------------------
attr_accessor :event_id
attr_accessor :behavior
attr_accessor :detection
attr_accessor :aggressiveness
attr_accessor :switch_id
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
@switch_id = 0
@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
event.erase
$ABS.treasure(event_actor)
id = event_actor.event_id
$ABS.enemies.delete(id)
if event_actor.switch_id != 0
$game_switches[event_actor.switch_id] = 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
3째 스크립트
#=====================================
# ■ Game Map
#=====================================
class Game_Map
#--------------------------------------------------------------------------
alias abs_game_map_setup setup
#--------------------------------------------------------------------------
def setup(map_id)
abs_game_map_setup(map_id)
$ABS.setup
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
#--------------------------------------------------------------------------
def name
return @event.name
end
#--------------------------------------------------------------------------
def id
return @id
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
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]
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 Map
#======================================
class Scene_Map
#--------------------------------------------------------------------------
alias abs_scene_map_update update
alias abs_scene_map_transfer_player transfer_player
#--------------------------------------------------------------------------
attr_accessor :spriteset
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@hud = Window_HUD.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@hud.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
def update
if Kboard.keyboard($R_Key_E)
$game_party.shift_forward
end
if Kboard.keyboard($R_Key_R)
$game_party.shift_backward
end
if Kboard.keyboard($R_Key_T)
$game_player.wait_command = true
$game_party.shift_forward
end
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
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
if $ABS.hud_pc == true
if Kboard.keyboard($R_Key_P)
if @hud.visible == true
@hud.visible = false
else
@hud.visible = true
end
end
else
@hud.visible = $ABS.hud
end
if Kboard.keyboard($R_Key_F)
$ABS.player_attack
end
if Kboard.keyboard($R_Key_G)
$ABS.player_ranged
end
if Kboard.keyboard($R_Key_H)
$ABS.player_skill(1)
end
if Kboard.keyboard($R_Key_J)
$ABS.player_skill(2)
end
if Kboard.keyboard($R_Key_K)
$ABS.player_skill(3)
end
if Kboard.keyboard($R_Key_L)
$ABS.player_skill(4)
end
if Kboard.keyboard($R_Key_N)
$ABS.close_follow = true
end
if Kboard.keyboard($R_Key_M)
$ABS.close_follow = false
end
for key in $game_allies.keys
$game_allies[key].update
end
$ABS.update
@hud.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
#======================================
# ■ 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)
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
이렇게 구성되어있는데요 사용법좀요
그리고 텍스트어떻게첨부해요 사진만첨부가능하던데