Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
EmilyAnnCoons

Missing code from this world map script?

Question

Ok, so, I have a world map script in my game. I have it working in all of my projects, but I recently started a new project and copied the world map script into that project. However, I am getting this error:

 

Script 'Game_Map' line 465: NoMethodError occured

undefined method '[]' for nil:NilClass

 

Here is the script (I've searched all over online and cannot find a copy of it)

 

 

#==============================================================================

# ** Game_Map

#------------------------------------------------------------------------------

# This class handles the map. It includes scrolling and passable determining

# functions. Refer to "$game_map" for the instance of this class.

#==============================================================================

 

class Game_Map

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

attr_accessor :tileset_name # tileset file name

attr_accessor :autotile_names # autotile file name

attr_accessor :panorama_name # panorama file name

attr_accessor :panorama_hue # panorama hue

attr_accessor :fog_name # fog file name

attr_accessor :fog_hue # fog hue

attr_accessor :fog_opacity # fog opacity level

attr_accessor :fog_blend_type # fog blending method

attr_accessor :fog_zoom # fog zoom rate

attr_accessor :fog_sx # fog sx

attr_accessor :fog_sy # fog sy

attr_accessor :battleback_name # battleback file name

attr_accessor :display_x # display x-coordinate * 128

attr_accessor :display_y # display y-coordinate * 128

attr_accessor :need_refresh # refresh request flag

attr_accessor :new_tileset # edit

attr_reader :passages # passage table

attr_reader :priorities # prioroty table

attr_reader :terrain_tags # terrain tag table

attr_reader :events # events

attr_reader :fog_ox # fog x-coordinate starting point

attr_reader :fog_oy # fog y-coordinate starting point

attr_reader :fog_tone # fog color tone

attr_accessor :worldmap # Here

attr_accessor :bigger # Optional

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize

@map_id = 0

@display_x = 0

@display_y = 0

@worldmap = false # Here

@bigger = false # Optional

end

#--------------------------------------------------------------------------

# * Setup

# map_id : map ID

#--------------------------------------------------------------------------

def setup(map_id)

# マップ ID を @map_id に記憶

@map_id = map_id

# マップをファイルからロードし、@map に設定

@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))

if self.name.include?("*") # Here

@bigger = false # Here

@worldmap = true # Optional

$game_player.move_speed = 3 # Optional

elsif self.name.include?("*B") # Optional

@worldmap = false # Optional

@bigger = true # Optional

$game_player.move_speed = 4 # Optional

else # Here

@worldmap = false # Here

@bigger = false # Optional

$game_player.move_speed = 4 # Optional

end # Here

 

 

@new_tileset = false #edit

# Put map ID in @map_id memory

@map_id = map_id

# Load map from file and set @map

@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))

# set tile set information in opening instance variables

tileset = $data_tilesets[@map.tileset_id]

@tileset_name = tileset.tileset_name

@autotile_names = tileset.autotile_names

@panorama_name = tileset.panorama_name

@panorama_hue = tileset.panorama_hue

@fog_name = tileset.fog_name

@fog_hue = tileset.fog_hue

@fog_opacity = tileset.fog_opacity

@fog_blend_type = tileset.fog_blend_type

@fog_zoom = tileset.fog_zoom

@fog_sx = tileset.fog_sx

@fog_sy = tileset.fog_sy

@battleback_name = tileset.battleback_name

@passages = tileset.passages

@priorities = tileset.priorities

@terrain_tags = tileset.terrain_tags

# Initialize displayed coordinates

@display_x = 0

@display_y = 0

# Clear refresh request flag

@need_refresh = false

# Set map event data

@events = {}

for i in @map.events.keys

@events = Game_Event.new(@map_id, @map.events)

end

# Set common event data

@common_events = {}

for i in 1...$data_common_events.size

@common_events = Game_CommonEvent.new(i)

end

# Initialize all fog information

@fog_ox = 0

@fog_oy = 0

@fog_tone = Tone.new(0, 0, 0, 0)

@fog_tone_target = Tone.new(0, 0, 0, 0)

@fog_tone_duration = 0

@fog_opacity_duration = 0

@fog_opacity_target = 0

