To duplicate the 1st event of a map, I use the following code :
The new event works perfectly, exept... it doesn't appear on the map.
When I say it doesn't apper, it only apply to its graphic (altough its pages[n].graphics is correct). It IS on the map, blocking the PC and giving the items it have to give (in my test project, the event is a chest).
What did I miss ??
Unless there is a simpler way to duplicate an event.
Code:
class Game_Map
  def data_events
   return @map.events
  end
end
Â
def duplicate_event
 n = 0
 for i in $game_map.data_events.keys do
  n = [n, i].max
 end
 n += 1
 $game_map.data_events[n] = RPG::Event.new( $game_map.data_events[1].x+1, $game_map.data_events[1].y)
 $game_map.data_events[n].id = n
 $game_map.data_events[n].pages = $game_map.data_events[i].pages
 $game_map.events[n] = Game_Event.new( $game_map.map_id, $game_map.data_events[n])
end
The new event works perfectly, exept... it doesn't appear on the map.
When I say it doesn't apper, it only apply to its graphic (altough its pages[n].graphics is correct). It IS on the map, blocking the PC and giving the items it have to give (in my test project, the event is a chest).
What did I miss ??
Unless there is a simpler way to duplicate an event.