The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: MrMoo on May 22, 2009, 10:51:23 PM

Title: [Resolved]A quick request
Post by: MrMoo on May 22, 2009, 10:51:23 PM
This is a simple request. I get an error with an item popup window script. What it does is show the item icon above an event zelda style whenever you get an item, and it works fine. The only problem is, what if that event is a common event?
It has no x and y values, nor event IDs. This causes the script to crash the game whenever the player is given an item through common events. I thought of a simple solution.
Have the item appear above the player, using the player's X and Y coordinates instead.

This is the section of the script I need to edit. I'm sure it's just this part, but if I run into problems I'll post the whole thing.
class Game_Interpreter
 #--------------------------------------------------------------------------
 # Get X
 #--------------------------------------------------------------------------
 def get_x
   events = $game_map.events
   x_coord = events[@event_id]
   return x_coord.screen_x
 end
 #--------------------------------------------------------------------------
 # Get Y
 #--------------------------------------------------------------------------
 def get_y
   events = $game_map.events
   y_coord = events[@event_id]
   return y_coord.screen_y
 end


I'm guessing just change event to player or actor, but I'm not too sure. All I need is for someone to make the changes here so I can see if my idea worked. If it doesn't work I'll post a more detailed analysis of the problem, though i doubt it'll be necessary.
Title: Re: A quick request
Post by: modern algebra on May 22, 2009, 11:17:05 PM


  #--------------------------------------------------------------------------
  # Get X
  #--------------------------------------------------------------------------
  def get_x
    return $game_player.screen_x
  end
  #--------------------------------------------------------------------------
  # Get Y
  #--------------------------------------------------------------------------
  def get_y
    return $game_player.screen_y
  end
Title: Re:[Resolved] A quick request
Post by: MrMoo on May 22, 2009, 11:33:36 PM
Perfect! Thanks once again MA.
Title: Re: [Resolved]A quick request
Post by: modern algebra on May 22, 2009, 11:36:22 PM
No problem. I love fulfilling requests when they're that easy :)