ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.58k stars 360 forks source link

An event is not triggering if a player is boarding a ship #8834

Open Killbrum opened 2 weeks ago

Killbrum commented 2 weeks ago

Preliminary checks

Platform

Windows

Describe the bug

Greetings! Recently, I've encountered a weird case, and mainly, I assume that it's a bug. On Pirates Utopia map there is the event on the bottom right corner (the last pixel). It has to be triggered when some one teleports to the closes tile, spawns a boat, and onboards the boat (tricky case). Still, in my case, nothing happened. I assume because this logic is not handled (like even can occur if someone boarding a boat). PC hasn't reach that place at all.

I will try to upload correct save file soon

event

Save file

So far no save game, but I will try to add

Additional info

No response

oleg-derevenetz commented 2 weeks ago

Currently in fheroes2, both event and boat are "map objects", and there cannot be more than one object on the same tile at the same time (excluding the hero objects, because they are "special"). AI will not try to summon a boat here, because there is already an object on that tile. Logic for human players is a bit different (perhaps by mistake), and human players are allowed to summon a boat on that tile, but the result is that the boat object "overwrites" the event object, so there is no event object on that tile anymore after the boat summoning.

Killbrum commented 2 weeks ago

Ah, I see :( thanks for the explanation. Anyway, that is a good item to add to the "to-do" list since potentially it can break the logic of some old maps. Nowadays I'm not very familiar with fheroes2 code, but, perhaps, if the maps is a multidimensional array, then maybe we can convert that array to an array of lists or vectors and once the player steps into the tile - trigger everything that is under that tile

oleg-derevenetz commented 2 weeks ago

The fact that only one object can be placed on a tile at a time (even in the case of "invisible" objects, such as events) is the part of the core game mechanics. In the OG editor, you cannot place an event on a tile with the boat, and vice versa:

https://github.com/ihhub/fheroes2/assets/32623900/2a5e0e6f-5a0a-4e8e-a160-2a56f1f57305

Moreover, in the original game, the hero cannot disembark to a tile where an event object is located:

https://github.com/ihhub/fheroes2/assets/32623900/2e28492b-ab3e-4c78-8999-461bd22a8822

This is because the hero can only disembark on tiles where there is another "invisible" object called a "coast object", and you cannot have both the "event object" and "coast object" on the same tile at the same time. Therefore, I am inclined to believe that a human player simply should not be able to summon a boat to the tile on which the event object is located - just as AI cannot do it now.