Blizz ABS respawn disable (Resolved)

Started by Dweller, September 30, 2010, 03:24:20 pm

Previous topic - Next topic

Dweller

September 30, 2010, 03:24:20 pm Last Edit: October 17, 2010, 01:50:42 pm by Dweller
I´m working on my first script (using game_guy Kill Count BABS Add On script), a hunter rank script where you gain ranks of hunter when you kill a certain number of mobs. At the moment is working fine but I noticed that mobs don´t respawn anymore. If I remove my script, the mobs respawn again, so I´m doing something wrong that affect the blizz-abs respawn feature. I hope that a scripter could take a look at the script code because I can´t find the error.

#- Mob count by G_G
#- Modificado por Dwellercoc para añadir rangos de cazador segun mobs matados
#- Sonido cuando se sube de Rango de cazador
#- 17-09-2010
if BlizzABS::VERSION < 2.51
 raise "Blizz ABS Version isnt high enough. Now Closing."
end

#- Play a sound when you reach a new Hunter Rank
module Sound_Change
 Sound = "022-Dive02"
end


class BlizzABS::Processor
 
 KillCountVariable = 1
 
 alias exp_result_kill_count_later exp_result
 def exp_result(enemy)
   $game_variables[KillCountVariable] += 1
   
       case $game_variables[KillCountVariable]
       when 1
         $HunterRank = "n00b"
         Audio.se_play("Audio/SE/" + Sound_Change::Sound)
         $scene = Scene_ShowWindow.new
       when 2
         $HunterRank = "Hunter"
         Audio.se_play("Audio/SE/" + Sound_Change::Sound)
         $scene = Scene_ShowWindow.new
       when 3
         $HunterRank = "Assasin"
         Audio.se_play("Audio/SE/" + Sound_Change::Sound)
         $scene = Scene_ShowWindow.new
       when 4
         $HunterRank = "Triturador"
         Audio.se_play("Audio/SE/" + Sound_Change::Sound)
         $scene = Scene_ShowWindow.new
       when 5
         $HunterRank = "Master"
         Audio.se_play("Audio/SE/" + Sound_Change::Sound)
         $scene = Scene_ShowWindow.new
       end
     
     return exp_result_kill_count_later(enemy)
 end
end

$BlizzABS = BlizzABS::Processor.new


#==============================================================================
# ***Hunter Rank Window***
# Hunter Rank level up window
# by dwellercoc - 17/09/2010
#    
#==============================================================================

class MyCustomWindow < Window_Selectable

 #----------------------------------------------------------------------
 # * Object Initialization
 #----------------------------------------------------------------------
 def initialize
   super(242, 90, 195, 275)
   @column_max = 3
   self.contents = Bitmap.new(width - 32, height - 32)
       refresh
   self.active = false
   self.index = -1
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.font.size = 26
   cx = contents.text_size("123123123123123123123").width
   
   self.contents.font.color = Color.new(225, 215, 255)
   self.contents.font.bold = true
   self.contents.draw_text(11, 0, cx, 32, "  Hunter Rank")
   self.contents.draw_text(11, 20, cx, 32, "Now you are a:")
   self.contents.font.color = normal_color
   self.contents.font.bold = false
   
   case $game_variables[1]
       when 1
         @bitmap = RPG::Cache.battler("n00B.png", 0)
       when 10
         @bitmap = RPG::Cache.battler("Hunter.png", 0)
       when 20
         @bitmap = RPG::Cache.battler("Assasin.png", 0)
       when 30
         @bitmap = RPG::Cache.battler("Triturador.png", 0)
       when 40
         @bitmap = RPG::Cache.battler("Master.png", 0)
   end
       
   self.contents.blt(11, 47, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
     
 end

 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
   else
     self.cursor_rect.set(@index * 64, 0, 64, 64)
   end
     end
 end

$BlizzABS = BlizzABS::Processor.new
#==============================================================================
# * Scene_ShowWindow
#==============================================================================

class Scene_ShowWindow
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   
   #call the window
   @window = MyCustomWindow.new
   @window.opacity = 0
   
   # Execute transition
   @spriteset = Spriteset_Map.new
   @sprite = Sprite.new
   # @sprite.bitmap = RPG::Cache.picture("Hunter")
   Graphics.transition
   
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
    end
   
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @window.dispose
   @spriteset.dispose
   @sprite.dispose
   #@sprite.bitmap.dispose
   
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to Menu screen
     $scene = Scene_Map.new
     return
   end
   end
 end

Dwellercoc
Spoiler: ShowHide

poxy

I'm only guessing, but I think it's the "$BlizzABS = BlizzABS::Processor.new" that resets some variables...
My Project: ShowHide

Blizzard

That line is required so the changes done in the script will actually apply to the Blizz-ABS related code.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Dweller

September 30, 2010, 04:31:55 pm #3 Last Edit: October 01, 2010, 06:00:50 pm by Dweller
QuoteI'm only guessing, but I think it's the "$BlizzABS = BlizzABS::Processor.new" that resets some variables...


I thought about this because I call $scene = Scene_ShowWindow.new inside BlizzABS::Processor class, but this is clearly above my scripting skill, I hope that someone could see what I´m doing wrong.

EDIT: The first script is a modification of g_g script. Inside this script I call a new scene: $scene = Scene_ShowWindow.new to show a picture when the player reach a new hunter rank. Maybe this scene call inside the first script is what disable respawns?
Dwellercoc
Spoiler: ShowHide

Dweller

Dwellercoc
Spoiler: ShowHide

Dweller

Finally I resolved the problem.

Removing:
case $game_variables[KillCountVariable]
        when 1
          $HunterRank = "n00b"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $scene = Scene_ShowWindow.new
        when 2
          $HunterRank = "Hunter"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $scene = Scene_ShowWindow.new
        when 3
          $HunterRank = "Assasin"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $scene = Scene_ShowWindow.new
        when 4
          $HunterRank = "Triturador"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $scene = Scene_ShowWindow.new
        when 5
          $HunterRank = "Master"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $scene = Scene_ShowWindow.new
        end


from g_g script and put it on a new script:

class Scene_Map
  alias re_update update
  def update
    re_update
   
    case $huntercontrol
        when 1
          $HunterRank = "n00b"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $huntercontrol += 1
          $scene = Scene_ShowWindow.new
        when 10
          $HunterRank = "Hunter"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $huntercontrol += 1
          $scene = Scene_ShowWindow.new
        when 20
          $HunterRank = "Assasin"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $huntercontrol += 1
          $scene = Scene_ShowWindow.new
        when 30
          $HunterRank = "Triturador"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $huntercontrol += 1
          $scene = Scene_ShowWindow.new
        when 40
          $HunterRank = "Master"
          Audio.se_play("Audio/SE/" + Sound_Change::Sound)
          $huntercontrol += 1
          $scene = Scene_ShowWindow.new
        end
  end
end
Dwellercoc
Spoiler: ShowHide