Way to make event impassable?

I need a way to make an event "impassable". Not just same level as character. I have a complex script checking passibility and I need it to take into account events that are on the same level as it.
What exactly do you mean by "Impassable"? You can't pass an event that is on the same level unless it has "Through" checked so why go more complex?
Yeah, you need to explain a little more about how the event is being used and how your script is using it, so we can understand.


By default, an event that is on the same level as the player is already impassable, and an event that's below or above the player is passable. The easiest way to make it impassable is to set it to same level.


I THINK, if your event graphic comes from the tileset, it will look at the passability of that tile on the tileset. I don't know whether the tile passability overrides the priority, or vice versa.
If by impassable, you mean an event that must happen. You can always create an event and set the event to autorun. At least, that's what I think you mean.
I don't think so. I think the OP is specifically looking at passability, based on use of words passability and level, and lack of terms like trigger.
I can provide more explicit details on what I'm trying to accomplish. Basically, I have a parallel process that uses Set Move Route to manipulate the position of another event. That event will check if a tile is passable using a conditional script check... if not, it moves in a different direction. The problem comes in with events that are situated on "passable" tiles, but are on the same level as the event that is moving around. This causes the parallel process to not register that location as impassable.

This directly ties in with my other thread regarding a treasure chest that runs away from the player as the player approaches it.

http://forums.rpgmakerweb.com/index.php?/topic/18257-how-to-make-a-trolling-treasure-chest/#entry176086

I want to add event puzzle obstacles like boulders that you must push, for instance. Currently, when my chest runs away from the player into another event, it isn't seeing that tile as impassable, so it doesn't factor it into it's movement calculation.

Any possible solution leads or ideas would be appreciated 😀
I assume for this you would need to have another script (or possibly use a built-in method) that checks if a tile is currently inhabited by an event. Then you would add this condition onto your current processes. I could probably come up with a roundabout solution to this, such as checking all valid event ID's for their location or proximity but if there's already one in place, that would be the simplest and most efficient way of going about this.
Are you familiar with what the script code would be to check if an event inhabits a location?
I checked out Game_Interpreter and found this:

$game_map.event_id_xy(x, y)

it's the method called when you use the "Get Location Info" and search for "Event ID".

Basically it'll return the ID of the event on a specific tile. If there is no event then it will simply be 0 or nil. So you can check if an event is at X, Y if you use the following as a condition:

$game_map.event_id_xy(x, y) != 0

replacing X and Y with variables of the location you want to check.
That sounds like it will do just the trick. Forgive me, I'm a bit of a scripting noob (which is probably why I should scale back the ambitions of my game a bit), but how might the correct syntax look?

For instance... I have ObjectX and ObjectY (variables 8 and 9) stored for Object. I want to check if the tile above Object contains an event. Would valid syntax be:

$game_map.event_id_xy($game_variables[8], $game_variables[9] - 1) != 0

If this is the case, then object cannot move up for there is an occupied event?
That should work just fine, it worked when I tested it out.

So if you were to use that in a conditional branch and its true, then there is an event occupying it.

An alternative, to be safe is to check if it IS zero instead of checking if it isnt, so you won't have to use the else field for the rest of the checks and commands.
Excellent, I'm sure that will work (I'm at work and am unable to implement at the moment). One challenge I neglected to think of is if there is additionally a way to check if the event is "Below Player", "Same as Player", or "Above Player". This will certainly affect the behavior of what I'm going for.

Thanks for your help thus-far!  😉
There are several passable? methods - one on Game_Map, one on Game_CharacterBase, and maybe even one on Game_Player (I don't have my editor open in front of me right now).


If you just use $game_map.events[id].passable?(...) - to use the Game_CharacterBase method rather than the Game_Map method - it already does a check to see if there's another event already at that location. You don't have to search for them yourself (but there is a Game_Map method to see if there's an event at an x,y location - I think it's called event_xy).


To see what the priority is, Game_CharacterBase has @priority_type that is attr_reader. 0 = below characters, 1 = same as characters, 2 = above characters.
Sorry, I can't seem to figure out the correct way to implement those checks (again, I am a bit of a script kiddy).

What would a line of code look like in a conditional branch script to check the priority of an event that is directly to the right of event 1?

My code is

$game_map.event_id_xy($game_map.events[1].x + 1, $game_map.events[1].y).instance_eval("priority_type == 1")
I wouldn't try and do it at all. When an event attempts to move, it already checks if the tile it's attempting to move to is passable. That check includes looking to see if there's already another event on that tile at the same priority.


I would just determine which direction you want to move in, save the x and y coordinates in temporary variables, execute a move_straight in the required direction, then compare the new x and y coordinates with the ones you've just saved. If they're the same, the move wasn't successful.


If you REALLY want to check before doing the move (and then have it check again WHILE doing the move, so you're double-processing), just do a $game_map.events[id].passable?($game_map.events[id].x, $game_map.events[id].y, d) where d is the direction you want to move, and id is the id (no leading zeros) of the event you're moving.
Genius. The middle paragraph was just the ticket. (passable did not take into account the priority of events, in my testing). Solved. Thanks everyone 🙂
That is because you probably used Game_Map.passable? instead of Game_CharacterBase.passable? which checks for a number of other things (I did explain this in my earlier post as well).


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
This is basically a continuation off of my previous thread:

http://forums.rpgmakerweb.com/index.php?/topic/18589-way-to-make-event-impassable/#entry179105

I'm trying to wrap my head around whether or not I can create a very specific script check.

Here's what the pseudo code would like like for a conditional branch:

Is there an event 1 tile north (-1 Y) from me? And Is it set to "through"?
If you need more help on a topic that's been closed, please report the topic and ask for it to be reopened, rather than starting a new one. People need to know what has already been discussed


Is "me" the player or another event?


Something like this should work:

Conditional Branch: Script: $game_map.events_xy(self.x, self.y - 1).size > 0 && $game_map.events_xy(self.x, self.y - 1)[0].throughIt says "where there is an event on the tile above, and where that event is set to through". If there happen to be several events on the tile above, it will only look at one of them.
where self needs to be either $game_player or $game_map.events[id] (so you would put $game_player.x or $game_map.events[id].x instead of putting self.x)
Your insight is proving most valuable, and showing me a bit more about how to use RGSS3.

Is there a way to check if a game variable is a whole number or not? I think if I get that, I will have 100% gotten my system working correctly.

Original thread: https://forums.rpgmakerweb.com/threads/way-to-make-event-impassable.18589/