Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Enemy defeated to Variable

Is it possible to change this code so it looks for a certain variable instead of ENEMY_DEFEATED, ENCOUNTER_COUNT etc? Unless theres a call script that u can add to them w/o having to use the standard combat system..

#_______________________________________________________________________________
# MOG Scene End Sakura V2.0
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Scene_End com movimento e layout em pictures.
# Apresenta a quantidade de batalhas, saves, loads, etc...
# Permite criar condições especiais de eventos.
#_______________________________________________________________________________
module MOG
#Transition Time.
ENDTT = 40
#Transition Type(Name).
ENDTN = "004-Blind04"
#----------------------------------------------------------------
#Definição do texto da apresentação dos parâmetros.
ECOUNTER_TEXT = "Number of Encounters."
SAVE_COUNT_TEXT = "Number of Saves."
LOAD_COUNT_TEXT = "Number of Loads."
ENEMY_DEFEATED_TEXT = "Enemy Kills."
ACTOR_DEFEATED_TEXT = "Player Deaths."
#----------------------------------------------------------------
# Definição da variável que registrará o valor dos parâmetros.
#(Essa função serve para criar condições especiais no jogo.
# Exemplo -> Mate 100 inimigos que você receberá a espada do
# dragão.)
#----------------------------------------------------------------
# Quantidade de batalhas feitas.
ENCOUNTER_COUNT = 26
# Valor de vezes que o jogo foi Salvo(Save).
SAVE_COUNT = 27
# Valor de vezes que o jogo foi carregado(Load).
LOAD_COUNT = 28
# Quantidade de inimigos mortos.
ENEMY_DEFEATED = 29
# Valor de vezes que o personagens foi abatido.
ACTOR_DEFEATED = 30
#----------------------------------------------------------------
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_sakura"] = true
###############
# Game_System #
###############
class Game_System
include MOG
attr_accessor :encounter_count
attr_accessor :enemy_defeated
attr_accessor :actor_defeated
attr_accessor :load_count
alias mog21_initialize initialize
def initialize
@encounter_count = 0
@enemy_defeated = 0
@actor_defeated = 0
@load_count = 0
mog21_initialize
end
def encounter_count
$game_variables[ENCOUNTER_COUNT] = @encounter_count
return @encounter_count
end
def enemy_defeated
$game_variables[ENEMY_DEFEATED] = @enemy_defeated
return @enemy_defeated
end
def actor_defeated
$game_variables[ACTOR_DEFEATED] = @enemy_defeated
return @actor_defeated
end
def load_count
$game_variables[LOAD_COUNT] = @load_count
return @load_count
end
def save_count
$game_variables[SAVE_COUNT] = @save_count
return @save_count
end
end
##############
# Scene_Load #
##############
class Scene_Load < Scene_File
alias mog21_read_save_data read_save_data
def read_save_data(file)
mog21_read_save_data(file)
$game_system.load_count += 1
end
end
##################
# Sprite_Battler #
##################
class Sprite_Battler < RPG::Sprite
def collapse
super
if @battler.is_a?(Game_Enemy)
$game_system.enemy_defeated += 1
else
$game_system.actor_defeated += 1
end
end
end
################
# Scene_Battle #
################
class Scene_Battle
alias mog21_main main
def main
$game_system.encounter_count += 1
mog21_main
end
end
###############
# Window Data #
###############
class Window_Data < Window_Base
include MOG
def initialize
super(0, 100, 640, 280)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.contents.font.name = "Georgia"
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 300, 64,ECOUNTER_TEXT + " -> " + $game_system.encounter_count.to_s,0)
self.contents.draw_text(70, 50, 300, 64,SAVE_COUNT_TEXT + " -> " + $game_system.save_count.to_s ,0)
self.contents.draw_text(140, 100, 300, 64,LOAD_COUNT_TEXT + " -> " + $game_system.load_count.to_s,0)
self.contents.draw_text(210, 150, 300, 64,ENEMY_DEFEATED_TEXT + " -> " + $game_system.enemy_defeated.to_s,0)
self.contents.draw_text(280, 200, 300, 64,ACTOR_DEFEATED_TEXT + " -> " + $game_system.actor_defeated.to_s,0)
end
end
#############
# Scene_End #
#############
class Scene_End
def main
s1 = ""
s2 = ""
s3 = ""
@command_window = Window_Command.new(100, [s1, s2, s3])
@command_window.visible = false
@window_data = Window_Data.new
@endback = Plane.new
@endback.bitmap = RPG::Cache.picture("MN_BK")
@endback.z = 10
@endback.opacity = 255
@endlayout = Plane.new
@endlayout.bitmap = RPG::Cache.picture("End_Layout")
@endlayout.z = 20
@endcom1 = Sprite.new
@endcom1.bitmap = RPG::Cache.picture("End_Com01")
@endcom1.z = 30
@endcom1.x = 20
@endcom1.y = 340
@endcom1.zoom_x = 1
@endcom2 = Sprite.new
@endcom2.bitmap = RPG::Cache.picture("End_Com02")
@endcom2.z = 30
@endcom2.x = 100
@endcom2.y = 395
@endcom3 = Sprite.new
@endcom3.bitmap = RPG::Cache.picture("End_Com03")
@endcom3.z = 30
@endcom3.x = 190
@endcom3.y = 440
$ld = 0
@zc = 1
Graphics.transition(MOG::ENDTT, "Graphics/Transitions/" + MOG::ENDTN)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@window_data.dispose
@endback.dispose
@endcom1.dispose
@endcom2.dispose
@endcom3.dispose
@endlayout.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@zc += 0.01
if @zc > 1.3
@zc = 1
end
@endback.ox += 1
@endback.oy += 1
@command_window.update
case @command_window.index
when 0
@endcom1.zoom_x = @zc
@endcom2.zoom_x = 1
@endcom3.zoom_x = 1
when 1
@endcom1.zoom_x = 1
@endcom2.zoom_x = @zc
@endcom3.zoom_x = 1
when 2
@endcom1.zoom_x = 1
@endcom2.zoom_x = 1
@endcom3.zoom_x = @zc
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_to_title
when 1
command_load
when 2
command_shutdown
end
return
end
end
def command_to_title
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
end
def command_load
$ld = 1
$scene = Scene_Load.new
end
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
end
##############
# Scene_Load #
##############
class Scene_Load
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $ld == 1
$scene = Scene_End.new
else
$scene = Scene_Title.new
end
end
end

EDIT: Never Mind I learned how to make a call script Add Encounter "$game_system.encounter_count +=1" Add Actor Defeated "$game_system.actor_defeated +=1" Add Enemy Defeted "$game_system.enemy_defeated +=1"
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top