Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: hirasu on October 28, 2013, 10:22:04 pm

Title: [Resolved]Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: hirasu on October 28, 2013, 10:22:04 pm
hey :)
i have problem with the Custom Resolution Version: 0.93 Script from ForeverZer0 , can someone help me with this error please?

Error message:
"
divided by 0
Custom Resolution:429:in `/'
Custom Resolution:429:in `screen_z'
"

Code :

class Game_Character
 
 def screen_z(height = 0)
   if @always_on_top
     # Return high Z value if always on top flag is present.
     return 999
   elsif height != nil && height > 32
     # Iterate through map characters to their positions relative to this one.
     characters = $game_map.events.values
     characters += [$game_player] unless self.is_a?(Game_Player)
     # Find and set any character that is one tile above this one.
     above, z = characters.find {|chr| chr.x == @x && chr.y == @y - 1 }, 0
     if above != nil
       # If found, adjust value by this one's Z, and the other's.
       z = (above.screen_z(48) >= 32 ? 33 : 31)
     end
     # Check for Blizz-ABS and adjust coordinates for the pixel-rate.
     if $BlizzABS
       x = ((@x / $game_system.pixel_rate) / 2.0).to_i                       <------------------ HERE IS THE ERROR Line 429
       y = ((@y / $game_system.pixel_rate) / 2.0).to_i
       return $game_map.priority_data[x, y] + z
     else
       return $game_map.priority_data[@x, @y] + z
     end
   end
   return 0
 end
end


Thanks

PS: Sorry for my bad English.
Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: KK20 on October 30, 2013, 12:52:42 am
This error has been reported before (and someone very recently asked the same thing in the Custom Resolution (http://forum.chaos-project.com/index.php/topic,7814.msg179651.html#msg179651) thread).

Quote from: KK20 on October 23, 2013, 05:04:18 pm
Make the line above it this

if $BlizzABS && $game_system.pixel_rate > 0

Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: hirasu on October 30, 2013, 07:40:55 am
Thanks it works but i have a another problem my char is not in the middle of the screen but in the left center on the screen how can i fix this?

(http://1.1.1.1/bmi/www.workupload.com/image/5MFsI7rm)
Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: KK20 on October 30, 2013, 10:26:58 am
Did you try using the fix in this thread?
http://forum.chaos-project.com/index.php/topic,7947.0.html
Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: hirasu on October 30, 2013, 06:52:04 pm
No but i tryed it and it works now ! Thank you  :D

EDIT:
When i use [BlizzABS/XAS] Smooth Scroller its the same problem like the Picture above your last post so how i can fix this?


Script:
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# [BlizzABS/XAS] Smooth Scroller
# Version: 1.01
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

#==============================================================================
# ** Game_Player / BlizzABS::Controller
#------------------------------------------------------------------------------
#  This class handles the party leader. Its functions include event starting
#  determinants and map scrolling. Some input is processed instantly,
#  while some is converted into commands to be given to the player character
#==============================================================================
name = $BlizzABS ? "BlizzABS::Controller" : "Game_Player < Game_Character"
Cache = BlizzABS::Cache if $BlizzABS
eval_text = "
class #{name}
  unless $BlizzABS
    attr_accessor :real_x,:real_y
    def player()  $game_player  end
  end
  #--------------------------------------------------------------------------
  # update_moving
  #--------------------------------------------------------------------------
  def update_moving(data)
    if data != nil
      moved, x, y = data
      scroll_map_update(player.real_x,player.real_y)
      unless player.moving?
        if moved && !check_event_trigger_here(Cache::TouchTrigger) &&
            !($DEBUG && Input.press?(Input::CTRL)) && @encounter_count > 0
          @encounter_count -= 2 ** (5 - $game_system.pixel_rate)
          @encounter_count = 0 if @encounter_count < 0
        end
        if Input.trigger?(Input::C)
          check_event_trigger_here(Cache::PressTrigger)
          check_event_trigger_there(Cache::BasicTrigger)
        end
      end
    end
    ($BlizzABS.battlers - [player]).each {|actor| actor.update}
  end
  #--------------------------------------------------------------------------
  # Scroll Map Update | Hirasu : i think here but i dont know which number i have to change :O
  #------------------------------------f--------------------------------------
  def scroll_map_update(last_real_x,last_real_y)
    if player.real_y - $game_map.display_y > 15*128 - 240*4
      $game_map.scroll_down(player.real_y > $game_map.height*128 - 240*4 ?
        (($game_map.height - 15)*128 - $game_map.display_y)/32.0 :
        ((player.real_y - $game_map.display_y - 15*128 + 240*4)/32.0))
    end
    if player.real_x - $game_map.display_x < 480*4
      $game_map.scroll_left(player.real_x < 480*4 ? $game_map.display_x/32.0 :
        (($game_map.display_x + 480*4  - player.real_x)/32.0))
    end
    if player.real_x - $game_map.display_x > 20*128 - 480*4
      $game_map.scroll_right(player.real_x > $game_map.width*128 - 480*4  ?
        (($game_map.width - 20)*128 - $game_map.display_x)/32.0 :
        (player.real_x - $game_map.display_x - 20*128 + 480*4 )/32.0)
    end
    if player.real_y - $game_map.display_y < 240*4
        $game_map.scroll_up(player.real_y < 240*4 ?  $game_map.display_y/32.0 :
      (($game_map.display_y+240*4-player.real_y)/32.0))
    end
  end
end"

eval(eval_text)
Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: KK20 on November 01, 2013, 07:16:12 pm
You are right, it is in that area. In all instances of 480, replace it with your game's resolution height. Instances of 20 and 15 need to be replaced with your SCREEN values divided by 32. And 240 can be replaced with half the value of your resolution height.
Title: Re: Blizz-ABS 2.85 + Custom Resolution from ForeverZer0 Error
Post by: hirasu on November 01, 2013, 07:50:46 pm
Ouh Sh*t
its works thank you so much!!  :troll: