Jump to content
Rpg²S Forum

*Wrap Map - Mappe "infinite" in gioco


Zerathul
 Share

Recommended Posts

Wrap Map v2.0

Descrizione

Questo script permette di realizzare mappe "infinite": se il personaggio toccherà uno dei quattro lati della mappa, verrà automaticamente teletrasportato dall'altro capo. Per farlo funzionare dovete aggiungere al nome della mappa"_wrap".

Autore

Dirtie

Allegati

Inserite qui il testo

Istruzioni per l'uso

Create una nuova classe sopra main e incollate al suo interno questo:

 

 

# * Menù personalizzato: by mewsterus modificato da: Alex'94
# * Fate una nuova classe e chiamatela Custom_Menù
# * Dopodicchè avviate il gioco e...divertitevi!! :-)
#===============================================================================
# ¦ Window_Base
#-------------------------------------------------------------------------------
# Creato by mewsterus e tradotto e modificato da Alex'94
#===============================================================================
class Window_Base
	#-----------------------------------------------------------------------------
	# \\\\\\
	#-----------------------------------------------------------------------------
	def draw_actor_state(actor, x, y, width = 120)
		text = make_battler_state_text(actor, width, true)
		self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
		self.contents.draw_text(x, y, width, 32, text, 2)
	end
	#-----------------------------------------------------------------------------
	# \\\\\\\\\
	#-----------------------------------------------------------------------------
	def draw_actor_battler(actor, x, y)
		if $game_party.actors.size != 0
			bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
			src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
			self.contents.blt(x-(bitmap.width/2), y-bitmap.height, bitmap, src_rect)
		end
	end
	#-----------------------------------------------------------------------------
	# @ \\\\\\\\\
	#-----------------------------------------------------------------------------
	def draw_actor_exp(actor, x, y, width = 144)
		self.contents.font.color = system_color
		self.contents.draw_text(x, y, 48, 32, "Exp")
		self.contents.font.color = normal_color
		self.contents.draw_text(x + width - 48, y, 48, 32, actor.exp_s, 2)
	end
end
#===============================================================================
# ¦ Window_MenuStatus
#-------------------------------------------------------------------------------
# Creato by mewsterus modificato by Alex'94
#===============================================================================
class Window_MenuStatus < Window_Selectable
	#-----------------------------------------------------------------------------
	# @ Make the window
	#-----------------------------------------------------------------------------
	def initialize
		super(0, 240, 640, 0)
		self.z -= 30
		@column_max = 2
		self.active = false
		self.index = -1
	end
	#-----------------------------------------------------------------------------
	# @ Refresh the window
	#-----------------------------------------------------------------------------
	def refresh
		self.contents = Bitmap.new(608, 448)
		self.contents.clear
		@item_max = $game_party.actors.size
		for i in 0...$game_party.actors.size
			x = i % 2 * 400
			y = i / 2 * 232
			actor = $game_party.actors[i]
			draw_actor_battler(actor, x + 104, y + 208)
			draw_actor_name(actor, x, y)
			draw_actor_state(actor, x + 88, y)
			draw_actor_exp(actor, x, y + 20, 208)
			draw_actor_level(actor, x, y + 40)
			draw_actor_hp(actor, x, y + 168, 208)
			draw_actor_sp(actor, x, y + 188, 208)
			self.contents.draw_text(x + 64, y + 40, 144, 32, actor.class_name, 2)
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the cursor
	#-----------------------------------------------------------------------------
	def update_cursor_rect
		if @index < 0
			self.cursor_rect.empty
		else
			self.cursor_rect.set(@index%2*400-8, @index/2*232-8, 224, 232)
		end
	end
end
#===============================================================================
# ¦ Window_Play
#-------------------------------------------------------------------------------
# Written by mewsterus modificato da: Alex'94
#===============================================================================
class Window_Play < Window_Selectable
	#-----------------------------------------------------------------------------
	# @ Make the window
	#-----------------------------------------------------------------------------
	def initialize
		super(240, 240, 160, 0)
		self.z -= 20
		self.active = false
		self.index = -1
		self.back_opacity = 100
	end
	#-----------------------------------------------------------------------------
	# @ Refresh the window
	#-----------------------------------------------------------------------------
	def refresh
		self.contents = Bitmap.new(128, 448)
		#self.contents.font.name = $fontface
		#self.contents.font.size = $fontsize
		self.contents.clear
		cx = contents.text_size($data_system.words.gold).width
		self.contents.font.color = system_color
		self.contents.draw_text(0, 0, 128, 32, "Tempo: ")
		self.contents.draw_text(128 - cx, 64, cx, 32, $data_system.words.gold, 2)
		self.contents.draw_text(0, 384, 128, 32, "Passi: ")
		@total_sec = Graphics.frame_count / Graphics.frame_rate
		hour = @total_sec / 60 / 60
		min = @total_sec / 60 % 60
		sec = @total_sec % 60
		text = sprintf("%02d:%02d:%02d", hour, min, sec)
		self.contents.font.color = normal_color
		self.contents.draw_text(0, 32, 128, 32, text, 2)
		self.contents.draw_text(0, 64, 126 - cx, 32, $game_party.gold.to_s, 2)
		self.contents.font.color = normal_color
		self.contents.draw_text(0, 416, 128, 32, $game_party.steps.to_s, 2)
		if $location_enabled
			self.contents.draw_text(0,352,128,32,$game_map.name.delete("*").to_s,2)
			self.contents.font.color = system_color
			self.contents.draw_text(0,320,128,32,"Location")
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the cursor
	#-----------------------------------------------------------------------------
	def update_cursor_rect
		if @index < 0
			self.cursor_rect.empty
		else
			self.cursor_rect.set(@index%2*400-8, @index/2*232-8, 224, 232)
		end
	end
end
#===============================================================================
# ¦ Scene_Menu
#-------------------------------------------------------------------------------
# Creato by mewsterus Modificato by Alex'94
#===============================================================================
class Scene_Menu
	#-----------------------------------------------------------------------------
	# @ Accept index
	#-----------------------------------------------------------------------------
	def initialize(menu_index = 0, equip_index = 0)
		@menu_index = menu_index
		@equip_index = equip_index
	end
	#-----------------------------------------------------------------------------
	# @ Main loop
	#-----------------------------------------------------------------------------
	def main
		# @sprite = Spriteset_Map.new
		@bg_window = Window_Base.new(320, 0, 0, 480)
		s1 = $data_system.words.item
		s2 = $data_system.words.skill
		s3 = $data_system.words.equip
		s4 = "Stato"
		s5 = "Salva"
		s6 = "Esci Dal Gioco"
		@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
		@command_window.index = @menu_index
		@command_window.opacity = 0
		@command_window.x = 240
		@command_window.y = 96
		@command_window.z -= 10
		@command_window.visible = false
		if $game_party.actors.size == 0
			@command_window.disable_item(0)
			@command_window.disable_item(1)
			@command_window.disable_item(2)
			@command_window.disable_item(3)
		end
		if $game_system.save_disabled
			@command_window.disable_item(4)
		end
		@help_window = Window_Help.new
		@help_window.visible = false
		@help_window.back_opacity = 100
		@status_window = Window_MenuStatus.new
		@play_window = Window_Play.new
		if $itemdrop_enabled
			@itemdrop = Window_Command.new(160, ["Basilare", "Equipaggiamento", "Cerca"])
		else
			@itemdrop = Window_Base.new(240, 144, 160, 128)
		end
		@itemdrop.x = 240
		@itemdrop.y = 144
		@itemdrop.z -= 5
		@itemdrop.active = false
		@itemdrop.opacity = 0
		@itemdrop.contents_opacity = 0
		Graphics.transition
		loop do
			Graphics.update
			Input.update
			if @status_window.y > 0
				@status_window.y -= 16
				@status_window.height += 32
				@play_window.y -= 16
				@play_window.height += 32
			else
				@command_window.visible = true
				unless @refreshed
					@status_window.refresh
					@refreshed = true
				end
				update
				if @resize_item
					if @bg_window.width < 640
						@bg_window.x -= 16
						@bg_window.width += 32
					else
						@resize_item = false
						if $itemdrop_enabled
							@item_window = Window_Item.new(@itemdrop.index + 20)
						else
							@item_window = Window_Item.new
						end
						@item_window.help_window = @help_window
						@item_window.active = true
						@item_window.x = 0
						@item_window.contents_opacity = 255
						@item_window.back_opacity = 100
						@item_window.opacity = 255
						@target_window = Window_Target.new
						@target_window.active = false
						@target_window.x = 320
						@target_window.contents_opacity = 255
						@target_window.opacity = 255
						unless $ipm_enabled
							@target_window.visible = false
						end
						if $itemdrop_enabled
							if @itemdrop.index + 20 > 20
								@item_window.width = 640
								@item_window.column_max = 2
								@target_window.visible = false
							end
						end
						@help_window.visible = true
						@itemdrop.opacity = 0
						@itemdrop.contents_opacity = 0
					end
				end
				if @resize_skill
					if @bg_window.width < 640
						@bg_window.x -= 16
						@bg_window.width += 32
					else
						@resize_skill = false
						@actor = $game_party.actors[@status_window.index]
						@skillstatus_window = Window_SkillStatus.new(@actor)
						@skillstatus_window.contents_opacity = 255
						@skillstatus_window.back_opacity = 100
						@skillstatus_window.opacity = 255
						@skillstatus_window.x = 0
						@skill_window = Window_Skill.new(@actor)
						@skill_window.help_window = @help_window
						@skill_window.contents_opacity = 255
						@skill_window.back_opacity = 100
						@skill_window.opacity = 255
						if $ipm_enabled
							@skill_window.y = 184
							@skilltarget_window = Window_Target.new(@status_window.index)
						else
							@skill_window.y = 128
							@skilltarget_window = Window_Target.new
						end
						@skilltarget_window.active = false
						@skilltarget_window.contents_opacity = 255
						@skilltarget_window.opacity = 255
						@skilltarget_window.x = 320
						@help_window.visible = true
						unless $ipm_enabled
							@skilltarget_window.visible = false
						end
					end
				end
				if @resize_equip
					if @bg_window.width < 640
						@bg_window.x -= 16
						@bg_window.width += 32
					else
						@resize_equip = false
						@actor = $game_party.actors[@status_window.index]
						@equiphelp_window = Window_Help.new
						@equiphelp_window.back_opacity = 100
						@left_window = Window_EquipLeft.new(@actor)
						@left_window.contents_opacity = 255
						@left_window.back_opacity = 100
						@left_window.opacity = 255
						@left_window.x = 0
						@right_window = Window_EquipRight.new(@actor)
						@right_window.help_window = @equiphelp_window
						@right_window.index = @equip_index
						@right_window.contents_opacity = 255
						@right_window.back_opacity = 100
						@right_window.opacity = 255
						@right_window.y = 64
						@item_window1 = Window_EquipItem.new(@actor, 0)
						@item_window2 = Window_EquipItem.new(@actor, 1)
						@item_window3 = Window_EquipItem.new(@actor, 2)
						@item_window4 = Window_EquipItem.new(@actor, 3)
						@item_window5 = Window_EquipItem.new(@actor, 4)
						@item_window1.help_window = @equiphelp_window
						@item_window2.help_window = @equiphelp_window
						@item_window3.help_window = @equiphelp_window
						@item_window4.help_window = @equiphelp_window
						@item_window5.help_window = @equiphelp_window
						@item_window1.back_opacity = 100
						@item_window2.back_opacity = 100
						@item_window3.back_opacity = 100
						@item_window4.back_opacity = 100
						@item_window5.back_opacity = 100
						if $ipm_enabled
							@commands = ["Equippaggia", "Opzionale", "Rimuovi", "Svuota", "Annulla"]
							@equip_window = Window_SideCommand.new(@commands)
							@equip_window.back_opacity = 100
							@equip_window.height = 64
							@equiphelp_window.y = 416
							@right_window.index = -1
							@blank_window = Window_Base.new(272, 256, 368, 160)
							@blank_window.active = false
							@blank_window.back_opacity = 100
						end
						equip_refresh
					end
				end
				if @resize_status
					if @bg_window.width < 448
						@bg_window.x -= 16
						@bg_window.width += 32
					elsif @bg_window.width < 640 and not $ipm_enabled
						@bg_window.x -= 16
						@bg_window.width += 32
					else
						@resize_status = false
						@actor = $game_party.actors[@status_window.index]
						@playerstatus_window = Window_Status.new(@actor)
						@playerstatus_window.contents_opacity = 255
						@playerstatus_window.opacity = 255
						@playerstatus_window.y = 0
					end
				end
				if @resize_save
					if @help_window.x < 0
						@help_window.x += 64
						@savefile_windows[0].x -= 64
						@savefile_windows[1].x += 64
						@savefile_windows[2].x -= 64
						@savefile_windows[3].x += 64
					else
						@resize_save = false
						@savefile_windows_active = true
					end
				end
				if @resize_back
					@status_window.index = -1
					if @bg_window.width > 0
						@bg_window.x += 16
						@bg_window.width -= 32
					else
						@resize_back = false
						@command_window.active = true
					end
				end
			end
			if $scene != self
				break
			end
		end
		@bg_window.dispose
		@command_window.dispose
		@help_window.dispose
		@status_window.cursor_rect.empty
		@status_window.contents.clear
		@status_window.contents = nil
		@play_window.contents.clear
		@play_window.contents = nil
		for i in 0..20
			@status_window.y += 16
			@status_window.height -= 32
			@play_window.y += 16
			@play_window.height -= 32
			@itemdrop.opacity -= 25
			@itemdrop.contents_opacity -= 25
			Graphics.update
		end
		Graphics.freeze
		# @sprite.dispose
		@status_window.dispose
		@itemdrop.dispose
	end
	#-----------------------------------------------------------------------------
	# @ Update the scene
	#-----------------------------------------------------------------------------
	def update
		@help_window.update
		@command_window.update
		@status_window.update
		@play_window.update
		@play_window.refresh
		@itemdrop.update
		if @command_window.active
			update_command
			return
		end
		if @status_window.active
			update_status
			return
		end
		if @itemdrop.active
			update_itemdrop
			return
		end
		if @item_window != nil
			@item_window.update
			@target_window.update
			if @item_window.active
				update_item
				return
			end
			if @target_window.active
				update_target
				return
			end
		end
		if @skill_window != nil
			@skill_window.update
			@skillstatus_window.update
			@skilltarget_window.update
			if @skill_window.active
				update_skill
				return
			end
			if @skilltarget_window.active
				update_skilltarget
				return
			end
			if @skillstatus_window.active
				update_skillstatus
				return
			end
		end
		if @left_window != nil
			@equiphelp_window.update
			@left_window.update
			@right_window.update
			@eitem_window.update
			equip_refresh
			if $ipm_enabled
				@equip_window.update
				if @equip_window.active
					update_equip
					return
				end
			end
			if @right_window.active
				update_right
				return
			end
			if @eitem_window.active
				update_eitem
				return
			end
		end
		if @playerstatus_window != nil
			@playerstatus_window.update
			update_playerstatus
		end
		if @savefile_windows != nil
			@help_window.update
			for i in @savefile_windows
				i.update
			end
			if @savefile_windows_active
				update_save
			end
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the command window
	#-----------------------------------------------------------------------------
	def update_command
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			$scene = Scene_Map.new
			return
		end
		if Input.trigger?(Input::C)
			if $game_party.actors.size == 0 and @command_window.index < 4
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			case @command_window.index
			when 0
				$game_system.se_play($data_system.decision_se)
				if $itemdrop_enabled
					loop do
						if @itemdrop.opacity < 250
							@itemdrop.opacity += 25
							@itemdrop.contents_opacity += 25
						else
							break
						end
						Graphics.update
					end
					@command_window.active = false
					@itemdrop.active = true
					return
				end
				@command_window.active = false
				@resize_item = true
			when 1
				$game_system.se_play($data_system.decision_se)
				@command_window.active = false
				@status_window.active = true
				@status_window.index = 0
			when 2
				$game_system.se_play($data_system.decision_se)
				@command_window.active = false
				@status_window.active = true
				@status_window.index = 0
			when 3
				$game_system.se_play($data_system.decision_se)
				@command_window.active = false
				@status_window.active = true
				@status_window.index = 0
			when 4
				if $game_system.save_disabled
					$game_system.se_play($data_system.buzzer_se)
					return
				end
				$game_system.se_play($data_system.decision_se)
				@help_window.set_text("Dove vuoi salvare??", 1)
				@help_window.back_opacity = 255
				@help_window.x = -640
				@savefile_windows = []
				for i in 0..3
					if $ipm_enabled
						@savefile_windows.push(Window_Save.new(i))
					else
						@savefile_windows.push(Window_SaveFile.new(i, nil))
					end
					@savefile_windows[i].back_opacity = 255
					@savefile_windows[i].opacity = 255
				end
				@file_index = $game_temp.last_file_index
				@savefile_windows[@file_index].selected = true
				@savefile_windows[0].x = 640
				@savefile_windows[1].x = -640
				@savefile_windows[2].x = 640
				@savefile_windows[3].x = -640
				@command_window.active = false
				@resize_save = true
			when 5
				$game_system.se_play($data_system.decision_se)
				$scene = Scene_End.new
			end
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the status window
	#-----------------------------------------------------------------------------
	def update_status
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@command_window.active = true
			@status_window.active = false
			@status_window.index = -1
			return
		end
		if Input.trigger?(Input::C)
			@actor_index = @status_window.index
			case @command_window.index
			when 1
				if $game_party.actors[@status_window.index].restriction >= 2
					$game_system.se_play($data_system.buzzer_se)
					return
				end
				$game_system.se_play($data_system.decision_se)
				@status_window.active = false
				@resize_skill = true
			when 2
				$game_system.se_play($data_system.decision_se)
				@status_window.active = false
				@resize_equip = true
			when 3
				$game_system.se_play($data_system.decision_se)
				@status_window.active = false
				@resize_status = true
			end
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the itemdrop window
	#-----------------------------------------------------------------------------
	def update_itemdrop
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			loop do
				if @itemdrop.opacity > 0
					@itemdrop.opacity -= 25
					@itemdrop.contents_opacity -= 25
				else
					break
				end
				Graphics.update
			end
			@itemdrop.active = false
			@command_window.active = true
			return
		end
		if Input.trigger?(Input::C)
			$game_system.se_play($data_system.decision_se)
			@itemdrop.active = false
			@resize_item = true
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the item window
	#-----------------------------------------------------------------------------
	def update_item
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@item_window.dispose
			@target_window.dispose
			@item_window = nil
			@target_window = nil
			@help_window.visible = false
			@resize_back = true
			return
		end
		if Input.trigger?(Input::C)
			@item = @item_window.item
			unless @item.is_a?(RPG::Item)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			unless $game_party.item_can_use?(@item.id)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			$game_system.se_play($data_system.decision_se)
			if @item.scope >= 3
				@item_window.active = false
				unless $ipm_enabled
					@target_window.x = (@item_window.index + 1) % 2 * 304
					@target_window.visible = true
				end
				@target_window.active = true
				if @item.scope == 4 || @item.scope == 6
					@target_window.index = -1
				else
					@target_window.index = 0
				end
			else
				if @item.common_event_id > 0
					$game_temp.common_event_id = @item.common_event_id
					$game_system.se_play(@item.menu_se)
					if @item.consumable
						$game_party.lose_item(@item.id, 1)
						@item_window.draw_item(@item_window.index)
					end
					$scene = Scene_Map.new
					return
				end
			end
			return
		end
		if Input.trigger?(Input::R) and $itemdrop_enabled
			$game_system.se_play($data_system.cursor_se)
			@itemdrop.index = (@itemdrop.index + 1) % 3
			@item_window.dispose
			@target_window.dispose
			@resize_item = true
			return
		end
		if Input.trigger?(Input::L) and $itemdrop_enabled
			$game_system.se_play($data_system.cursor_se)
			@itemdrop.index = (@itemdrop.index + 2) % 3
			@item_window.dispose
			@target_window.dispose
			@resize_item = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the target window
	#-----------------------------------------------------------------------------
	def update_target
		if $game_party.item_number(@item.id) == 0
			@target_window.active = false
			@item_window.refresh
			@item_window.active = true
			unless $ipm_enabled
				@target_window.visible = false
			end
			return
		end
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			unless $game_party.item_can_use?(@item.id)
				@item_window.refresh
			end
			@item_window.active = true
			unless $ipm_enabled
				@target_window.visible = false
			end
			@target_window.active = false
			return
		end
		if Input.trigger?(Input::C)
			if $game_party.item_number(@item.id) == 0
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			if @target_window.index == -1
				used = false
				for i in $game_party.actors
					used |= i.item_effect(@item)
				end
			end
			if @target_window.index >= 0
				target = $game_party.actors[@target_window.index]
				used = target.item_effect(@item)
			end
			if used
				$game_system.se_play(@item.menu_se)
				if @item.consumable
					$game_party.lose_item(@item.id, 1)
					@item_window.draw_item(@item_window.index)
				end
				@target_window.refresh
				if $game_party.all_dead?
					$scene = Scene_Gameover.new
					return
				end
				if @item.common_event_id > 0
					$game_temp.common_event_id = @item.common_event_id
					$scene = Scene_Map.new
					return
				end
			end
			unless used
				$game_system.se_play($data_system.buzzer_se)
			end
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the skill window
	#-----------------------------------------------------------------------------
	def update_skill
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@skill_window.dispose
			@skillstatus_window.dispose
			@skilltarget_window.dispose
			@skill_window = nil
			@skillstatus_window = nil
			@skilltarget_window = nil
			@help_window.visible = false
			@resize_back = true
			return
		end
		if Input.trigger?(Input::C)
			@skill = @skill_window.skill
			if @skill == nil or not @actor.skill_can_use?(@skill.id)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			$game_system.se_play($data_system.decision_se)
			if @skill.scope >= 3
				@skill_window.active = false
				unless $ipm_enabled
					@skilltarget_window.x = (@skill_window.index + 1) % 2 * 304
					@skilltarget_window.visible = true
				end
				@skilltarget_window.active = true
				if @skill.scope == 4 || @skill.scope == 6
					@skilltarget_window.index = -1
					if $ipm_enabled
						@skillstatus_window.selected = true
						@skillstatus_window.active = true
					end
				elsif @skill.scope == 7
					if $ipm_enabled
						@skillstatus_window.selected = true
						@skillstatus_window.active = true
					else
						@skilltarget_window.index = @actor_index - 10
					end
				else
					@skilltarget_window.index = 0
				end
			else
				if @skill.common_event_id > 0
					$game_temp.common_event_id = @skill.common_event_id
					$game_system.se_play(@skill.menu_se)
					@actor.sp -= @skill.sp_cost
					@skillstatus_window.refresh
					@skill_window.refresh
					@skilltarget_window.refresh
					$scene = Scene_Map.new
					return
				end
			end
			return
		end
		if Input.trigger?(Input::R)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index+1)%$game_party.actors.size
			@skill_window.dispose
			@skillstatus_window.dispose
			@skilltarget_window.dispose
			@resize_skill = true
			return
		end
		if Input.trigger?(Input::L)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index-1)%$game_party.actors.size
			@skill_window.dispose
			@skillstatus_window.dispose
			@skilltarget_window.dispose
			@resize_skill = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the skill target window
	#-----------------------------------------------------------------------------
	def update_skilltarget
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@skill_window.active = true
			@skilltarget_window.active = false
			if $ipm_enabled
				@skillstatus_window.selected = false
				@skillstatus_window.active = false
			else
				@skilltarget_window.visible = false
			end
			return
		end
		if Input.trigger?(Input::C)
			unless @actor.skill_can_use?(@skill.id)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			if @skilltarget_window.index == -1
				used = false
				for i in $game_party.actors
					used |= i.skill_effect(@actor, @skill)
				end
			end
			if @skilltarget_window.index <= -2
				target = $game_party.actors[@skilltarget_window.index + 10]
				used = target.skill_effect(@actor, @skill)
			end
			if @skilltarget_window.index >= 0
				if @skilltarget_window.index >= @actor_index and $ipm_enabled
					target = $game_party.actors[@skilltarget_window.index + 1]
				else
					target = $game_party.actors[@skilltarget_window.index]
				end
				used = target.skill_effect(@actor, @skill)
			end
			if used
				$game_system.se_play(@skill.menu_se)
				@actor.sp -= @skill.sp_cost
				@skillstatus_window.refresh
				@skill_window.refresh
				@skilltarget_window.refresh
				if $game_party.all_dead?
					$scene = Scene_Gameover.new
					return
				end
				if @skill.common_event_id > 0
					$game_temp.common_event_id = @skill.common_event_id
					$scene = Scene_Map.new
					return
				end
			end
			unless used
				$game_system.se_play($data_system.buzzer_se)
			end
			return
		end
		if $ipm_enabled
			if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
				$game_system.se_play($data_system.cursor_se)
				@skilltarget_window.active = false
				@skillstatus_window.active = true
				@skillstatus_window.selected = true
				return
			end
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the skill status window
	#-----------------------------------------------------------------------------
	def update_skillstatus
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@skill_window.active = true
			@skilltarget_window.active = false
			@skillstatus_window.selected = false
			return
		end
		if Input.trigger?(Input::C)
			unless @actor.skill_can_use?(@skill.id)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			if @skilltarget_window.index == -1
				used = false
				for i in $game_party.actors
					used |= i.skill_effect(@actor, @skill)
				end
			end
			if @skilltarget_window.index <= -2
				target = @actor
				used = target.skill_effect(@actor, @skill)
			end
			if @skilltarget_window.index >= 0
				target = @actor
				used = target.skill_effect(@actor, @skill)
			end
			if used
				$game_system.se_play(@skill.menu_se)
				@actor.sp -= @skill.sp_cost
				@skillstatus_window.refresh
				@skill_window.refresh
				@skilltarget_window.refresh
				if $game_party.all_dead?
					$scene = Scene_Gameover.new
					return
				end
				if @skill.common_event_id > 0
					$game_temp.common_event_id = @skill.common_event_id
					$scene = Scene_Map.new
					return
				end
			end
			unless used
				$game_system.se_play($data_system.buzzer_se)
			end
			return
		end
		if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
			if @skill.scope == 7
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			$game_system.se_play($data_system.cursor_se)
			@skillstatus_window.active = false
			@skillstatus_window.selected = false
			@skilltarget_window.active = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Refresh the equip screen
	#-----------------------------------------------------------------------------
	def equip_refresh
		unless @remove
			@item_window1.visible = (@right_window.index == 0)
			@item_window2.visible = (@right_window.index == 1)
			@item_window3.visible = (@right_window.index == 2)
			@item_window4.visible = (@right_window.index == 3)
			@item_window5.visible = (@right_window.index == 4)
		end
		item1 = @right_window.item
		case @right_window.index
		when -2
			@eitem_window = @blank_window
		when -1
			@eitem_window = @blank_window
		when 0
			@eitem_window = @item_window1
			newmode = 0
		when 1
			@eitem_window = @item_window2
			newmode = 1
		when 2
			@eitem_window = @item_window3
			newmode = 1
		when 3
			@eitem_window = @item_window4
			newmode = 1
		when 4
			@eitem_window = @item_window5
			newmode = 1
		end
		if @remove
			@eitem_window = @blank_window
		end
		if $ipm_enabled
			if newmode != @left_window.mode
				@left_window.mode = newmode
				@left_window.refresh
			end
			if @eitem_window.active or @remove
				if @eitem_window.active
					item2 = @eitem_window.item
				end
				last_hp = @actor.hp
				last_sp = @actor.sp
				old_atk = @actor.atk
				old_pdef = @actor.pdef
				old_mdef = @actor.mdef
				old_str = @actor.str
				old_dex = @actor.dex
				old_agi = @actor.agi
				old_int = @actor.int
				old_eva = @actor.eva
				@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
				new_atk = @actor.atk
				new_pdef = @actor.pdef
				new_mdef = @actor.mdef
				new_str = @actor.str
				new_dex = @actor.dex
				new_agi = @actor.agi
				new_int = @actor.int
				new_eva = @actor.eva
				@left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
				@left_window.changes[0] = new_atk - old_atk
				@left_window.changes[1] = new_pdef - old_pdef
				@left_window.changes[2] = new_mdef - old_mdef
				@left_window.changes[3] = new_str - old_str
				@left_window.changes[4] = new_dex - old_dex
				@left_window.changes[5] = new_agi - old_agi
				@left_window.changes[6] = new_int - old_int
				@left_window.changes[7] = new_eva - old_eva
				@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
				@actor.hp = last_hp
				@actor.sp = last_sp
				@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
				new_dex, new_agi, new_int, new_eva)
			else
				@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
			end
		else
			if @eitem_window.active
				item2 = @eitem_window.item
				last_hp = @actor.hp
				last_sp = @actor.sp
				@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
				new_atk = @actor.atk
				new_pdef = @actor.pdef
				new_mdef = @actor.mdef
				@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
				@actor.hp = last_hp
				@actor.sp = last_sp
				@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
			else
				@left_window.set_new_parameters(nil, nil, nil)
			end
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the equip command window
	#-----------------------------------------------------------------------------
	def update_equip
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@equiphelp_window.dispose
			@equip_window.dispose
			@left_window.dispose
			@right_window.dispose
			@blank_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@equiphelp_window = nil
			@equip_window = nil
			@left_window = nil
			@right_window = nil
			@blank_window = nil
			@item_window1 = nil
			@item_window2 = nil
			@item_window3 = nil
			@item_window4 = nil
			@item_window5 = nil
			@resize_back = true
			return
		end
		if Input.trigger?(Input::C)
			$game_system.se_play($data_system.decision_se)
			case @equip_window.index
			when 0
				@equip_window.active = false
				@right_window.active = true
				@right_window.index = @equip_index
			when 1
				optimize
				@left_window.refresh
				@right_window.refresh
				@item_window1.refresh
				@item_window2.refresh
				@item_window3.refresh
				@item_window4.refresh
				@item_window5.refresh
			when 2
				@remove = true
				@equip_window.active = false
				@right_window.active = true
				@right_window.index = @equip_index
			when 3
				for i in 0..4
					@actor.equip(i, 0)
				end
				@left_window.refresh
				@right_window.refresh
				@item_window1.refresh
				@item_window2.refresh
				@item_window3.refresh
				@item_window4.refresh
				@item_window5.refresh
			when 4
				@equiphelp_window.dispose
				@equip_window.dispose
				@left_window.dispose
				@right_window.dispose
				@blank_window.dispose
				@item_window1.dispose
				@item_window2.dispose
				@item_window3.dispose
				@item_window4.dispose
				@item_window5.dispose
				@equiphelp_window = nil
				@equip_window = nil
				@left_window = nil
				@right_window = nil
				@blank_window = nil
				@item_window1 = nil
				@item_window2 = nil
				@item_window3 = nil
				@item_window4 = nil
				@item_window5 = nil
				@resize_back = true
			end
			return
		end
		if Input.trigger?(Input::R)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index+1) % $game_party.actors.size
			@equiphelp_window.dispose
			@equip_window.dispose
			@left_window.dispose
			@right_window.dispose
			@blank_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@resize_equip = true
			return
		end
		if Input.trigger?(Input::L)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index-1) % $game_party.actors.size
			@equiphelp_window.dispose
			@equip_window.dispose
			@left_window.dispose
			@right_window.dispose
			@blank_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@resize_equip = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the right window
	#-----------------------------------------------------------------------------
	def update_right
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			if $ipm_enabled
				@right_window.active = false
				@equip_window.active = true
				if @right_window.index >= 0
					@equip_index = @right_window.index
				end
				@right_window.index = -1
				@remove = false
				@equiphelp_window.set_text("")
				@left_window.refresh
				return
			end
			@equiphelp_window.dispose
			@left_window.dispose
			@right_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@equiphelp_window = nil
			@left_window = nil
			@right_window = nil
			@item_window1 = nil
			@item_window2 = nil
			@item_window3 = nil
			@item_window4 = nil
			@item_window5 = nil
			@resize_back = true
			return
		end
		if Input.trigger?(Input::C)
			if @remove
				$game_system.se_play($data_system.decision_se)
				@actor.equip(@right_window.index, 0)
				@left_window.refresh
				@right_window.refresh
				return
			end
			if @actor.equip_fix?(@right_window.index)
				$game_system.se_play($data_system.buzzer_se)
				return
			end
			if $ipm_enabled
				if @eitem_window.data.size == 0
					$game_system.se_play($data_system.buzzer_se)
					return
				end
			end
			$game_system.se_play($data_system.decision_se)
			@right_window.active = false
			@eitem_window.active = true
			@eitem_window.index = 0
			return
		end
		if Input.trigger?(Input::R) and not $ipm_enabled
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index+1) % $game_party.actors.size
			@equiphelp_window.dispose
			@equip_window.dispose
			@left_window.dispose
			@right_window.dispose
			@blank_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@resize_equip = true
			return
		end
		if Input.trigger?(Input::L) and not $ipm_enabled
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index-1) % $game_party.actors.size
			@equiphelp_window.dispose
			@equip_window.dispose
			@left_window.dispose
			@right_window.dispose
			@blank_window.dispose
			@item_window1.dispose
			@item_window2.dispose
			@item_window3.dispose
			@item_window4.dispose
			@item_window5.dispose
			@resize_equip = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the equip item window
	#-----------------------------------------------------------------------------
	def update_eitem
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@right_window.active = true
			@eitem_window.active = false
			@eitem_window.index = -1
			return
		end
		if Input.trigger?(Input::C)
			$game_system.se_play($data_system.equip_se)
			item = @eitem_window.item
			@actor.equip(@right_window.index, item.id)
			@right_window.active = true
			@eitem_window.active = false
			@eitem_window.index = -1
			@right_window.refresh
			@eitem_window.refresh
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Optimize equipment (by RPGAdvocate)
	#-----------------------------------------------------------------------------
	def optimize
		object = $data_weapons[@actor.weapon_id]
		optimal = object.id
		current = 0.00
		if @actor.weapon_id != 0
			current = object.atk
		else
			optimal = 0
		end
		max_eval = current
		@actor.equip(0, 0)
		flag = false
		zero_flag = true
		for weapon in $data_weapons
			if !flag
				flag = true
				next
			end
			evaluation = weapon.atk
			if evaluation > 0
				zero_flag = false
			end
			if @actor.equippable?(weapon) &&
				$game_party.weapon_number(weapon.id) > 0 && evaluation > max_eval
				max_eval = evaluation
				optimal = weapon.id
			end
		end
		if zero_flag
			optimal = 0
		end
		@actor.equip(0, optimal)
		not_equipped = false
		for i in 1..4
			case i
			when 1
				if @actor.armor1_id == 0
					not_equipped = true
				else
					object = $data_armors[@actor.armor1_id]
				end
			when 2
				if @actor.armor2_id == 0
					not_equipped = true
				else
					object = $data_armors[@actor.armor2_id]
				end
			when 3
				if @actor.armor3_id == 0
					not_equipped = true
				else
					object = $data_armors[@actor.armor3_id]
				end
			when 4
				if @actor.armor4_id == 0
					not_equipped = true
				else
					object = $data_armors[@actor.armor4_id]
				end
			end
			optimal = object.id
			current = 0.00
			if not_equipped = false
				current = object.pdef * 0.75 + object.mdef * 0.25
			else
				optimal = 0
			end
			max_eval = current
			@actor.equip(i, 0)
			flag = false
			zero_flag = true
			for armor in $data_armors
				if !flag
					flag = true
					next
				end
				if armor.kind != i-1
					next
				end
				evaluation = armor.pdef * 0.75 + armor.mdef * 0.25
				if evaluation > 0
					zero_flag = false
				end
				if @actor.equippable?(armor) &&
					$game_party.armor_number(armor.id) > 0 && evaluation > max_eval
					max_eval = evaluation
					optimal = armor.id
				end
			end
			if zero_flag
				optimal = 0
			end
			@actor.equip(i, optimal)
		end
	end
	#----------------------------------------------------------------------------
	# @ Update the large status window
	#----------------------------------------------------------------------------
	def update_playerstatus
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			@playerstatus_window.dispose
			@playerstatus_window = nil
			@resize_back = true
			return
		end
		if Input.trigger?(Input::R)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index+1) % $game_party.actors.size
			@playerstatus_window.dispose
			@resize_status = true
			return
		end
		if Input.trigger?(Input::L)
			$game_system.se_play($data_system.cursor_se)
			@status_window.index = (@status_window.index-1) % $game_party.actors.size
			@playerstatus_window.dispose
			@resize_status = true
			return
		end
	end
	#-----------------------------------------------------------------------------
	# @ Update the save screen
	#-----------------------------------------------------------------------------
	def update_save
		if Input.trigger?(Input::C)
			$game_system.se_play($data_system.save_se)
			file = File.open("Save#{@file_index + 1}.rxdata", "wb")
			characters = []
			for i in 0...$game_party.actors.size
				actor = $game_party.actors[i]
				characters.push([actor.character_name, actor.character_hue])
			end
			Marshal.dump(characters, file)
			Marshal.dump(Graphics.frame_count, file)
			$game_system.save_count += 1
			$game_system.magic_number = $data_system.magic_number
			Marshal.dump($game_system, file)
			Marshal.dump($game_switches, file)
			Marshal.dump($game_variables, file)
			Marshal.dump($game_self_switches, file)
			Marshal.dump($game_screen, file)
			Marshal.dump($game_actors, file)
			Marshal.dump($game_party, file)
			Marshal.dump($game_troop, file)
			Marshal.dump($game_map, file)
			Marshal.dump($game_player, file)
			file.close
			@savefile_windows[@file_index].refresh
			$game_temp.last_file_index = @file_index
			for i in 0..10
				@help_window.x += 64
				@savefile_windows[0].x -= 64
				@savefile_windows[1].x += 64
				@savefile_windows[2].x -= 64
				@savefile_windows[3].x += 64
				Graphics.update
			end
			@savefile_windows_active = false
			@command_window.active = true
			@help_window.back_opacity = 100
			@help_window.visible = false
			@help_window.x = 0
			return
		end
		if Input.trigger?(Input::B)
			$game_system.se_play($data_system.cancel_se)
			for i in 0..10
				@help_window.x += 64
				@savefile_windows[0].x -= 64
				@savefile_windows[1].x += 64
				@savefile_windows[2].x -= 64
				@savefile_windows[3].x += 64
				Graphics.update
			end
			@savefile_windows_active = false
			@command_window.active = true
			@help_window.back_opacity = 100
			@help_window.visible = false
			@help_window.x = 0
			return
		end
		if Input.repeat?(Input::DOWN)
			if Input.trigger?(Input::DOWN) or @file_index < 3
				$game_system.se_play($data_system.cursor_se)
				@savefile_windows[@file_index].selected = false
				@file_index = (@file_index + 1) % 4
				@savefile_windows[@file_index].selected = true
				return
			end
		end
		if Input.repeat?(Input::UP)
			if Input.trigger?(Input::UP) or @file_index > 0
				$game_system.se_play($data_system.cursor_se)
				@savefile_windows[@file_index].selected = false
				@file_index = (@file_index + 3) % 4
				@savefile_windows[@file_index].selected = true
				return
			end
		end
	end