# Initialize scroll information

@scroll_direction = 2

@scroll_rest = 0

@scroll_speed = 4

end

 

def replace_tileset(new_tiles) # New Method

tileset = $data_tilesets[new_tiles]

@tileset_name = tileset.tileset_name

@autotile_names = tileset.autotile_names

@panorama_name = tileset.panorama_name

@panorama_hue = tileset.panorama_hue

@fog_name = tileset.fog_name

@fog_hue = tileset.fog_hue

@fog_opacity = tileset.fog_opacity

@fog_blend_type = tileset.fog_blend_type

@fog_zoom = tileset.fog_zoom

@fog_sx = tileset.fog_sx

@fog_sy = tileset.fog_sy

@battleback_name = tileset.battleback_name

@passages = tileset.passages

@priorities = tileset.priorities

@terrain_tags = tileset.terrain_tags

$game_map.new_tileset = true

end

#--------------------------------------------------------------------------

# * Get Map ID

#--------------------------------------------------------------------------

def map_id

return @map_id

end

#--------------------------------------------------------------------------

# * Get Width

#--------------------------------------------------------------------------

def width

return @map.width

end

#--------------------------------------------------------------------------

# * Get Height

#--------------------------------------------------------------------------

def height

return @map.height

end

#--------------------------------------------------------------------------

# * Get Encounter List

#--------------------------------------------------------------------------

def encounter_list

return @map.encounter_list

end

#--------------------------------------------------------------------------

# * Get Encounter Steps

#--------------------------------------------------------------------------

def encounter_step

return @map.encounter_step

end

#--------------------------------------------------------------------------

# * Get Map Data

#--------------------------------------------------------------------------

def data

return @map.data

end

#--------------------------------------------------------------------------

# * Automatically Change Background Music and Backround Sound

#--------------------------------------------------------------------------

def autoplay

if @map.autoplay_bgm

$game_system.bgm_play(@map.bgm)

end

if @map.autoplay_bgs

$game_system.bgs_play(@map.bgs)

end

end

#--------------------------------------------------------------------------

# * Refresh

#--------------------------------------------------------------------------

def refresh

# If map ID is effective

if @map_id > 0

# Refresh all map events

for event in @events.values

event.refresh

end

# Refresh all common events

for common_event in @common_events.values

common_event.refresh

end

end

# Clear refresh request flag

@need_refresh = false

end

#--------------------------------------------------------------------------

# * Scroll Down

# distance : scroll distance

#--------------------------------------------------------------------------

def scroll_down(distance)

@display_y = [@display_y + distance, (self.height - 15) * 128].min

end

#--------------------------------------------------------------------------

# * Scroll Left

# distance : scroll distance

#--------------------------------------------------------------------------

def scroll_left(distance)

@display_x = [@display_x - distance, 0].max

end

#--------------------------------------------------------------------------

# * Scroll Right

# distance : scroll distance

#--------------------------------------------------------------------------

def scroll_right(distance)

@display_x = [@display_x + distance, (self.width - 20) * 128].min

end

#--------------------------------------------------------------------------

# * Scroll Up

# distance : scroll distance

#--------------------------------------------------------------------------

def scroll_up(distance)

@display_y = [@display_y - distance, 0].max

end

#--------------------------------------------------------------------------

# * Determine Valid Coordinates

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def valid?(x, y)

return (x >= 0 and x < width and y >= 0 and y < height)

end

#--------------------------------------------------------------------------

# * Determine if Passable

# x : x-coordinate

# y : y-coordinate

# d : direction (0,2,4,6,8,10)

# * 0,10 = determine if all directions are impassable

# self_event : Self (If event is determined passable)

#--------------------------------------------------------------------------

def passable?(x, y, d, self_event = nil)

# If coordinates given are outside of the map

unless valid?(x, y)

# impassable

return false

end

# Change direction (0,2,4,6,8,10) to obstacle bit (0,1,2,4,8,0)

bit = (1 << (d / 2 - 1)) & 0x0f

# Loop in all events

for event in events.values

# If tiles other than self are consistent with coordinates

if event.tile_id >= 0 and event != self_event and

event.x == x and event.y == y and not event.through

# If obstacle bit is set

