밑에 질문했었는데....
이벤트로 할려는건 포기. ^^;; 어떻게 하는지 잘 모르겠어요 =_=;;
XP강좌 란에 보면 gunmong님께서
올리신 스크립트 있잖아요. 레벨업할때마다 스텟 조절할수있는.......
그거 세이브 하고 난뒤에 다시 로드해서 게임해보면
제가 올린 능력치가 아닌, 원래 설정치대로 능력치가 되어있는 버그가 있는데
그거 버그 수정 할수 없나요?
그 스크립트가 상당히 맘에 들어서 그러는데, 어떻게 해야 그 버그가 없어지는지
제발 알려주세요 ㅠㅠ
스크립트는 이겁니다.
#==============================================================================
# ■ Window_Levelup
#------------------------------------------------------------------------------
# 커스터마이즈 programed by gunmong
#==============================================================================
class Window_Levelup < Window_Base
LEVELUP_POINT = 10 # 레벨업시 얻는 포인트
HP_PER_POINT = 10 # 보너스 1포인트당 증감되는 HP, SP 포인트
SKILLUP_POINT = 1
ACCEPT = 6 # 결정의 index
attr_accessor :actor
attr_accessor :present_level
attr_accessor :index
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize(actor, last_level)
# 윈도우 창 초기화
super(220, 10,200, 300)
self.contents = Bitmap.new(width - 32, height - 32)
# 액터 스테이터스 초기화
@actor = actor
@name = $data_actors[actor.id].name
@present_level = actor.level
@last_level = last_level
@status = []
@text_status = []
@temp_status = []
@bonus_point = (@present_level - last_level) * LEVELUP_POINT
for i in 0...6
@status[i] = $data_actors[actor.id].parameters[i, last_level]
@temp_status[i] = $data_actors[actor.id].parameters[i, last_level]
end
# 액터 그림 로드
@battler_pic = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
# 인덱스 초기화
@index = 0
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 리프레쉬
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@text_down = "◀"
@text_up = "▶"
@text_status[0] = $data_system.words.hp
@text_status[1] = $data_system.words.sp
@text_status[2] = $data_system.words.str
@text_status[3] = $data_system.words.dex
@text_status[4] = $data_system.words.agi
@text_status[5] = $data_system.words.int
@text_bonus_point = "B.point " + @bonus_point.to_s
self.contents.blt(50, 50, @battler_pic, Rect.new(0, 0, @battler_pic.width, @battler_pic.height),150)
self.contents.draw_text(0,0, 168 , 32, @name.to_s, 1)
self.contents.draw_text(0, 25, 45, 18, "Lv. ".to_s + @present_level.to_s)
for i in 0...@status.size
self.contents.draw_text(0, 50 + i * 30, self.contents.text_size(@text_status[i]).width, 32, @text_status[i].to_s)
self.contents.draw_text(50, 50 + i * 30, self.contents.text_size(@text_down).width, 32, @text_down)
self.contents.draw_text(70, 50 + i * 30, 80, 32, @temp_status[i].to_s, 1)
self.contents.draw_text(150, 50 + i * 30, self.contents.text_size(@text_up).width, 32, @text_up)
end
self.contents.draw_text(0, 240, 110, 32, @text_bonus_point )
self.contents.draw_text(130, 240, 40, 32, "결정" )
end
#--------------------------------------------------------------------------
# ● 커서의 구형 갱신
#--------------------------------------------------------------------------
def update_cursor_rect
# 커서 위치가 [결정] 의 경우
if @index == ACCEPT
self.cursor_rect.set(130, 240, 40, 32)
# 커서 위치가 [결정] 이외의 경우
else
x = 50
y = 50 + @index * 30
self.cursor_rect.set(x, y, 120, 32)
end
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
super
# 항목 선택
if Input.trigger?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index -=1 if @index > 0
end
if Input.trigger?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index +=1 if @index < ACCEPT
end
# 수치 증감
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
#커서가 [결정]이거나 기존 스테이터스보다 크지 않으면 수행하지 않음.
if @index != ACCEPT and @temp_status[@index] > @status[@index]
# HP 또는 SP는 HP_PER_POINT를 곱한다.
@temp_status[@index] -= 1 * HP_PER_POINT if @index < 2
@temp_status[@index] -= 1 if @index >= 2 and @index != ACCEPT
@bonus_point += 1
refresh
end
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
#커서가 [결정]이거나 기존 보너스 포인트가 1이상이 아니면 수행하지 않음.
if @index != ACCEPT and @bonus_point > 0
# HP 또는 SP는 HP_PER_POINT를 곱한다.
@temp_status[@index] += 1 * HP_PER_POINT if @index < 2
@temp_status[@index] += 1 if @index >=2 and @index != ACCEPT
@bonus_point -= 1
refresh
end
end
update_cursor_rect
end
def status(i)
return @temp_status[i]
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 메인 처리
#--------------------------------------------------------------------------
alias gunmong_main main
def main
#레벨업 데이터 초기화
@actor_level_list = []
@actor_last_level = []
gunmong_main
end
#==============================================================================
# ■ Scene_Battle (분할 정의 2)
#------------------------------------------------------------------------------
# 배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
#--------------------------------------------------------------------------
# ● 애프터 배틀 국면 개시
#--------------------------------------------------------------------------
def start_phase5
# 국면 5 에 이행
@phase = 5
# 배틀 종료 ME 를 연주
$game_system.me_play($game_system.battle_end_me)
# 배틀 개시전의 BGM 에 되돌린다
$game_system.bgm_play($game_temp.map_bgm)
# EXP, 골드, 트레이닝 전기밥통을 초기화
exp = 0
gold = 0
treasures = []
# 루프
for enemy in $game_troop.enemies
# 에너미가 숨어 상태가 아닌 경우
unless enemy.hidden
# 획득 EXP, 골드를 추가
exp += enemy.exp
gold += enemy.gold
# 트레이닝 전기밥통 출현 판정
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# 트레이닝 전기밥통의 수를 6 개까지 한정
treasures = treasures[0..5]
# EXP 획득
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
#sssssssssssssssssssssssssssssssssssssssssssssssssss
@actor_level_list.push(actor)
@actor_last_level.push(last_level)
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
@status_window.level_up(i)
end
end
end
# 골드 획득
$game_party.gain_gold(gold)
# 트레이닝 전기밥통 획득
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 배틀 결과 윈도우를 작성
@result_window = Window_BattleResult.new(exp, gold, treasures)
# 웨이트 카운트를 설정
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 (애프터 배틀 국면)
#--------------------------------------------------------------------------
def update_phase5
# 웨이트 카운트가 0 보다 큰 경우
if @phase5_wait_count > 0
# 웨이트 카운트를 줄인다
@phase5_wait_count -= 1
# 웨이트 카운트가 0 이 되었을 경우
if @phase5_wait_count == 0
# 결과 윈도우를 표시
@result_window.visible = true
# 메인 국면 플래그를 클리어
$game_temp.battle_main_phase = false
# 스테이터스 윈도우를 리프레쉬
@status_window.refresh
end
return
end
# C 버튼이 밀렸을 경우
if Input.trigger?(Input::C)
# 배틀 종료
battle_end(0)
end
end
#--------------------------------------------------------------------------
# ● 배틀 종료
# result : 결과 (0:승리 1:패배 2:도주)
#--------------------------------------------------------------------------
def battle_end(result)
# 전투중 플래그를 클리어
$game_temp.in_battle = false
# 파티 전원의 액션을 클리어
$game_party.clear_actions
# 배틀용 스테이트를 해제
for actor in $game_party.actors
actor.remove_states_battle
end
# 에너미를 클리어
$game_troop.enemies.clear
# 배틀 콜백을 부른다
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
#ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
# 레벨업 액터가 있을경우
if not @actor_level_list.empty?
$scene = Scene_Levelup.new(@actor_level_list, @actor_last_level)
return
end
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
# 맵 화면으로 전환하고
$scene = Scene_Map.new
end
end
#==============================================================================
# ■ Scene_Levelup
#------------------------------------------------------------------------------
# 레벨업시 스탯포인터를 조절하는 화면을 처리하는 클래스입니다.
#==============================================================================
class Scene_Levelup
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
# menu_index : 커멘드의 커서 초기 위치
#--------------------------------------------------------------------------
def initialize(actor_level_list, actor_last_level)
@actor_level_list = actor_level_list
@actor_last_level = actor_last_level
end
#--------------------------------------------------------------------------
# ● 메인 처리
#--------------------------------------------------------------------------
def main
# 스프라이트 세트를 작성
@spriteset = Spriteset_Battle.new
@status_window = Window_BattleStatus.new
# 초기 윈도우를 작성
@edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)
# 트란지션 실행
Graphics.transition
# 메인 루프
loop do
# 게임 화면을 갱신
Graphics.update
# 입력 정보를 갱신
Input.update
# 프레임 갱신
update
# 화면이 바뀌면 루프를 중단
if $scene != self
break
end
end
# 트란지션 준비
Graphics.freeze
# 윈도우를 해방
@spriteset.dispose
@status_window.dispose
@edit_window.dispose
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 윈도우를 갱신
@spriteset.update
@edit_window.update
# C 버튼이 밀렸을 경우
if Input.repeat?(Input::C) and @edit_window.index == 6
for i in 0...6
$data_actors[@edit_window.actor.id].parameters[i, @edit_window.present_level] = @edit_window.status(i)
end
if @actor_level_list.empty?
$scene = Scene_Map.new
else
@edit_window.dispose
@edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)
end
end
end
end
이벤트로 할려는건 포기. ^^;; 어떻게 하는지 잘 모르겠어요 =_=;;
XP강좌 란에 보면 gunmong님께서
올리신 스크립트 있잖아요. 레벨업할때마다 스텟 조절할수있는.......
그거 세이브 하고 난뒤에 다시 로드해서 게임해보면
제가 올린 능력치가 아닌, 원래 설정치대로 능력치가 되어있는 버그가 있는데
그거 버그 수정 할수 없나요?
그 스크립트가 상당히 맘에 들어서 그러는데, 어떻게 해야 그 버그가 없어지는지
제발 알려주세요 ㅠㅠ
스크립트는 이겁니다.
#==============================================================================
# ■ Window_Levelup
#------------------------------------------------------------------------------
# 커스터마이즈 programed by gunmong
#==============================================================================
class Window_Levelup < Window_Base
LEVELUP_POINT = 10 # 레벨업시 얻는 포인트
HP_PER_POINT = 10 # 보너스 1포인트당 증감되는 HP, SP 포인트
SKILLUP_POINT = 1
ACCEPT = 6 # 결정의 index
attr_accessor :actor
attr_accessor :present_level
attr_accessor :index
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize(actor, last_level)
# 윈도우 창 초기화
super(220, 10,200, 300)
self.contents = Bitmap.new(width - 32, height - 32)
# 액터 스테이터스 초기화
@actor = actor
@name = $data_actors[actor.id].name
@present_level = actor.level
@last_level = last_level
@status = []
@text_status = []
@temp_status = []
@bonus_point = (@present_level - last_level) * LEVELUP_POINT
for i in 0...6
@status[i] = $data_actors[actor.id].parameters[i, last_level]
@temp_status[i] = $data_actors[actor.id].parameters[i, last_level]
end
# 액터 그림 로드
@battler_pic = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
# 인덱스 초기화
@index = 0
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 리프레쉬
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@text_down = "◀"
@text_up = "▶"
@text_status[0] = $data_system.words.hp
@text_status[1] = $data_system.words.sp
@text_status[2] = $data_system.words.str
@text_status[3] = $data_system.words.dex
@text_status[4] = $data_system.words.agi
@text_status[5] = $data_system.words.int
@text_bonus_point = "B.point " + @bonus_point.to_s
self.contents.blt(50, 50, @battler_pic, Rect.new(0, 0, @battler_pic.width, @battler_pic.height),150)
self.contents.draw_text(0,0, 168 , 32, @name.to_s, 1)
self.contents.draw_text(0, 25, 45, 18, "Lv. ".to_s + @present_level.to_s)
for i in 0...@status.size
self.contents.draw_text(0, 50 + i * 30, self.contents.text_size(@text_status[i]).width, 32, @text_status[i].to_s)
self.contents.draw_text(50, 50 + i * 30, self.contents.text_size(@text_down).width, 32, @text_down)
self.contents.draw_text(70, 50 + i * 30, 80, 32, @temp_status[i].to_s, 1)
self.contents.draw_text(150, 50 + i * 30, self.contents.text_size(@text_up).width, 32, @text_up)
end
self.contents.draw_text(0, 240, 110, 32, @text_bonus_point )
self.contents.draw_text(130, 240, 40, 32, "결정" )
end
#--------------------------------------------------------------------------
# ● 커서의 구형 갱신
#--------------------------------------------------------------------------
def update_cursor_rect
# 커서 위치가 [결정] 의 경우
if @index == ACCEPT
self.cursor_rect.set(130, 240, 40, 32)
# 커서 위치가 [결정] 이외의 경우
else
x = 50
y = 50 + @index * 30
self.cursor_rect.set(x, y, 120, 32)
end
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
super
# 항목 선택
if Input.trigger?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index -=1 if @index > 0
end
if Input.trigger?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index +=1 if @index < ACCEPT
end
# 수치 증감
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
#커서가 [결정]이거나 기존 스테이터스보다 크지 않으면 수행하지 않음.
if @index != ACCEPT and @temp_status[@index] > @status[@index]
# HP 또는 SP는 HP_PER_POINT를 곱한다.
@temp_status[@index] -= 1 * HP_PER_POINT if @index < 2
@temp_status[@index] -= 1 if @index >= 2 and @index != ACCEPT
@bonus_point += 1
refresh
end
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
#커서가 [결정]이거나 기존 보너스 포인트가 1이상이 아니면 수행하지 않음.
if @index != ACCEPT and @bonus_point > 0
# HP 또는 SP는 HP_PER_POINT를 곱한다.
@temp_status[@index] += 1 * HP_PER_POINT if @index < 2
@temp_status[@index] += 1 if @index >=2 and @index != ACCEPT
@bonus_point -= 1
refresh
end
end
update_cursor_rect
end
def status(i)
return @temp_status[i]
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 메인 처리
#--------------------------------------------------------------------------
alias gunmong_main main
def main
#레벨업 데이터 초기화
@actor_level_list = []
@actor_last_level = []
gunmong_main
end
#==============================================================================
# ■ Scene_Battle (분할 정의 2)
#------------------------------------------------------------------------------
# 배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
#--------------------------------------------------------------------------
# ● 애프터 배틀 국면 개시
#--------------------------------------------------------------------------
def start_phase5
# 국면 5 에 이행
@phase = 5
# 배틀 종료 ME 를 연주
$game_system.me_play($game_system.battle_end_me)
# 배틀 개시전의 BGM 에 되돌린다
$game_system.bgm_play($game_temp.map_bgm)
# EXP, 골드, 트레이닝 전기밥통을 초기화
exp = 0
gold = 0
treasures = []
# 루프
for enemy in $game_troop.enemies
# 에너미가 숨어 상태가 아닌 경우
unless enemy.hidden
# 획득 EXP, 골드를 추가
exp += enemy.exp
gold += enemy.gold
# 트레이닝 전기밥통 출현 판정
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# 트레이닝 전기밥통의 수를 6 개까지 한정
treasures = treasures[0..5]
# EXP 획득
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
#sssssssssssssssssssssssssssssssssssssssssssssssssss
@actor_level_list.push(actor)
@actor_last_level.push(last_level)
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
@status_window.level_up(i)
end
end
end
# 골드 획득
$game_party.gain_gold(gold)
# 트레이닝 전기밥통 획득
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 배틀 결과 윈도우를 작성
@result_window = Window_BattleResult.new(exp, gold, treasures)
# 웨이트 카운트를 설정
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 (애프터 배틀 국면)
#--------------------------------------------------------------------------
def update_phase5
# 웨이트 카운트가 0 보다 큰 경우
if @phase5_wait_count > 0
# 웨이트 카운트를 줄인다
@phase5_wait_count -= 1
# 웨이트 카운트가 0 이 되었을 경우
if @phase5_wait_count == 0
# 결과 윈도우를 표시
@result_window.visible = true
# 메인 국면 플래그를 클리어
$game_temp.battle_main_phase = false
# 스테이터스 윈도우를 리프레쉬
@status_window.refresh
end
return
end
# C 버튼이 밀렸을 경우
if Input.trigger?(Input::C)
# 배틀 종료
battle_end(0)
end
end
#--------------------------------------------------------------------------
# ● 배틀 종료
# result : 결과 (0:승리 1:패배 2:도주)
#--------------------------------------------------------------------------
def battle_end(result)
# 전투중 플래그를 클리어
$game_temp.in_battle = false
# 파티 전원의 액션을 클리어
$game_party.clear_actions
# 배틀용 스테이트를 해제
for actor in $game_party.actors
actor.remove_states_battle
end
# 에너미를 클리어
$game_troop.enemies.clear
# 배틀 콜백을 부른다
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
#ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
# 레벨업 액터가 있을경우
if not @actor_level_list.empty?
$scene = Scene_Levelup.new(@actor_level_list, @actor_last_level)
return
end
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
# 맵 화면으로 전환하고
$scene = Scene_Map.new
end
end
#==============================================================================
# ■ Scene_Levelup
#------------------------------------------------------------------------------
# 레벨업시 스탯포인터를 조절하는 화면을 처리하는 클래스입니다.
#==============================================================================
class Scene_Levelup
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
# menu_index : 커멘드의 커서 초기 위치
#--------------------------------------------------------------------------
def initialize(actor_level_list, actor_last_level)
@actor_level_list = actor_level_list
@actor_last_level = actor_last_level
end
#--------------------------------------------------------------------------
# ● 메인 처리
#--------------------------------------------------------------------------
def main
# 스프라이트 세트를 작성
@spriteset = Spriteset_Battle.new
@status_window = Window_BattleStatus.new
# 초기 윈도우를 작성
@edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)
# 트란지션 실행
Graphics.transition
# 메인 루프
loop do
# 게임 화면을 갱신
Graphics.update
# 입력 정보를 갱신
Input.update
# 프레임 갱신
update
# 화면이 바뀌면 루프를 중단
if $scene != self
break
end
end
# 트란지션 준비
Graphics.freeze
# 윈도우를 해방
@spriteset.dispose
@status_window.dispose
@edit_window.dispose
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 윈도우를 갱신
@spriteset.update
@edit_window.update
# C 버튼이 밀렸을 경우
if Input.repeat?(Input::C) and @edit_window.index == 6
for i in 0...6
$data_actors[@edit_window.actor.id].parameters[i, @edit_window.present_level] = @edit_window.status(i)
end
if @actor_level_list.empty?
$scene = Scene_Map.new
else
@edit_window.dispose
@edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)
end
end
end
end