Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Resolved]A quick request

Started by MrMoo, May 22, 2009, 10:51:23 PM

0 Members and 1 Guest are viewing this topic.

MrMoo

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.



- -

modern algebra



  #--------------------------------------------------------------------------
  # Get X
  #--------------------------------------------------------------------------
  def get_x
    return $game_player.screen_x
  end
  #--------------------------------------------------------------------------
  # Get Y
  #--------------------------------------------------------------------------
  def get_y
    return $game_player.screen_y
  end

MrMoo

Perfect! Thanks once again MA.



- -

modern algebra

No problem. I love fulfilling requests when they're that easy :)