if @passages[event.tile_id] & bit != 0

# impassable

return false

# If obstacle bit is set in all directions

elsif @passages[event.tile_id] & 0x0f == 0x0f

# impassable

return false

# If priorities other than that are 0

elsif @priorities[event.tile_id] == 0

# passable

return true

end

end

end

# Loop searches in order from top of layer

for i in [2, 1, 0]

# Get tile ID

tile_id = data[x, y, i]

# Tile ID acquistion failure

if tile_id == nil

# impassable

return false

# If obstacle bit is set

elsif @passages[tile_id] & bit != 0

# impassable

return false

# If obstacle bit is set in all directions

elsif @passages[tile_id] & 0x0f == 0x0f

# impassable

return false

# If priorities other than that are 0

elsif @priorities[tile_id] == 0

# passable

return true

end

end

# passable

return true

end

#--------------------------------------------------------------------------

# * Determine Thicket

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def bush?(x, y)

if @map_id != 0

for i in [2, 1, 0]

tile_id = data[x, y, i]

if tile_id == nil

return false

elsif @passages[tile_id] & 0x40 == 0x40

return true

end

end

end

return false

end

#--------------------------------------------------------------------------

# * Determine Counter

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def counter?(x, y)

if @map_id != 0

for i in [2, 1, 0]

tile_id = data[x, y, i]

if tile_id == nil

return false

elsif @passages[tile_id] & 0x80 == 0x80

return true

end

end

end

return false

end

#--------------------------------------------------------------------------

# * Get Terrain Tag

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def terrain_tag(x, y)

if @map_id != 0

for i in [2, 1, 0]

tile_id = data[x, y, i]

if tile_id == nil

return 0

elsif @terrain_tags[tile_id] > 0

return @terrain_tags[tile_id]

end

end

end

return 0

end

#--------------------------------------------------------------------------

# * Get Designated Position Event ID

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def check_event(x, y)

for event in $game_map.events.values

if event.x == x and event.y == y

return event.id

end

end

end

#--------------------------------------------------------------------------

# * Start Scroll

# direction : scroll direction

# distance : scroll distance

# speed : scroll speed

#--------------------------------------------------------------------------

def start_scroll(direction, distance, speed)

@scroll_direction = direction

@scroll_rest = distance * 128

@scroll_speed = speed

end

#--------------------------------------------------------------------------

# * Determine if Scrolling

#--------------------------------------------------------------------------

def scrolling?

return @scroll_rest > 0

end

#--------------------------------------------------------------------------

# * Start Changing Fog Color Tone

# tone : color tone

# duration : time

#--------------------------------------------------------------------------

def start_fog_tone_change(tone, duration)

@fog_tone_target = tone.clone

@fog_tone_duration = duration

if @fog_tone_duration == 0

@fog_tone = @fog_tone_target.clone

end

end

#--------------------------------------------------------------------------

# * Start Changing Fog Opacity Level

# opacity : opacity level

# duration : time

#--------------------------------------------------------------------------

def start_fog_opacity_change(opacity, duration)

@fog_opacity_target = opacity * 1.0

@fog_opacity_duration = duration

if @fog_opacity_duration == 0

@fog_opacity = @fog_opacity_target

end

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

# Refresh map if necessary

if $game_map.need_refresh

refresh

end

# If scrolling

if @scroll_rest > 0

# Change from scroll speed to distance in map coordinates

distance = 2 ** @scroll_speed

# Execute scrolling

case @scroll_direction

when 2 # Down

scroll_down(distance)

when 4 # Left

scroll_left(distance)

when 6 # Right

scroll_right(distance)

when 8 # Up

scroll_up(distance)

end

# Subtract distance scrolled

@scroll_rest -= distance

end

# Update map event

for event in @events.values

event.update

end

# Update common event

for common_event in @common_events.values

common_event.update

end

# Manage fog scrolling

@fog_ox -= @fog_sx / 8.0

@fog_oy -= @fog_sy / 8.0

# Manage change in fog color tone

if @fog_tone_duration >= 1

d = @fog_tone_duration

target = @fog_tone_target

@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d

@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d

@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d

@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d

@fog_tone_duration -= 1

