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 6202
1021 메시지 Taylor's Simple Message System 2000 Alkaid 2020.07.05 247
1020 제작도구 [XP/VX/VXA] Doodad's Editor by newold Alkaid 2020.07.12 388
1019 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1018 전투 전투중에 장비들 교체하기 file 레이스89 2017.08.19 600
1017 기타 [All RGSS] FileTest (Unicode) file Cheapmunk 2014.12.29 614
1016 맵/타일 맵연결 스크립트 (데모첨부) file 게임애호가 2018.06.15 694
1015 기타 에어리어 설정 by RPG Advocate 백호 2009.02.22 710
1014 기타 Boat Script 백호 2009.02.21 729
1013 기타 Localization by ForeverZer0, KK20 습작 2013.04.26 738
1012 기타 Materia System file 백호 2009.02.21 749
1011 기타 Real-Time Day Night 3 백호 2009.02.22 751
1010 스킬 SG_Escape Only Skills by sandgolem (SDK호환) 백호 2009.02.22 753
1009 기타 killer님 요청하신 스크립트 두번째입니다. 나뚜루 2009.02.21 759
1008 기타 Letter by Letter Message Window by slipknot@rmxp.org (SDK호환) 1 file 백호 2009.02.22 760
1007 기타 Advanced Gold display by Dubealex 1 백호 2009.02.22 761
1006 스킬 Skill Requirements by SephirothSpawn (SDK호환) file 백호 2009.02.22 763
1005 기타 Sphere Grid System file 백호 2009.02.21 765
1004 기타 AMS-Advanced Message Script Edited by Dubleax 3 file 백호 2009.02.21 766
1003 스킬 SG_Skill Break by sandgolem (SDK호환) 백호 2009.02.22 772
1002 기타 Activation_system file 백호 2009.02.22 775
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52