Jump to content
CT Bolt

Events on Map 1.02

Recommended Posts

Events on Map 1.02
by CT_Bolt

Introduction
This script allows to return events to the position stored in the class.
This is useful when leaving the map and having the enemy stay where they were.

Features

  • Store the location of the event you want to keep its position.
  • Restore all the positions of the events you have stored.

Screenshots
Doesn't really need any. Just grab the demo.

Installing
To install the script, open you script editor and paste this script in a new section below the Materials & above Main Process.

How to Use
Use 'storeEvent' in a script call for the event you want to store the location of the event you want to keep its position.
Use 'setEventLocations' in a script call to restore all the positions of the events you have stored.

See DEMO for more details.

Demo
Events On Map (Demo).zip

Script

 

#==============================================================================
# ****************************** Events On Map ******************************
#------------------------------------------------------------------------------
# Author: CT_Bolt
#
# Version History:
#  v1.00 - 04.05.2012
#  v1.02 - 04.06.2012 (MapID Fix)
#------------------------------------------------------------------------------
# Description:
#  This script allows to return events to the position stored the class.
#  Useful when leaving the map and having the enemy stay where they where.
#------------------------------------------------------------------------------
# Compatibility:
#  No known issues.
#------------------------------------------------------------------------------
# Instructions:
#  To install the script, open you script editor and paste this script in
#  a new section below the Materials & above Main Process.
#
# How to use:
#  Use 'storeEvent' in a script call for the event you want
#  to store the location of the event you want to keep its position.
#
#  Use 'setEventLocations' in a script call to restore all the positions
#  of the events you have stored.
#
#  See DEMO for more details.
#==============================================================================
$enemyCount = 0
$enemyOnMap = {}
class Game_Interpreter
  alias mySetup setup unless $@
  def setup(list, event_id = 0)
		mySetup(list, event_id)
		$t = $game_map.events[@event_id]
  end
end
class Enemy_On_Map
  attr_accessor :mapID
  attr_accessor :eventID
  attr_accessor :x
  attr_accessor :y

  def initialize
		@mapID = 0
		@eventID = 0
		@x = 0
		@y = 0
  end

  def printInfo
		print "ID: ", @eventID, ", X = ", @x, ", Y = ", @y, "\n"
  end
end
def storeEvent
  $enemyOnMap[$enemyCount] = Enemy_On_Map.new
  $enemyOnMap[$enemyCount].eventID = $t.id
  $enemyOnMap[$enemyCount].mapID = $game_map.map_id
  $enemyOnMap[$enemyCount].x = $t.x
  $enemyOnMap[$enemyCount].y = $t.y
  $enemyCount = $enemyCount + 1
end
def setEventLocations
  i = 0
  while i < $enemyCount
		if ($enemyOnMap[i].mapID == $game_map.map_id)
		  $game_map.events[$enemyOnMap[i].eventID].moveto($enemyOnMap[i].x, $enemyOnMap[i].y)
		end
		i=i+1
  end
end

 



Author's Notes
Enjoy! B)

Edited by CT Bolt

Share this post


Link to post
Share on other sites

Neat! I like to have enemies as events rather than random battles, this should make things more interesting.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×