molegato

Event transmutter script

Feb 26th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.23 KB | None | 0 0
  1. #==============================================================================
  2. # EVENT TRANSMUTTER
  3. # Author Molegato
  4. # Version 1.0
  5. #------------------------------------------------------------------------------
  6. # Lets you place event clones from a 'gallery' map.
  7. #------------------------------------------------------------------------------
  8. # INSTRUCTIONS
  9. #
  10. # In the config module you have to set the name for each gallery map.
  11. # A gallery map is a map from where events can be copied.
  12. # You just have to assign the map ID to a name.
  13. #
  14. # To place in any map an event that copies another from a gallery map
  15. # You just have to set its name to 'name_number'
  16. # For example: If you added a map with shops with
  17. #   'shops' => 27
  18. # And you can copy an event with ID 12 from that map, you'll have to name
  19. # the event 'shops_12'
  20. #==============================================================================
  21.  
  22. $imported = {} if $imported.nil?
  23. $imported['Molegato-Event_transmutter'] = true
  24.  
  25. #==============================================================================
  26. # CONFIGURATION, YOU CAN TOUCH THIS
  27. #==============================================================================
  28.  
  29. module TRANSMUTTER_MODULE
  30.  
  31.   MAPS={
  32.   'Event'=> 3,
  33.   'Npc'=> 4,
  34.   'Others'=> 5,
  35.   }
  36.  
  37. end
  38. #==============================================================================
  39. # END OF CONFIGURATION. EVERYTHING UNDER HERE IS A HELLISH MESS OF DEFICIENT
  40. # AMATEUR SCRIPTING. BE AWARE THAT MESSING WITH IT CAN RESULT IN DISASTER
  41. #==============================================================================
  42.  
  43.  
  44. #==============================================================================
  45. # ** Game_Event
  46. #==============================================================================
  47. class Game_Event < Game_Character
  48.   #--------------------------------------------------------------------------
  49.   # * Public Instance Variables
  50.   #--------------------------------------------------------------------------
  51.   attr_accessor :event
  52.   attr_accessor :id
  53. end
  54.  
  55.  
  56. #==============================================================================
  57. # ** Game_Map
  58. #==============================================================================
  59.  
  60. class Game_Map
  61.   alias event_transmutter_setup_events setup_events
  62.   def setup_events
  63.     event_transmutter_setup_events
  64.     for i in @map.events.keys
  65.       initstring = @map.events[i].name
  66.       map = -1
  67.       if TRANSMUTTER_MODULE::MAPS.keys.include?(initstring.split("_")[0])
  68.           map = TRANSMUTTER_MODULE::MAPS[initstring.split("_")[0]]
  69.       end
  70.       if map != -1
  71.         new_id = String.new(@map.events[i].name.split("_")[1])
  72.         data = load_data(sprintf("Data/Map%03d.rvdata2", map))
  73.        
  74.         dum_event = Game_Event.new(17, data.events[new_id.to_i].clone)
  75.         dum_event.event = Game_Event.new(17, data.events[new_id.to_i]).event.clone
  76.         dum_event.id = @map.events[i].id
  77.         dum_event.event.id = @map.events[i].id
  78.         @events[i] = Game_Event.new(@map_id, @map.events[i])
  79.         @events[i].event = dum_event.event
  80.         @events[i].refresh
  81.       else
  82.         @events[i] = Game_Event.new(@map_id, @map.events[i])
  83.       end
  84.     end
  85.    
  86.     refresh_tile_events
  87.   end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment