01-30-2024, 05:14 AM (This post was last modified: 05-26-2024, 04:00 AM by DerVVulfman.)
Copy Events XP Version: 1.4
Based on Fomar0153's RPGMaker VXAce script
Introduction
This script allows you to copy an event from one map to another. Please note this does not save them to a map, you will need to add them every time. You could use this to set pre-defined events within a repository map and copy them in on an auto event every time you enter the town for example.
Optionally, you could use it to create an army to chase characters in a map, copying one or two premade soldier events rather than manually produce the 10 or 20 soldiers. Another potential use would be eventers using it to help event systems where you copy in an all-purpose event into the map.
Script
The Script
Code:
#==============================================================================
# ** Copy Events XP
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.4
# 05-25-2024 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#------------------------------------------------------------------------------
# Based on Copy Events (for RPGMaker VXAce)
# by Fomar0153
# 01-08-2012 (mm/dd/yyyy)
#==============================================================================
#
# Introduction:
# =============
#
# This script allows you to copy an event from one map to another. Please note
# this does not save them to a map, you will need to add them every time. You
# could use this to set pre-defined events within a repository map and copy
# them in on an auto event every time you enter the town for example.
#
# Optionally, you could use it to create an army to chase characters in a map,
# copying one or two premade soldier events rather than manually produce the
# 10 or 20 soldiers. Another potential use would be eventers using it to help
# event systems where you copy in an all-purpose event into the map.
#
#------------------------------------------------------------------------------
#
# Script Call:
# ============
#
# $game_map.add_event_from_map(map_id, event_id, new_x, new_y)
# * map_id : the repository of the event to copy
# * event_id : the id of the event to copy
# * new_x : x-coordinate where to place the new event
# * new_y : y-coordinate where to place the new event
#
#------------------------------------------------------------------------------
#
# Remember:
# =========
#
# The events generated with this script are only temporary. While the events
# do stay on the map when you toggle between the field map and the main menu
# and/or the battle-system, and they do remain present within saved games,
# the events generated will vanish when you exit the field map and teleport
# into another.
#
#
#==============================================================================
#
# Terms and Conditions:
# =====================
#
# Free for use, even in commercial games. However, due credit is not just
# for me, but for Fomar0153 as well.
#
#==============================================================================
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Add an event from another map
# map_id : map with event to copy
# event_id : ID of event to copy
# x : x-coordinates to paste copy
# y : y-coordinates to paste copy
#--------------------------------------------------------------------------
def add_event_from_map(map_id, event_id, x, y)
map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
map.events.each do |i, event|
next unless event.id == event_id
j = event_next_id
event.id = j
event.x = x
event.y = y
e = Game_Event.new(@map_id, event)
@events[j] = e
@events[j].moveto(x,y)
$scene.spriteset.sprite_update(j)
return
end
end
#--------------------------------------------------------------------------
# * Acquire the next event ID in the array
#--------------------------------------------------------------------------
def event_next_id
keys = @events.keys
keys.sort!
key = keys[@events.length-1]
return key+1
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * update with a new sprite
# idx : index of the event in the map events hash array
#--------------------------------------------------------------------------
def sprite_update(idx)
sprite = Sprite_Character.new(@viewport1, $game_map.events[idx])
@character_sprites.push(sprite)
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :spriteset # spriteset
end
Instructions
Place below Scene_Debug and above Main. Use the one script call listed within the script to duplicate events to your heart's content.
Compatibility
This version is ported for RPGMaker XP. It was based upon the RPGMaker VXAce version by Fomar0153.
Credits and Thanks
Obviously thanks to Fomar0153 for the original RPGMaker VXAce script
Terms and Conditions
Free for use, even in commercial games. However, due credit is not just for me, but for Fomar0153 as well.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)