The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Valcos on February 28, 2007, 01:45:36 PM

Title: Is it possible? [Resolved]
Post by: Valcos on February 28, 2007, 01:45:36 PM
Is it possible that if you get into a sertain distance of an event the event will activate? Like in a mission when you have to follow  a guy to his base or its a sneaking mission.
Title: Re: Is it possible?
Post by: sabao on February 28, 2007, 01:57:18 PM
You could just add invisible events that activate that event when you touch them, if you're working on a sneaking game. I've done it before on RM2k.
Title: Re: Is it possible?
Post by: Valcos on February 28, 2007, 09:17:35 PM
Well I was think of more of a radius kind of thing...
Title: Re: Is it possible?
Post by: italianstal1ion on March 01, 2007, 05:44:07 AM
yeah, near fantastica's View Range events...I have to go find it now...

[in-post edit!]
It does exactly what you say, it was thought for events that spot you (pokemon) or events that the sounds get louder when you get closer, softer farther away etc..

#==============================================================================
# ** View Range Module
#==============================================================================
# Near Fantastica
# Version 4
# 29.11.05
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log("View Range", "Near Fantastica", 4, "29.11.05")

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state("View Range") == true
  module VR
    #----------------------------------------------------------------------------
    def VR.in_range?(element, object, range)
      x = (element.x - object.x) * (element.x - object.x)
      y = (element.y - object.y) * (element.y - object.y)
      r = x + y
      if r <= (range * range)
        return true
      else
        return false
      end
    end
    #----------------------------------------------------------------------------
    def VR.range(element, object)
      x = (element.x - object.x) * (element.x - object.x)
      y = (element.y - object.y) * (element.y - object.y)
      r = x + y
      r = Math.sqrt(r)
      return r.to_i
    end
  end
 
  #==============================================================================
  class Interpreter
    #----------------------------------------------------------------------------
    def event
      return $game_map.events[@event_id]
    end
  end
 
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end


Well, I'm pretty sure you don't have any idea what to do with this (i dont lol)
Heres his demo(watch out the one in there is v.2 and this script is v.4, im pretty sure the same event commands work in both...)
http://savefile.com/files/525231
Title: Re: Is it possible?
Post by: Valcos on March 01, 2007, 11:29:07 PM
Thanks!!! ;D This will help me out alot!!
Title: Re: Is it possible?
Post by: :) on March 01, 2007, 11:46:16 PM
if this is solved, add [RESOLVED] to topic title, but leave topic open in case others have questions/comments.
Title: Re: Is it possible?
Post by: Valcos on March 02, 2007, 12:00:16 AM
Ok.