end

# Manage change in fog opacity level

if @fog_opacity_duration >= 1

d = @fog_opacity_duration

@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d

@fog_opacity_duration -= 1

end

end

def name # Here

$map_infos[@map_id] # Here

end # Here

end

 

#==============================================================================

# ** Game_Player

#------------------------------------------------------------------------------

# This class handles the player. Its functions include event starting

# determinants and map scrolling. Refer to "$game_player" for the one

# instance of this class.

#==============================================================================

 

class Game_Player < Game_Character

#--------------------------------------------------------------------------

# * Invariables

#--------------------------------------------------------------------------

CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4

CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4

#--------------------------------------------------------------------------

# * Passable Determinants

# x : x-coordinate

# y : y-coordinate

# d : direction (0,2,4,6,8)

# * 0 = Determines if all directions are impassable (for jumping)

#--------------------------------------------------------------------------

def passable?(x, y, d)

# Get new coordinates

new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)

new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)

# If coordinates are outside of map

unless $game_map.valid?(new_x, new_y)

# Impassable

return false

end

# If debug mode is ON and ctrl key was pressed

if $DEBUG and Input.press?(Input::CTRL)

# Passable

return true

end

super

end

#--------------------------------------------------------------------------

# * Set Map Display Position to Center of Screen

#--------------------------------------------------------------------------

def center(x, y)

max_x = ($game_map.width - 20) * 128

max_y = ($game_map.height - 15) * 128

$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max

$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max

end

#--------------------------------------------------------------------------

# * Move to Designated Position

# x : x-coordinate

# y : y-coordinate

#--------------------------------------------------------------------------

def moveto(x, y)

super

# Centering

center(x, y)

# Make encounter count

make_encounter_count

end

#--------------------------------------------------------------------------

# * Increaase Steps

#--------------------------------------------------------------------------

def increase_steps

super

# If move route is not forcing

unless @move_route_forcing

# Increase steps

$game_party.increase_steps

# Number of steps are an even number

if $game_party.steps % 2 == 0

# Slip damage check

$game_party.check_map_slip_damage

end

end

end

#--------------------------------------------------------------------------

# * Get Encounter Count

#--------------------------------------------------------------------------

def encounter_count

return @encounter_count

end

#--------------------------------------------------------------------------

# * Make Encounter Count

#--------------------------------------------------------------------------

def make_encounter_count

# Image of two dice rolling

if $game_map.map_id != 0

n = $game_map.encounter_step

@encounter_count = rand(n) + rand(n) + 1

end

end

#--------------------------------------------------------------------------

# * Refresh

#--------------------------------------------------------------------------

def refresh

# If party members = 0

if $game_party.actors.size == 0

# Clear character file name and hue

@character_name = ""

@character_hue = 0

# End method

return

end

# Get lead actor

actor = $game_party.actors[0]

# Set character file name and hue

@character_name = actor.character_name

@character_hue = actor.character_hue

# Initialize opacity level and blending method

@opacity = 255

@blend_type = 0

end

#--------------------------------------------------------------------------

# * Same Position Starting Determinant

#--------------------------------------------------------------------------

def check_event_trigger_here(triggers)

result = false

# If event is running

if $game_system.map_interpreter.running?

return result

end

# All event loops

for event in $game_map.events.values

# If event coordinates and triggers are consistent

if event.x == @x and event.y == @y and triggers.include?(event.trigger)

# If starting determinant is same position event (other than jumping)

if not event.jumping? and event.over_trigger?

event.start

result = true

end

end

end

return result

end

#--------------------------------------------------------------------------

# * Front Envent Starting Determinant

#--------------------------------------------------------------------------

def check_event_trigger_there(triggers)

result = false

# If event is running

if $game_system.map_interpreter.running?

return result

end

# Calculate front event coordinates

new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

# All event loops

for event in $game_map.events.values

# If event coordinates and triggers are consistent

if event.x == new_x and event.y == new_y and

triggers.include?(event.trigger)

# If starting determinant is front event (other than jumping)

if not event.jumping? and not event.over_trigger?

event.start

result = true

end

end

end

# If fitting event is not found

if result == false

# If front tile is a counter