end#==============================================================================
# ¦ Wrap_Map V2
#------------------------------------------------------------------------------
#  By Dirtie.
#  Allows chosen map(s) to "wrap-around", ie. go continuously.
#  Just add "_wrap" to the end of the map name for the map you want to be wrapped.
#  Many thanks to Rataime for all the event code, Dubealex for helping me out,
#  Deke for the map checker script, and to everyone else that contributed.
#==============================================================================
#--------------------------------------------------------------------------
# ? CLASS Game_Temp (edit)
#      Script to check for "_wrap" in the map name.
#      This is taken and modified from Deke's Day/Night and Time System script.
#      If you would like to use something other than "_wrap" to check for,
#      change _wrap to whatever you want on lines 30 and 34
#--------------------------------------------------------------------------
class Game_Temp
	attr_reader    :map_infos
	attr_reader    :outside_array
	
	alias wrap_original_game_temp_initialize initialize
	
	def initialize
		wrap_original_game_temp_initialize
		@map_infos = load_data("Data/MapInfos.rxdata")
		@outside_array=Array.new
		for key in @map_infos.keys
			@outside_array[key]=@map_infos[key].name.include?("_wrap")
		end
		for key in @map_infos.keys
			@map_infos[key] = @map_infos[key].name
			@map_infos[key].delete!("_wrap")
		end
	end
