Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=============================================================================
- # Kadafi - Summon Event
- # Version : 1.0
- # Contact : http://forums.rpgmakerweb.com/index.php?/user/33654-kadafi/
- # =============================================================================
- ($imported ||= {})[:Kadafi_SummonEvent] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2015.07.02 - Finished script
- # =============================================================================
- =begin
- Introduction :
- This script allow you to summon event from the spesific map to the current map.
- How to Use :
- Script Call: summon_event(map_id, event_id, x, y)
- Terms of Use :
- Credit me as Kadafi. You are allowed to edit this script as long as you
- don't claim it yours.
- =end
- # =============================================================================
- # Don't edit below this line unless you know what to do.
- # =============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Add Event
- #--------------------------------------------------------------------------
- def add_event(map_id, event_id, pos)
- map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
- event = map.events[event_id]
- @events[@events.size + 1] = Game_Event.new(@map_id, event, @events.size + 1, pos)
- refresh
- end
- end
- class Game_Event
- #--------------------------------------------------------------------------
- # * [Overwrite] Object Initialization
- #--------------------------------------------------------------------------
- def initialize(map_id, event, clone_id = nil, pos = nil)
- super()
- @map_id = map_id
- @event = event
- if !clone_id.nil?
- @id = clone_id
- moveto(pos[0], pos[1])
- else
- @id = @event.id
- moveto(@event.x, @event.y)
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # * [Overwrite] Determine if Event Page Conditions Are Met
- #--------------------------------------------------------------------------
- def conditions_met?(page)
- c = page.condition
- if c.switch1_valid
- return false unless $game_switches[c.switch1_id]
- end
- if c.switch2_valid
- return false unless $game_switches[c.switch2_id]
- end
- if c.variable_valid
- return false if $game_variables[c.variable_id] < c.variable_value
- end
- if c.self_switch_valid
- key = [@map_id, @id, c.self_switch_ch]
- return false if $game_self_switches[key] != true
- end
- if c.item_valid
- item = $data_items[c.item_id]
- return false unless $game_party.has_item?(item)
- end
- if c.actor_valid
- actor = $game_actors[c.actor_id]
- return false unless $game_party.members.include?(actor)
- end
- return true
- end
- end
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Add Event
- #--------------------------------------------------------------------------
- def summon_event(map_id, event_id, x, y)
- $game_map.add_event(map_id, event_id, [x, y])
- SceneManager.scene.refresh_characters
- end
- end
- class Scene_Map
- #--------------------------------------------------------------------------
- # * Refresh Characters
- #--------------------------------------------------------------------------
- def refresh_characters
- @spriteset.refresh_characters
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement