move event towards another event help?

Started by Susanm, August 10, 2011, 01:25:50 am

Previous topic - Next topic

Susanm

is it possible to move an event towards another event besides set event location? Set event location transport one event to another place instead of moving the event so is it possible to move an event towards another event?

jailuis

Ok ok wait :3 im a beginner as well as you but i'll try to help ^^. But first of all, can you explain yourself??  what do you mean by "moving an event towards another event". Because for example if you talk about a character moving from point A to B where a chest resides, you could always use the "Move Event" command i guess.. or setting a route.

Unless i understood wrong,  please explain better, and say wich RPG Maker you are using.

Susanm

August 10, 2011, 01:48:41 am #2 Last Edit: August 10, 2011, 02:04:13 am by Susanm
sorry i mean how do you make an event walk or move towards another event or to an events location?
like for example:

the only way an event can get to players location by movement is to have an event set to parallel process and set move event move towards player (repeated action) so within time, the specified event will eventually catch the player.... now is there a possible way to have the same method for an event to move towards another event(in random movement) location? Its like pathfinding... but instead an event has to chase another event thats already in random movement...
does that make any sense at all?

jailuis

Ok ok now I get what you mean.. For short, you want an event (X) to follow another event (Y) that is in random movement. So if "Y" goes right, up, right, down, "X" does the same. I really don't know how to actually make that work with random movement.. my only advice would be setting the same routes for both, but well, that is something u already knew >< 

OR you could also try using a variable.. I'll try to make that work, add me on msn (j_rojas94@hotmail.com) I'll try to do what u say :3 let's see if that works

Susanm

yes thats exactly it... event Y has to find event X when event X is in random movement... ya thats kinda easy to have both event set for the same route... but im making event X in random movement so u cant study his movement and event Y has to go chase event X... thats what im trying to figure out LoL... theres a pathfinding script by foreverzero... only problem is, it doesnt locate a random movement event... i tried using variables but i cant seem to get the event move to the specified events MAP X and Y's location

jailuis

Im actually trying with 2 var. First one is equal to Y coordinates for "Y" and second one is equal to X coordinates for "Y" also. Now "X" has 4 conditional branches, so when Var 1 adds one, the event moves one step right, and the same for other coordinates..

doesn't seem to work yet, but i'll try ^^ i know it must be posible xD

Susanm


jailuis

ok ok got something :D! they follow each other like caterpillar xD its that what you want???

Susanm

well i dont know about caterpillar cuz that would mean that event Y will never come into event X exact map location... what your saying is that event Y will do an exact move of event X? if so then both events wont come in contact with each other? i just want event Y to keep moving towards event X until event Y reaches event X map location.... both events could be on each on of the map... i just gotta find a way for event Y to keep moving towards event X location regardless event X is in random movement

jailuis

The caterpillar thing worked. But only when the events were one behind each other, so i'll just go from scratch again. Yes,they will come in contact if one has more speed than the other (tried this). But now i get what you say a bit more.. I'll  see what happens ^^ if we dont find anything (well we r both beginners xD) we may ask a moderator x3

Susanm

can you show me what you got so far so i can get a general idea of what your doing?

jailuis

The only thing i got it's a caterpillar working when event X starts next to/behind to/above event Y and both are facing the same direction. Nothing really useful... im actually trying with 4 variables, 2 for each event, so when Coor.X or Coor.Y on "Y" are lower/higher than "X", "X" gets closer to "Y" (hope you understand what i mean x3)

Susanm

im trying to do what your doing... kinda complex LoL

jailuis

August 10, 2011, 03:24:42 am #13 Last Edit: August 10, 2011, 03:33:23 am by jailuis
DID IT!!!!!

Ok so let me explain ^^

----------------------------
Spoiler: ShowHide

We will be using:
* 2 Events (Jake and Shawn)
* 4 Variables

What are we going to do:
* Jake will follow Shawn no matter where he goes.

Process:

------------------------

-Event 1: Shawn  (Set to Parallel Process)

-Variable 001 = Shawn - Coordinates X
-Variable 002 = Shawn - Coordinates Y
-Variable 003 = Jake - Coordinates X
-Variable 004 = Jake - Coordinates X
-Set Movement: Shawn = Random (Repeat Action)

-Conditional branch = Var 001 > Var 003
Set Movement: Jake = Move Right

-Conditional branch = Var 001 < Var 003
Set Movement: Jake = Move Left

-Conditional branch = Var 002 > Var 004
Set Movement: Jake = Move Down

-Conditional branch = Var 002 < Var 004
Set Movement: Jake = Move Up

---------------------------------------

-Event: Jake (Set to Parallel Process)

[This page will go blank. The other event will do the work.]


Well, so that's just it :3!! Hope i actually did what you wanted ^^!

Susanm

NO WAY really? lets see what you got? Hopefully its what im talking about?

jailuis

I edited my post, the spoiler there have the contents. It works just as you said (No matter where the event runs, the other one will follow him until their places are the same) i guess i could work it a little more so when they touch X thing happens, but at the moment, i wanna know that is what you wanted :)

Susanm

IMPRESSIVE!!! IT WORKED  :haha:  KUDO POINTS FOR YOU  :-*   THANKS A BUNCH FOR THE HELP SURELY APPRECIATED  :shy:

jailuis

Great!! ^^ Thank you :) tell me if you need anything else ^^

Susanm

how about range event? do you know how to detect range of Jake or Shawn? if such amount of tiles away then range will be true for conditional branch... do you know how to detect the range?

jailuis

Ok, you are working using event-coordinates, so range shouldn't be hard (I guess, don't really know) Anyways. I suppose that what you want right now is (for example) that when Jake is 4 tiles away from Shawn, he shouts "HI Shawn!!" or something like that?

Susanm

August 10, 2011, 04:22:49 am #20 Last Edit: August 10, 2011, 04:37:11 am by Susanm
yea exactly  how do u do that? how can i figure out Jake is 4 tiles away from shawn as a conditional branch key so Jake can say Hi to shawn

jailuis

Ok now this seems harder >< and don't know if it is posible without scripting (Something that im useless at :3) but I'll keep on trying. Altough it seems to be  really difficult as the final position to both is unknown, so there must be a way to relate the distance between them... I'll figure it out xD somehow :3

Susanm

Heres a script from foreverzero called event range conditions... only problem with this one is it only checks players distance to events... does not check distance from event to event and thats what im looking for


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Event Range Conditions
# Author: ForeverZer0
# Date: 5.1.2011
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Allows you to set up conditional branches in events that will be based off
#   the event's coordinates in relation to the player's coordinates without
#   having to create any variables for the X and Y of each.
#
#   Here are the new features you can use a conditional branch. Just type these
#   into the script box for the branch.
#
#   range?(RANGE, EVENT_ID) - Will be true if player is anywhere in the radius
#                             defined by RANGE from the event with EVENT_ID
#
#   on_screen?(EVENT_ID)    - Will be true if the event with EVENT_ID is within
#                             the visible screen
#
#   x_dist?(DIST, EVENT_ID) - Returns true if the player's x/y is within DIST
#            OR               of event's x/y with EVENT_ID. These are absolute
#   y_dist?(DIST, EVENT_ID)   values, meaning it doesn't matter which direction,
#                             it just uses the total distance in tiles for that
#                             axis. Use a DIST of 0 to check if that axis is
#                             equal.
#
#   player_above?(EVENT_ID) - Returns true when player is above event.
#   player_below?(EVENT_ID) - Returns true when player is below event.
#   player_right?(EVENT_ID) - Returns true when player is right of the event.
#   player_left?(EVENT_ID)  - Returns true when player is left of the event.
#
#   For all of these, if the conditional branch that is using them is within
#   the event that it applies to, you do not have to include the EVENT_ID, it
#   is assumed to be that event's ID unless otherwise defined.
#
#   You can use these as a condition for just about anything, such as having
#   an event say something, run away, or run toward the player if it is within a
#   specific distance, and it's much easier than using multiple branches and
#   game variables to set it up.
#
#   Remember that if you use a range condition with a parallel trigger, it will
#   continue to execute as long as the condition is met and if the player cannot
#   move during the event's code, the game will effectively be stuck.
#
# Compatability:
#
#   - You may encounter issues if using a Pixel Movement script, though it
#     should still work fine with an 8-Way Movement script. (Not tested)
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Interpreter
 
  def range?(range = 4, id = @event_id)
    e = $game_map.events[id]
    radius = (Math.hypot((e.x - $game_player.x), (e.y - $game_player.y))).abs
    return (radius <= range)
  end
 
  def on_screen?(id = @event_id)
    x, y = $game_map.events[id].real_x, $game_map.events[id].real_y
    return ((x - $game_map.display_x + 64) / 4).between?(0, 640) &&
      ((y - $game_map.display_y) / 4).between?(0, 480)
  end
 
  def x_dist?(distance = 0, id = @event_id)
    x_dif = ($game_map.events[id].x - $game_player.x).abs
    return (x_dif <= distance)
  end
 
  def y_dist?(distance = 0, id = @event_id)
    y_dif = ($game_map.events[id].y - $game_player.y).abs
    return (y_dif <= distance)
  end
 
  def player_above?(id = @event_id)
    return ($game_map.events[id].y > $game_player.y)
  end
 
  def player_below?(id = @event_id)
    return ($game_map.events[id].y < $game_player.y)
  end
 
  def player_right?(id = @event_id)
    return ($game_map.events[id].x < $game_player.x)
  end
 
  def player_left?(id = @event_id)
    return ($game_map.events[id].x > $game_player.x)
  end
end

jailuis

i know absolutly nothing about scripts BUT i can see that one is kind of simple... so it shouldn't be hard for someone to actually modify it. Im trying to, but i would recomend you to post what you need on the script request board, srry i cant be more helpful :/

Susanm

well thank you for trying anyhow will post in the board thank you =)  :-*