end

#--------------------------------------------------------------------------
# ? CLASS Game_Map (edit)
#      First, sets up the variable "wrap" for use in the event script later.
#      Then checks to see if "_wrap" is in the map name;
#      If not, uses default scrolling options for respective edge of map.
#      If so, tells viewport to keep scrolling in the respective direction when actor is near edge of map.
#--------------------------------------------------------------------------
class Game_Map
	attr_accessor :wrap
	
	alias wrap_original_game_map_scroll_left scroll_left
	alias wrap_original_game_map_scroll_right scroll_right
	alias wrap_original_game_map_scroll_up scroll_up
	alias wrap_original_game_map_scroll_down scroll_down
	
	# Left
	def scroll_left(distance)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_game_map_scroll_left(distance)
		else
			@display_x = [@display_x - distance].max
		end
	end
	
	# Right
	def scroll_right(distance)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_game_map_scroll_right(distance)
		else
			@display_x = [@display_x + distance].min
		end
	end
	
	# Top
	def scroll_up(distance)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_game_map_scroll_up(distance)
		else
			@display_y = [@display_y - distance].max
		end
	end
	
	# Bottom
	def scroll_down(distance)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_game_map_scroll_down(distance)
		else
			@display_y = [@display_y + distance].min
		end
	end
end
#--------------------------------------------------------------------------
# ? CLASS Game_Player (edit)
#      Makes sure viewport stays centered on player, particularly when teleporting near edges.
#--------------------------------------------------------------------------
class Game_Player
	alias wrap_original_game_player_center center
	def center(x, y)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_game_player_center(x, y)
		else
			max_x = ($game_map.width + 20) * 128
			max_y = ($game_map.height + 15) * 128
			$game_map.display_x = [-20 * 128, [x * 128 - CENTER_X, max_x].min].max
			$game_map.display_y = [-15 * 128, [y * 128 - CENTER_Y, max_y].min].max
		end
	end
