Prevent movement in certain direction

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
Hi,

I want to have a wall in adjacent "ground" tiles, like in the screenshot below:

1685600682246.png

I can map the left and right side of the "cliff" to different regions, but the standard movement settings do not have something like "forbid move to direction 4" or something. Have also been staring at Archeia's wonderful script call list, but haven't found a solution yet. Any help greatly appreciated.
 

Kes

Regular
Regular
Joined
Aug 3, 2012
Messages
23,808
Reaction score
13,728
First Language
English
Primarily Uses
RMMZ
Go into the tileset tab of the data base. Select 'Passage (4 dir).
1685606203348.png

Now look at your tiles and you will see 4 little arrows on each tile, one for each direction. Click on the arrow for the edge you want to be impassable. For example:

1685606300028.png
With this setting the player can walk on the tiles as normal but cannot go over the edge.
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
Thanks for the reply! It's this tile and it doesn't seem to have obvious borders... although tileset Dungeon_A2 seems to show six separate variations, it's not clear to me which is which. I tried your suggestion, and it indeed works, but the lack of any visual cues is worrisome if I need to fix something in the layout, so I would like to continue looking for a solution involving regions.

1685615716107.png

EDIT: I think I found the part in rmmz_objects.js

Game_Map.prototype.isPassable = function(x, y, d) {
return this.checkPassage(x, y, (1 << (d / 2 - 1)) & 0x0f);
};

This is... brain crunch. Will have to study on this...
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,985
Reaction score
8,868
First Language
English
Primarily Uses
RMMV
The standard way to do this is to not use another floor there. Everything that isn't the actual ground level should be a ceiling tile above the wall (using the default Outside tileset, you're looking at Ledge B ).

If you use those tiles with shift-click mapping in the correct places, that will
- Have the visual side of the ledge intact so it looks right. Notice how your map is a bit Escher-looking because some parts of those floors are at different elevations but we can't tell
- Automatically prevent the player from crossing that ledge
Screenshot 2023-06-01 090844.png
 
Last edited:

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
Hi ATT_Turan,

Yes, I completely understand that what you describe is the standard way... however, now the issue between the code and me is personal :LZScheeze:

It seems that passability is determined by binaries, each direction (down, left, right, up) represented by 1, 2, 4, 8... meaning that allowing (or forbidding) all directions is 15...? Will experiment some more...
 

Bex

Regular
Regular
Joined
Aug 2, 2013
Messages
1,987
Reaction score
788
First Language
German
Primarily Uses
RMMZ
Iam not sure if i understand correctly, but here is the "Shift click Mapping" Tutorial,
maybe this helps to Place Tiles closer or differently together, like in the Picture you showed.
The broken example Pictures got restored further down in the Thread.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,958
First Language
English
Primarily Uses
RMMV
Why are you trying to do this via code? If you use the correct tiles, it will prevent you moving over the edges onto different "levels".
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
Because then I'd be limited by properties of the tileset. This will allow for so much more freedom, without having to worry about the "correct" tiles. But... I fully respect if the sentiment is not mutual. :eswt2:
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,291
Reaction score
11,475
First Language
German
Primarily Uses
RMMV
Your problem is exactly why some of the tile graphics are twice in the tilesets - to automatically simulate a two-level dungeon in a single level map.

That is why some of the tiles do not have the option to set directional passability - because that directional passability is automatically assigned to keep them seperate from the ground floor tiles that might look identical but are different tiles.

To be more precise the effect is on the so-called "ceiling" tiles, which is every second row on te A4-walls sheet.
If you have identically looking tiles in the A1, A2 and A5-sheets, those are always the true ground tiles.

This should help you with selecting the correct tiles when working with different levels, and as long as you do that the ceiling automatically gets the correct directional limit no matter how the form is - even giving the same tile different directional settings depending on what other tiles are next to it.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,958
First Language
English
Primarily Uses
RMMV
I'm just trying to decide if this needs to stay in MZ Support where you posted it, or if it needs to go into Plugin Support. You seem determined to do it via code, but I just don't understand why.

What you say you want to do in the first post is exactly what you can do using the tilesets as they are. So if that's not enough, then I think you haven't explained what the limitation is that you're trying to overcome.

You should also be aware that anything you change in Game_Map will affect events as well as your actors.

So, do you want this moved to plugin support?
 

Bex

Regular
Regular
Joined
Aug 2, 2013
Messages
1,987
Reaction score
788
First Language
German
Primarily Uses
RMMZ
How was that thingy called they use in Pixelmovement. Maybe that could help here?
The invisible passability Picture/Layer.
Everything in Red was not passable while the rest was.
Maybe you can use that without using the Pixelmovement?
But you would need to create a passability picture for every Map.
That could turn into more work and bigger Project Size.
I have no expirience with such passability masks.
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
I’m a little dumbfounded by the negativity here… wouldn’t it be wonderful if you could control this…? For example, this would allow creating vehicles that can only venture three tiles from the coast, or placing invisible walls…?
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
I'm just trying to decide if this needs to stay in MZ Support where you posted it, or if it needs to go into Plugin Support. You seem determined to do it via code, but I just don't understand why.

What you say you want to do in the first post is exactly what you can do using the tilesets as they are. So if that's not enough, then I think you haven't explained what the limitation is that you're trying to overcome.

You should also be aware that anything you change in Game_Map will affect events as well as your actors.

So, do you want this moved to plugin support?
Thanks, I’ll just stare at the code some little more, and if I need help making this into a plugin, I’ll post again.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,958
First Language
English
Primarily Uses
RMMV
How was that thingy called they use in Pixelmovement. Maybe that could help here?
The invisible passability Picture/Layer.
Collision maps?

