• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
CT Bolt

Events on Map 1.02

6 posts in this topic

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

I have fixed a big issue, when you have events stored on multiple maps v1.00 would error.

The problem is fixed in v1.02. :)

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.