end
#--------------------------------------------------------------------------
# ? CLASS Check_Coordinates
#      Checks for coordinates and keyboard input, then teleports if conditions are met.
#--------------------------------------------------------------------------
class Check_Coordinates
	#------------------------------------------------------------------------
	# ? Handles left edge
	#------------------------------------------------------------------------
	def refresh_left
		unless $game_temp.outside_array[$game_map.map_id]
		else
			if $game_player.real_x == 0
				if Input.press?(Input::LEFT)
					def $game_player.passable?(x, y, d)
						return true
					end
					@left_trigger = true
				end
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Handles right edge
	#------------------------------------------------------------------------
	def refresh_right
		unless $game_temp.outside_array[$game_map.map_id]
		else
			@map_width_max = ($game_map.width - 1) * 128
			if $game_player.real_x == @map_width_max
				if Input.press?(Input::RIGHT)
					def $game_player.passable?(x, y, d)
						return true
					end
					@right_trigger = true
				end
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Handles top edge
	#------------------------------------------------------------------------
	def refresh_top
		unless $game_temp.outside_array[$game_map.map_id]
		else
			if $game_player.real_y == 0
				if Input.press?(Input::UP)
					def $game_player.passable?(x, y, d)
						return true
					end
					@top_trigger = true
				end
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Handles bottom edge
	#------------------------------------------------------------------------
	def refresh_bottom
		unless $game_temp.outside_array[$game_map.map_id]
		else
			@map_height_max = ($game_map.height - 1) * 128
			if $game_player.real_y == @map_height_max
				if Input.press?(Input::DOWN)
					def $game_player.passable?(x, y, d)
						return true
					end
					@bottom_trigger = true
				end
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Left teleport
	#------------------------------------------------------------------------
	def left_trigger
		if @left_trigger == true
			if $game_player.real_x == -128
				$game_player.moveto(($game_map.width - 1), $game_player.y)
				def $game_player.passable?(x, y, d)
					new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
					new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
					unless $game_map.valid?(new_x, new_y)
						return false
					end
					if $DEBUG and Input.press?(Input::CTRL)
						return true
					end
					super
				end
				@left_trigger = false
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Right teleport
	#------------------------------------------------------------------------
	def right_trigger
		if @right_trigger == true
			if $game_player.real_x == ($game_map.width * 128)
				$game_player.moveto(0, $game_player.y)
				def $game_player.passable?(x, y, d)
					new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
					new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
					unless $game_map.valid?(new_x, new_y)
						return false
					end
					if $DEBUG and Input.press?(Input::CTRL)
						return true
					end
					super
				end
				@right_trigger = false
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Top teleport
	#------------------------------------------------------------------------
	def top_trigger
		if @top_trigger == true
			if $game_player.real_y == -128
				$game_player.moveto($game_player.x, ($game_map.height - 1))
				def $game_player.passable?(x, y, d)
					new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
					new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
					unless $game_map.valid?(new_x, new_y)
						return false
					end
					if $DEBUG and Input.press?(Input::CTRL)
						return true
					end
					super
				end
				@top_trigger = false
			end
		end
	end
	#------------------------------------------------------------------------
	# ? Bottom teleport
	#------------------------------------------------------------------------
	def bottom_trigger
		if @bottom_trigger == true
			if $game_player.real_y == ($game_map.height * 128)
				$game_player.moveto($game_player.x, 0)
				def $game_player.passable?(x, y, d)
					new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
					new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
					unless $game_map.valid?(new_x, new_y)
						return false
					end
					if $DEBUG and Input.press?(Input::CTRL)
						return true
					end
					super
				end
				@bottom_trigger = false
			end
		end
	end