this would allow creating vehicles that can only venture three tiles from the coast, or placing invisible walls
invisible walls can be done without delving into the code. A region restrictions plugin would allow vehicles to venture 3 tiles from the coast. But neither of those examples is what you talked about in your first post - stopping a player from moving in direction 4 (to the left).

The "negativity" is just that people don't understand what you're trying to do, and when they suggest ways to do what they think you're after, your answers don't really explain why their suggestions won't work. I'm sure it's just a communication problem.

I can map the left and right side of the "cliff" to different regions, but the standard movement settings do not have something like "forbid move to direction 4" or something
Is it this section of map (circled in red) that you're talking about? You want to stop the player moving right from their current position onto that next layer, but there isn't an edge to prevent them?
1685756875122.png
That would require the player being unable to move in direction 6, not 4, and that can still be done using the standard tiles without any code changes. The incorrect tile has been used here (either because you've used the A5 tile for the whole surface area, or because of the way the autotiles work - which is a pet peeve of mine with all engines after XP), and there is no 'edge'. You can simply draw with that autotile in a completely different section so it forces the edge on both sides, and use shift-mapping to copy it to the spot above so it would get the right tile, then erase what you drew in the other spot. It's not a method I like using, but it does achieve the desired effect. The other thing is, because you're using MZ and have full control over the layers, you could turn off auto-layering, select the next layer up, and draw those tiles (using the autotile). That will put the edge there.
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
It's actually the regions that have shadows drawn. These shadows are "fake" (not sure how it is in MV but in MZ you can draw them anywhere). The silly thing is that these sand-like tiles are "sort of" auto-tiles in that there seem to be slight variations available. However... they don't seem to make any difference in passability.

1685859657549.png

The solution to just give up on this mine-craftly design and just use part of the "outside" tiles does seem plausible, but placing them in (for example) the "D" tab of the tiles will not make them available as auto-tiles, and only six patterns are available (when in reality there are much more than six).

IN ANY CASE. I may have found a plugin (created by one Ponpoko Neruson) that seems to do what I need, althoough it's very basic with the code being this:

Code:
(function() {
var _game_MapcheckPassage = Game_Map.prototype.checkPassage;
Game_Map.prototype.checkPassage = function(x, y, bit) {
    if (this.regionPassage(x, y)) {return this.checkRegionPassage(x, y, bit)};
    return _game_MapcheckPassage.call(this, x, y, bit)
};
Game_Map.prototype.checkRegionPassage = function(x, y, bit) {
    if (this.regionPassage(x, y)){
        var flag = Number(this.regionPassage(x, y));
        if ((flag & bit) === 0){return true};   // [o] Passable
        if ((flag & bit) === bit){return false}; // [x] Impassable
        return false;
    }
};
Game_Map.prototype.regionPassage = function(x, y) {
    return $dataMap.meta[`RegPass${this.regionId(x, y)}`] || this.tileset().meta[`RegPass${this.regionId(x, y)}`];
};
})();
 

Bex

Regular
Regular
Joined
Aug 2, 2013
Messages
1,987
Reaction score
788
First Language
German
Primarily Uses
RMMZ
LOL, the shadows are realy fake? That is creative,i will remember thatone on my List with possible error causes :).
Did not think of that.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,958
First Language
English
Primarily Uses
RMMV
okay, I understand now. The shadows made me think you'd used the correct tiles in those areas, but you haven't.

Shift mapping will let you set the passability on those edges without needing a plugin.
 
  • Like
Reactions: Bex

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,985
Reaction score
8,868
First Language
English
Primarily Uses
RMMV
I’m a little dumbfounded by the negativity here…
No one here is being mean to you, but you keep talking like this is some kind of draconian limitation being imposed upon you by the engine, and you're trying to delve into the code instead of just using what most of us consider to be basic mapping techniques :wink:

The solution to just give up on this mine-craftly design and just use part of the "outside" tiles does seem plausible
I only referenced the outside tileset because that's what I thought you were using. There are direct analogs already in the dungeon tileset. I used Ground A for the ground and Ledge A with its ceiling for the elevations. (you can see the names of the tiles when you mouse over the selection pane and look at the bottom left corner of the window)

See? Visible edges to the ledges and the movement blocking is done automatically.

Screenshot 2023-06-04 231036.png

I didn't take the time to draw in the shadows, but you get the idea.
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
372
Reaction score
209
First Language
EN/JP/NL
Primarily Uses
RMMZ
Hmmm... guess I'll just shuffle around with the tiles and redesign the dungeon. As a completely personal problem, the tiles that you showed in your demo, I have set to "star" (i.e. can crawl underneath) to have some 2.5D-ish effect.

In any case, I wasn't saying that the restrictions are "draconian" in any way and I apologize if that's how it came across. It's just that being able to freely change (or overwrite) a tile's properties on the fly would seem extremely cool to me. Creating your own tilesets would be much, much more work, after all!
 

Latest Threads

Latest Posts

Latest Profile Posts

Just remembered one of my favorite albums as a teenager. It's amazing how music can take you back.
so what happens when i take my in-progress beach tile, and add this grayscale crystal tile i made? perhaps the ocean version of my sparkly river water? im tired though, so we'll have to figure that out tomorrow xD

RPGMV_3Jwu9i361J.png + Photoshop_cVgbzuXnew.png = Game_RvlSCEtQCy.gif ??
The downside to wearing my work clothes: When it rains heavily like a monsoon outside... the water renders my clothes basically transparent. It's... an adventure to get home like that, to say the least. Thankfully, it doesn't rain here that often.
Colored the wallpaper in :)
Panoris-Wallpaper-colored.png
a quick walk through town

Forum statistics

Threads
134,728
Messages
1,250,123
Members
177,484
Latest member
TimeMage
Top