if $game_map.counter?(new_x, new_y)

# Calculate 1 tile inside coordinates

new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

# All event loops

for event in $game_map.events.values

# If event coordinates and triggers are consistent

if event.x == new_x and event.y == new_y and

triggers.include?(event.trigger)

# If starting determinant is front event (other than jumping)

if not event.jumping? and not event.over_trigger?

event.start

result = true

end

end

end

end

end

return result

end

#--------------------------------------------------------------------------

# * Touch Event Starting Determinant

#--------------------------------------------------------------------------

def check_event_trigger_touch(x, y)

result = false

# If event is running

if $game_system.map_interpreter.running?

return result

end

# All event loops

for event in $game_map.events.values

# If event coordinates and triggers are consistent

if event.x == x and event.y == y and [1,2].include?(event.trigger)

# If starting determinant is front event (other than jumping)

if not event.jumping? and not event.over_trigger?

event.start

result = true

end

end

end

return result

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

# Remember whether or not moving in local variables

last_moving = moving?

# If moving, event running, move route forcing, and message window

# display are all not occurring

unless moving? or $game_system.map_interpreter.running? or

@move_route_forcing or $game_temp.message_window_showing

# Move player in the direction the directional button is being pressed

case Input.dir4

when 2

move_down

when 4

move_left

when 6

move_right

when 8

move_up

end

end

# Remember coordinates in local variables

last_real_x = @real_x

last_real_y = @real_y

super

# If character moves down and is positioned lower than the center

# of the screen

if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y

# Scroll map down

$game_map.scroll_down(@real_y - last_real_y)

end

# If character moves left and is positioned more let on-screen than

# center

if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X

# Scroll map left

$game_map.scroll_left(last_real_x - @real_x)

end

# If character moves right and is positioned more right on-screen than

# center

if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X

# Scroll map right

$game_map.scroll_right(@real_x - last_real_x)

end

# If character moves up and is positioned higher than the center

# of the screen

if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y

# Scroll map up

$game_map.scroll_up(last_real_y - @real_y)

end

# If not moving

unless moving?

# If player was moving last time

if last_moving

# Event determinant is via touch of same position event

result = check_event_trigger_here([1,2])

# If event which started does not exist

if result == false

# Disregard if debug mode is ON and ctrl key was pressed

unless $DEBUG and Input.press?(Input::CTRL)

# Encounter countdown

if @encounter_count > 0

@encounter_count -= 1

end

end

end

end

# If C button was pressed

if Input.trigger?(Input::C)

# Same position and front event determinant

check_event_trigger_here([0])

check_event_trigger_there([0,1,2])

end

end

end

end

 

class Game_Player < Game_Character

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

# Remember whether or not moving in local variables

last_moving = moving?

# If moving, event running, move route forcing, and message window

# display are all not occurring

unless moving? or $game_system.map_interpreter.running? or

@move_route_forcing or $game_temp.message_window_showing

update_player_movement

end

# Remember coordinates in local variables

last_real_x = @real_x

last_real_y = @real_y

super

# Scroll map

update_scroll_down(last_real_y)

update_scroll_left(last_real_x)

update_scroll_right(last_real_x)

update_scroll_up(last_real_y)

# If not moving

unless moving?

# If player was moving last time

if last_moving

update_encounter

end

update_action_trigger

end

end

#--------------------------------------------------------------------------

# * Player Movement Update

#--------------------------------------------------------------------------

def update_player_movement

# Move player in the direction the directional button is being pressed

case Input.dir4

when 2

move_down

when 4

move_left

when 6

move_right

when 8

move_up

end

end

#--------------------------------------------------------------------------

# * Scroll Down

#--------------------------------------------------------------------------

def update_scroll_down(last_real_y)

# If character moves down and is positioned lower than the center

# of the screen

if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y

# Scroll map down

$game_map.scroll_down(@real_y - last_real_y)

end

end

#--------------------------------------------------------------------------

# * Scroll Left

#--------------------------------------------------------------------------

def update_scroll_left(last_real_x)

# If character moves left and is positioned more let on-screen than

# center

if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X

# Scroll map left

$game_map.scroll_left(last_real_x - @real_x)

end