end
#--------------------------------------------------------------------------
# ? CLASS Sprite_Duplicate
#      A copy of the Sprite_Character class, with some adjustments made.
#      Used to create the duplicate event sprites.
#--------------------------------------------------------------------------
class Sprite_Duplicate < RPG::Sprite
	attr_accessor :character # @character is the original event
	def initialize(viewport, character = nil, x = 0, y = 0)
		@x = x
		@y = y
		super(viewport)
		@character = character
		@z=@character.screen_z
		update
	end
	def update
		super
		if @tile_id != @character.tile_id or
			@character_name != @character.character_name or
			@character_hue != @character.character_hue
			@tile_id = @character.tile_id
			@character_name = @character.character_name
			@character_hue = @character.character_hue
			if @tile_id >= 384
				self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue)
				self.src_rect.set(0, 0, 32, 32)
				self.ox = 16
				self.oy = 32
			else
				self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue)
				@cw = bitmap.width / 4
				@ch = bitmap.height / 4
				self.ox = @cw / 2
				self.oy = @ch
			end
		end
		self.visible = (not @character.transparent)
		if @tile_id == 0
			sx = @character.pattern * @cw
			sy = (@character.direction - 2) / 2 * @ch
			self.src_rect.set(sx, sy, @cw, @ch)
		end
		# The coordinates of the duplicate event sprite. They are relative to the original event,
		# so the duplicates will move and act as the original does; except the z coordinate,
		# as when the original sprite would be of range, the duplicate would not appear.
		self.x = @character.screen_x + @x
		self.y = @character.screen_y + @y
		self.z = @z
		self.opacity = @character.opacity
		self.blend_type = @character.blend_type
		self.bush_depth = @character.bush_depth
		if @character.animation_id != 0
			animation = $data_animations[@character.animation_id]
			animation(animation, true)
			@character.animation_id = 0
		end
	end
