Set tileset B to E Counter flag to overwrite A

darkgriffin

Villager
Member
Joined
Sep 3, 2013
Messages
23
Reaction score
3
First Language
English
Primarily Uses
Quick explanation:  I need to figure out a way to get tileset B's "Counter" flag to overwrite any tile it is placed on, in order to make counters in HF1 work like they should.  By default, if a tileset B is set to "Counter", but the tile B is placed on a non-counter A tile, the A tile's settings takes priority.  

(It may in fact just be that RPG VX Ace is completely ignoring B-E when checking for counter flags, I haven't checked yet.)

Is there a quick fix I could do to make the counter flag on tileset B-E overwrite whatever A says is the "counter flag state" of a tile for event activation?  I can't think of any reason in the default setup why you wouldn't want that behavior, but apparently that's not how the default is working for me.  I just need the counter behavior to overwrite, I actually want to preserve the rest of the behaviors such as star tiles and such.

Longer explanation why I would need such a thing:

In the High Fantasy pack 1, the counter top tiles are a bit different.  They autotile like normal countertops, but then they have a special bottom shadow tile in tilesheet B to make it appear that they are a table instead of a floating slab of counter.

This B tile is placed on a floor tile from A, to make the illusion that the floor tile is covered by the bottom of the autotiled countertop.  The problem is that in the engine, it looks like this:

0 - Shopkeeper NPC event.

1 - Countertop tile on top tile, works like a countertop from vanilla.

2 - Floor tile just below it, with tile from B set to countertop.  Works like a normal wall due to B's collisions, but won't behave like a counter because it's either not checking on B's settings, or using A's(the floor) settings over whatever B says to do.

3 - Player, trying to activate shopkeeper, but because of tile in row 2, the game won't see the event.

(Forgive the lack of screenshot, it's so simple I don't feel like marking one up and figuring out where to upload the image just to show it.  If you really need one reply and I'll take a screenshot.  I know it's a bit confusing from the description above.)

I suppose I could always duplicate the events for the shopkeepers on the offending "not really a counter" tile, but that means the shopkeeper events would be unable to wander the map, for example.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,358
Reaction score
7,671
First Language
German
Primarily Uses
RMMV
Quick explanation:  I need to figure out a way to get tileset B's "Counter" flag to overwrite any tile it is placed on, in order to make counters in HF1 work like they should.  By default, if a tileset B is set to "Counter", but the tile B is placed on a non-counter A tile, the A tile's settings takes priority.
Unfortunately, your very first assumption is wrong.
By default, the settings for layer 2 (B to E tiles) HAVE precedence over the A tiles (that's the entire reason why for example the map passability breaks if the first B tile is not set to star). If you place a B tile with the counter flag somewhere, it WILL override any settings in A by default - I just tested it again to make sure that it works that way.


If that does not happen in your project, then either you're using the counter in a wrong way (even if the sprites are higher, the positioning is still where the feet of the sprite is, not on the tile above) or you installed a script that changed the default.


But the default is already "B-tiles take precedence over A-tiles", so your problem has to be somewhere else.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.


Show us a screenshot of your map.


As Andar said, they already work that way. One thing I can think of that might cause an issue is if the counter is more than one tile wide. If it's a wide counter (2 tiles), it won't work.
 

darkgriffin

Villager
Member
Joined
Sep 3, 2013
Messages
23
Reaction score
3
First Language
English
Primarily Uses
Ah, my mistake then.  The counter I am testing with is two tiles tall, so that may be why my tests didn't work.



As you can see, the tileset has the main countertop and then requires a "bottom" tile below.  Both the A countertop and the B tile on the bottom of the counter are set to "counter".  The start position is one space below where the player can stand before things look weird, so I need a minimum gap of two tiles to make a counter in this set.  If I let the player walk on the bottom tile, it works, but the player sprite looks really weird placed that far up.

Is there a way to extend the "reach" of the counter flag settings?  Like instead of just checking the tile ahead, check along a row till a non-counter tile is found, or until a certain limit(say, 5) is reached?

I'll try to look in the scripts myself, but I'm not too familiar with how the events are fired.  Guess it's time for some studying.

Edit after a quick lookover of the code:

Ok, this is by no means a good way of doing it.  But it's working and makes the counter above work(along with 3 space wide tables, another common thing with HF 2's table interiors).

Here's what I've got, a small change to Game_Player as an addon script.  Add below materials.  Goes without saying this will clash if you have something else changing the way events are triggered.

# Patch to map event trigger check to support wider counters# Script by darkgriffin# Free for commercial or non-commercial use, please credit.## Extends the Game_Player class, editing the way counter# events are triggered.###########################################################class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Determine if Front Event is Triggered #-------------------------------------------------------------------------- def check_event_trigger_there(triggers) x2 = $game_map.round_x_with_direction(@x, @direction) y2 = $game_map.round_y_with_direction(@y, @direction) start_map_event(x2, y2, triggers, true) return if $game_map.any_event_starting? return unless $game_map.counter?(x2, y2) x3 = $game_map.round_x_with_direction(x2, @direction) y3 = $game_map.round_y_with_direction(y2, @direction) start_map_event(x3, y3, triggers, true) #check one more tile further return unless $game_map.counter?(x3, y3) x4 = $game_map.round_x_with_direction(x3, @direction) y4 = $game_map.round_y_with_direction(y3, @direction) start_map_event(x4, y4, triggers, true) #check more tiles return unless $game_map.counter?(x4, y4) x5 = $game_map.round_x_with_direction(x4, @direction) y5 = $game_map.round_y_with_direction(y4, @direction) start_map_event(x5, y5, triggers, true) endendA simple loop would probably do it much better and could support customization in regards to length of tile to check, but for now this works, and gets the setup above working in game properly.  The loop version will have to wait till I can re-study how loops in ruby work.  It's been too long since I last coded, and I have a whole dungeon I'd rather be mapping instead. :p
 
Last edited by a moderator:

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
I am pretty sure counters only allow you to interact with an event that it is directly touching. So you adding two tiles of counters wouldn't let you interact with the event behind it.


Here's the easiest solution in the world; add an invisible event on top of the bottom counter that will handle the interaction with the NPC.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top