XP 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆전투 관련 회수 취득 - KGC_BattleCount◆
#_/----------------------------------------------------------------------------
#_/ 전투 관련의 각종 회수를 취득하는 처리를 추가합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#$game_system.battle_count # 전투 회수
#$game_system.victory_count # 승리 회수
#$game_system.escape_count # 도주 회수
#가 됩니다.
#변수에 대입하는 경우:
#$game_variables[변수id] = $game_system.battle_count
#와 같이 쓰면 OK입니다.

#참고로 에너미(적군)의 격파수는
#$game_system.defeat_count(id)
#으로 취득합니다.
#여기서 id는 취득하는 에너미ID입니다.

#총 격파수를 취득하는 경우는
#$game_system.total_defeat_count
#을 사용합니다.


$imported = {} if $imported == nil
$imported["BattleCount"] = true

#======================================================================
# ■ Game_System
#======================================================================

class Game_System
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
alias initialize_KGC_BattleCount initialize
def initialize
# 원의 처리를 실행
initialize_KGC_BattleCount

@battle_count, @victory_count, @escape_count = 0, 0, 0
@defeat_count, @dead_count = [], []
end
#--------------------------------------------------------------------------
# ● 전투 회수 취득
#--------------------------------------------------------------------------
def battle_count
@battle_count = 0 if @battle_count == nil
return @battle_count
end
#--------------------------------------------------------------------------
# ● 전투 회수 조작
#--------------------------------------------------------------------------
def battle_count=(count)
@battle_count = 0 if @battle_count == nil
@battle_count = count
end
#--------------------------------------------------------------------------
# ● 승리 회수 취득
#--------------------------------------------------------------------------
def victory_count
@victory_count = 0 if @victory_count == nil
return @victory_count
end
#--------------------------------------------------------------------------
# ● 승리 회수 조작
#--------------------------------------------------------------------------
def victory_count=(count)
@victory_count = 0 if @victory_count == nil
@victory_count = count
end
#--------------------------------------------------------------------------
# ● 도주 회수 취득
#--------------------------------------------------------------------------
def escape_count
@escape_count = 0 if @escape_count == nil
return @escape_count
end
#--------------------------------------------------------------------------
# ● 도주 회수 조작
#--------------------------------------------------------------------------
def escape_count=(count)
@escape_count = 0 if @escape_count == nil
@escape_count = count
end
#--------------------------------------------------------------------------
# ● 격파수 취득
# id : 에너미ID
#--------------------------------------------------------------------------
def defeat_count(id)
@defeat_count = [] if @defeat_count == nil
@defeat_count[id] = 0 if @defeat_count[id] == nil
return @defeat_count[id]
end
#--------------------------------------------------------------------------
# ● 격파수 가산
# id : 에너미ID
# count : 가산량
#--------------------------------------------------------------------------
def add_defeat_count(id, count = 1)
@defeat_count = [] if @defeat_count == nil
@defeat_count[id] = 0 if @defeat_count[id] == nil
@defeat_count[id] += count
end
#--------------------------------------------------------------------------
# ● 총 격파수 취득
#--------------------------------------------------------------------------
def total_defeat_count
@defeat_count = [] if @defeat_count == nil
n = 0
for i in @defeat_count.compact
n += i
end
return n
end
#--------------------------------------------------------------------------
# ● 사망 회수 취득
# id : 엑터ID
#--------------------------------------------------------------------------
def dead_count(id)
@dead_count = [] if @dead_count == nil
@dead_count[id] = 0 if @dead_count[id] == nil
return @dead_count[id]
end
#--------------------------------------------------------------------------
# ● 사망 회수 가산
# id : 엑터ID
# count : 가산량
#--------------------------------------------------------------------------
def add_dead_count(id, count = 1)
@dead_count = [] if @dead_count == nil
@dead_count[id] = 0 if @dead_count[id] == nil
@dead_count[id] += count
end
#--------------------------------------------------------------------------
# ● 총 사망 회수 취득
#--------------------------------------------------------------------------
def total_dead_count
@dead_count = [] if @dead_count == nil
n = 0
for i in @dead_count.compact
n += i
end
return n
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#======================================================================
# ■ Sprite_Battler
#======================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 코라프스
#--------------------------------------------------------------------------
def collapse
super
$game_system.add_dead_count(@battler.id) if @battler.is_a?(Game_Actor)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#======================================================================
# ■ Scene_Battle (분할 정의 1)
#======================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● 메인 처리
#--------------------------------------------------------------------------
alias main_KGC_BattleCount main
def main
# 전투 회수 가산
$game_system.battle_count += 1

# 원의 처리를 실행
main_KGC_BattleCount
end
#--------------------------------------------------------------------------
# ● 배틀 종료
# result : 결과 (0:승리 1:도주 2:패배)
#--------------------------------------------------------------------------
alias battle_end_KGC_BattleCount battle_end
def battle_end(result)
unless @battle_count_added
# 결과에 의해 분기
case result
when 0 # 승리했을 경우
# 승리 회수 가산
$game_system.victory_count += 1
@a = true
when 1 # 도주했을 경우
# 도주 회수 가산
$game_system.escape_count += 1
end
# 격파 판정
for enemy in $game_troop.enemies.compact
# 숨어 있는(도주한), 생존하고 있는 경우는 무시
next if enemy.hidden || !enemy.dead?
# 격파수를 가산
$game_system.add_defeat_count(enemy.id)
end
# 다중 가산을 억제
@battle_count_added = true
end

# 원의 처리를 실행
battle_end_KGC_BattleCount(result)
end
end

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
701 전투 SG_Batte Retry ver.4 by sandgolem 2 백호 2009.02.22 1460
700 저장 SG_Broken Save File Fix by sandgolem (SDK호환) 1 백호 2009.02.22 1068
699 기타 SG_Call Script Fix by sandgolem (SDK호환) 백호 2009.02.22 804
698 아이템 SG_Escape Only Items by sandgolem (SDK호환) 백호 2009.02.22 850
697 스킬 SG_Escape Only Skills by sandgolem (SDK호환) 백호 2009.02.22 753
696 변수/스위치 SG_Gold Window Variables v2 by sandgolem (SDK호환) 백호 2009.02.22 899
695 아이템 SG_Hide free item cose by sandgolem (SDK호환) 백호 2009.02.22 935
694 메뉴 SG_Hide zero SP cost by sandgolem (SDK호환) 백호 2009.02.22 1066
693 아이템 SG_Item Break by sandgolem (SDK호환) 백호 2009.02.22 898
692 맵/타일 SG_Map Pause ver.1 by sandgolem 2 백호 2009.02.22 1290
691 기타 SG_Multiple Currencies v3 by sandgolem (SDK호환) 백호 2009.02.22 803
690 변수/스위치 SG_Self Variables by sandgolem 백호 2009.02.22 1275
689 기타 SG_Settings Control by sandgolem 백호 2009.02.22 884
688 스킬 SG_Skill Break by sandgolem (SDK호환) 백호 2009.02.22 772
687 스킬 SG_Skill Invoking Battle Items by sandgolem (SDK호환) 백호 2009.02.22 894
686 상태/속성 SG_State Immunity Message by sandgolem (SDK 호환) 백호 2009.02.22 1057
685 기타 SG_Transfer Player Music Fix v2 by sandgolem (SDK호환) 1 백호 2009.02.22 824
684 이동 및 탈것 SG_Wait for Move Completion Fix by sandgolem (SDK호환) 백호 2009.02.22 860
683 기타 SG_Window Control v2 by sandgolem 백호 2009.02.22 823
682 기타 Shift Puzzles by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 1390
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ... 52 Next
/ 52