end
#--------------------------------------------------------------------------
# ? CLASS Sprite_Character (edit)
#      Used to create the duplicate sprites.
#--------------------------------------------------------------------------
class Sprite_Character < RPG::Sprite
	alias wrap_original_sprite_character_initialize initialize
	alias wrap_original_sprite_character_update update
	def initialize(viewport, character = nil)
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_sprite_character_initialize(viewport, character)
		else
			@character = character
			super(viewport)
			if $game_map.wrap == nil
				$game_map.wrap = []
			end
			# 8 duplicates are created, stored in the $game_map.wrap array
			if character.is_a?(Game_Event)
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, (-$game_map.width * 32), 0))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, 0, (-$game_map.height * 32)))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, ($game_map.width * 32), 0))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, 0, ($game_map.height * 32)))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, (-$game_map.width * 32), (-$game_map.height * 32)))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, ($game_map.width * 32), ($game_map.height * 32)))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, (-$game_map.width * 32), ($game_map.height * 32)))
				$game_map.wrap.push(Sprite_Duplicate.new(viewport, character, ($game_map.width * 32), (-$game_map.height * 32)))
			end
			wrap_original_sprite_character_initialize(viewport, @character)
		end
	end
	#------------------------------------------------------------------------
	# ? Updates each sprite in the $game_map.wrap array
	#------------------------------------------------------------------------
	def update
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_sprite_character_update
		else
			wrap_original_sprite_character_update
			if $game_map.wrap != [] and character.is_a?(Game_Player)
				for duplicate in $game_map.wrap
					if duplicate != nil
						duplicate.update
					end
				end
			end
		end
	end
