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.

Error with Game_Character1

Marpy

Member

After play testing my game for a few minutes, I try to transfer player, and I get this weird error.
Script 'Game_Character1' line 274: NoMethodError occurred.
undefined method `*' for nil:NilClass
def screen_z(height = 0)
# If display flag on closest surface is ON
if @always_on_top
# 999, unconditional
return 999
end
# Get screen coordinates from real coordinates and map display position
z = (@real_y - $game_map.display_y + 3) / 4 + 32
# If tile
if @tile_id > 0
# Add tile priority * 32
return z + $game_map.priorities[@tile_id] * 32
# If character
else
# If height exceeds 32, then add 31
return z + ((height > 32) ? 31 : 0)
end
end
Any idea what might be causing this?
 

Marpy

Member

Yes, as a matter of fact. I have this one.
#===================================
# Damaging and Healing Floors
#----------------------------------------------------------------------
#
# Features:
# -Heals/Damages the actors if they step on certain tiles.
# -Customizable amount of heal/damage.
# -Can be based on either percentage or a fixed rate.
#
# Instructions:
# -Place this script above Main, but below all other default scripts.
# -Change the damage and heal tags to different numbers. By default
# the are 1 for damage, 2 for heal.
# -On your tilesets, go into the 'terrain' tag, and set all damage floor's
# terrain number equal to the one set in the script for damage, and
# do the same for any healing floors.
#
#===================================

#===================================
# Module
#===================================
module Terrain_Tag_Setup
#--------------------------------------------------------------------
# Percentage =
# When true, takes away a percentage rather than a fixed amount.
#--------------------------------------------------------------------
Percentage = true
#--------------------------------------------------------------------
# Damage_Amount =
# How much is taken away from each step. If Percentange = true
# It will remove that percent.
#--------------------------------------------------------------------
Damage_Amount = 1
#--------------------------------------------------------------------
# Heal_Amount =
# How much is taken away from each step. If Percentange = true
# It will remove that percent.
#--------------------------------------------------------------------
Heal_Amount = 1
#--------------------------------------------------------------------
# Kill =
# if true, damage floors can kill players.
#--------------------------------------------------------------------
Kill = false
#--------------------------------------------------------------------
# Damage_Tag =
# The tag number that damages the player.
#--------------------------------------------------------------------
Damage_Tag = 1
#--------------------------------------------------------------------
# Heal_Tag =
# The tag number that heals the player.
#--------------------------------------------------------------------
Heal_Tag = 2
end



#===================================
# Game_Temp
#===================================
class Game_Temp
attr_accessor :move_confirm

alias leon_flooreffect_gametemp_initialize initialize

def initialize
@move_confirm = false
leon_flooreffect_gametemp_initialize
end
end

#===================================
# * Scene_Map
#===================================
class Scene_Map

alias leon_gamecharacter_moving_tt update

def update
leon_gamecharacter_moving_tt
tts = Terrain_Tag_Setup
if $game_map.terrain_tag($game_player.x, $game_player.y) == tts::Damage_Tag
if $game_temp.move_confirm == true
@counter = 0
$game_screen.start_flash(Color.new(200, 0, 0, 190), 15)
Audio.se_play("Audio/SE/117-Fire01", 80, 130)
for actor in $game_party.actors
if (actor.hp - tts::Damage_Amount) < 1
actor.hp = 1
$game_temp.move_confirm = false
else
amt = tts::Damage_Amount
if tts::Percentage == true
amt = amt * 0.01 * actor.maxhp
amt = amt.round
end
actor.hp -= amt
if tts::Kill == false and actor.hp == 0
actor.hp = 1
else
if actor.hp == 0
@counter += 1
end
end
if @counter == $game_party.actors.size
$scene = Scene_Gameover.new
end
end
end
$game_temp.move_confirm = false
end
end
if $game_map.terrain_tag($game_player.x, $game_player.y) == tts::Heal_Tag
if $game_temp.move_confirm == true
$game_screen.start_flash(Color.new(0, 200, 200, 190), 15)
Audio.se_play("Audio/SE/105-Heal01", 80, 130)
for actor in $game_party.actors
amt = tts::Heal_Amount
if tts::Percentage == true
amt = amt * 0.01 * actor.maxhp
amt = amt.round
end
actor.hp += amt
end
$game_temp.move_confirm = false
end
end
end
end

#===================================
# * Game_Player
#===================================
class Game_Player < Game_Character

alias leon_gameactor_update_tt update

def update
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir4
when 2
$game_temp.move_confirm = true
when 4
$game_temp.move_confirm = true
when 6
$game_temp.move_confirm = true
when 8
$game_temp.move_confirm = true
end
end
leon_gameactor_update_tt
end
end
And that's about it
 
Maybe I know what make your error. Maybe you assigned the graphic of an event with a tile of a tileset. Then you changed the map tileset, and that tileset does not include tile you selected. For example you selected the tile n? 500 for the event's graphic, and then the new tileset you changed to the map, has only 400 tiles, that make an error. Solution: Find the event, and change the graphic to a tile included in the new tileset, or just delete it.
 

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