forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Duplicate monster with the same name

Open luanluciano93 opened this issue 3 years ago • 4 comments

Explanation of what you want to do that is currently impossible

If I put two monsters with the same name and files in different locations, it doesn't give any error. For example: monster name="Test" file="monsters/test1.xml" monster name="Test" file="monsters/test2.xml"

Desired functionality

It would be interesting to show an error message in this case.

luanluciano93 avatar Feb 18 '22 21:02 luanluciano93

I think that is because there are cases where monsters can have same name (butterfly, horse etc), that is why we don't throw any error, what matters for the code if I'm not mistaken, is file name. That is the name we use in commands

EPuncker avatar Feb 19 '22 00:02 EPuncker

In the monsters.xml file even the horses and butterfly are differentiated ....

luanluciano93 avatar Feb 19 '22 02:02 luanluciano93

In the monsters.xml file even the horses and butterfly are differentiated ....

that was my fault to make them different on RME, not because of coding, but lets see what others think, I'm always open for new views

EPuncker avatar Feb 19 '22 04:02 EPuncker

@EPuncker They have to be different in monsters.xml the engine needs to uniquely identify each monster race. The name inside the .xml file is what is shown in game. The name of the file is meaningless.

The same is true for revscriptsys which can't have collisions with monsters.xml either or other revscriptsys monsters. The difference is with revscriptsys the unique name is defined when creating the monsters local mType = Game.createMonsterType("Butterfly (Red)") https://github.com/soul4soul/converted-tibiawiki-monster-data/blob/d6f48391acc93b2fe3bf948674d918bbe8b16225/tfs%20revscriptsys/Butterfly_(Red).lua#L1-L4

The names of the monsters placed with the map editor/in the spawn.xml file match the unique monster name. https://github.com/otland/forgottenserver/blob/master/data/world/forgotten-spawn.xml#L826

(Note this example is bad because the unique name of the butterfly don't match but they should)

soul4soul avatar Feb 19 '22 12:02 soul4soul