end
#--------------------------------------------------------------------------
# ? CLASS Spriteset_Map (edit)
#      Prevents "disposed sprite" errors
#--------------------------------------------------------------------------
class Spriteset_Map
	alias wrap_original_spriteset_map_initialize initialize
	def initialize
		$game_map.wrap=nil
		wrap_original_spriteset_map_initialize
	end
end
#--------------------------------------------------------------------------
# ? CLASS Scene_Save (edit)
#      Prevent save errors
#--------------------------------------------------------------------------
class Scene_Save < Scene_File
	
	alias wrap_original_scene_save_write_save_data write_save_data
	
	def write_save_data(file)
		$game_map.wrap = nil
		wrap_original_scene_save_write_save_data(file)
	end
end
#--------------------------------------------------------------------------
# ? CLASS Scene Map (edit)
#      Initiates a loop for the methods of the Check_Coordinates class
#--------------------------------------------------------------------------
class Scene_Map
	$coordinate_check = Check_Coordinates.new
	alias wrap_original_scene_map_update update
	def update
		unless $game_temp.outside_array[$game_map.map_id]
			wrap_original_scene_map_update
		else
			$coordinate_check.refresh_left
			$coordinate_check.refresh_right
			$coordinate_check.refresh_top
			$coordinate_check.refresh_bottom
			$coordinate_check.left_trigger
			$coordinate_check.right_trigger
			$coordinate_check.top_trigger
			$coordinate_check.bottom_trigger
			wrap_original_scene_map_update
		end
	end
end

 

 

 

 

 

O_______________________________________________________O

(metà delle cose che fanno le faccio anch'io zizi)

(sto qua invece è un mostro....)

 

 

 

Link to comment
Share on other sites

Si può provare ad usare con il MODE07 script?

Almeno quando il pg tocca un bordo del mondo si ritrova all'altro capo.

Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli

2912.png

Link to comment
Share on other sites

Si può provare ad usare con il MODE07 script?

Almeno quando il pg tocca un bordo del mondo si ritrova all'altro capo.

Per ora no...stanno cercando di risolvere...cmq in teoria puoi sostituire tranquillamente lo script con un common event neanche troppo complicato...

Edited by Zerathul

 

 

 

O_______________________________________________________O

(metà delle cose che fanno le faccio anch'io zizi)

(sto qua invece è un mostro....)

 

 

 

Link to comment
Share on other sites

Per ora no...stanno cercando di risolvere...cmq in teoria puoi sostituire tranquillamente lo script con un common event neanche troppo complicato...

Certo,ma era per avere tutto in un unico pacchetto. :chirol_lovely:

Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli

2912.png

Link to comment
Share on other sites

  • 5 weeks later...
Grazie Alato ^^ avrei dovuto farlo io mi sa *me si sente in colpa*

 

 

 

O_______________________________________________________O

(metà delle cose che fanno le faccio anch'io zizi)

(sto qua invece è un mostro....)

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...