end

#--------------------------------------------------------------------------

# * Scroll Right

#--------------------------------------------------------------------------

def update_scroll_right(last_real_x)

# If character moves right and is positioned more right on-screen than

# center

if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X

# Scroll map right

$game_map.scroll_right(@real_x - last_real_x)

end

end

#--------------------------------------------------------------------------

# * Scroll Up

#--------------------------------------------------------------------------

def update_scroll_up(last_real_y)

# If character moves up and is positioned higher than the center

# of the screen

if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y

# Scroll map up

$game_map.scroll_up(last_real_y - @real_y)

end

end

#--------------------------------------------------------------------------

# * Update Action Trigger

#--------------------------------------------------------------------------

def update_action_trigger

# If C button was pressed

if Input.trigger?(Input::C)

# Same position and front event determinant

check_event_trigger_here([0])

check_event_trigger_there([0,1,2])

end

end

#--------------------------------------------------------------------------

# * Scroll Encounter

#--------------------------------------------------------------------------

def update_encounter

# Event determinant is via touch of same position event

result = check_event_trigger_here([1,2])

# If event which started does not exist

if result == false

# Disregard if debug mode is ON and ctrl key was pressed

unless $DEBUG and Input.press?(Input::CTRL)

# Encounter countdown

if @encounter_count > 0

@encounter_count -= 1

end

end

end

end

end

 

#==============================================================================

# ** Sprite_Character

#------------------------------------------------------------------------------

# This sprite is used to display the character.It observes the Game_Character

# class and automatically changes sprite conditions.

#==============================================================================

 

class Sprite_Character < RPG::Sprite

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

attr_accessor :character # character

#--------------------------------------------------------------------------

# * Object Initialization

# viewport : viewport

# character : character (Game_Character)

#--------------------------------------------------------------------------

def initialize(viewport, character = nil)

super(viewport)

@character = character

if $game_map.worldmap # Here

@zoom_y = 0.5 # Here

@zoom_x = 0.5 # Here

elsif $game_map.bigger # Optional

@zoom_y = 1.9 # Optional

@zoom_x = 1.9 # Optional

else # Here

@zoom_y = 1 # Here

@zoom_x = 1 # Here

end # Here

update

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

super

# If tile ID, file name, or hue are different from current ones

if @tile_id != @character.tile_id or

@character_name != @character.character_name or

@character_hue != @character.character_hue

# Remember tile ID, file name, and hue

@tile_id = @character.tile_id

@character_name = @character.character_name

@character_hue = @character.character_hue

# If tile ID value is valid

if @tile_id >= 384

self.bitmap = RPG::Cache.tile($game_map.tileset_name,

@tile_id, @character.character_hue)

self.src_rect.set(0, 0, 32, 32)

self.ox = 16

self.oy = 32

# If tile ID value is invalid

else

self.bitmap = RPG::Cache.character(@character.character_name,

@character.character_hue)

@cw = bitmap.width / 4

@ch = bitmap.height / 4

self.ox = @cw / 2

self.oy = @ch

if @character.is_a?(Game_Player)# Here, for Caterpillar users, if you don't use it:

# if @character.is_a?(Game_Player)

self.zoom_x = @zoom_x # Here

self.zoom_y = @zoom_y # Here

end

end

end

# Set visible situation

self.visible = (not @character.transparent)

# If graphic is character

if @tile_id == 0

# Set rectangular transfer

sx = @character.pattern * @cw

sy = (@character.direction - 2) / 2 * @ch

self.src_rect.set(sx, sy, @cw, @ch)

end

# Set sprite coordinates

self.x = @character.screen_x

self.y = @character.screen_y

self.z = @character.screen_z(@ch)

# Set opacity level, blend method, and bush depth

self.opacity = @character.opacity

self.blend_type = @character.blend_type

self.bush_depth = @character.bush_depth

# Animation

if @character.animation_id != 0

animation = $data_animations[@character.animation_id]

animation(animation, true)

@character.animation_id = 0

end

end

end

 

 

Does anyone know what could be missing in any of this coding that would cause that error? (As a note, Game_Map, Game_Player, and Sprite_Character are all replaced by the above three pieces)

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...