Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game::getCreatureByName slow for monsters #3302

Closed
2 tasks done
infister opened this issue Feb 7, 2021 · 3 comments · Fixed by #3333
Closed
2 tasks done

Game::getCreatureByName slow for monsters #3302

infister opened this issue Feb 7, 2021 · 3 comments · Fixed by #3333

Comments

@infister
Copy link

infister commented Feb 7, 2021

Before creating an issue, please ensure:

  • This is a bug in the software that resides in this repository, and not a
    support matter (use https://otland.net/forums/support.16/ for support)
  • This issue is reproducible without changes to the C++ code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

  1. create Lua script with Creature(“Monster Name”) on server with many monsters on the map

Expected behaviour

Actual behaviour

This look up takes very long time.

Environment

Reproduction environment

I suggest doing mappedMonsterNames to optimize the code.

@nekiro
Copy link
Member

nekiro commented Feb 7, 2021

I didn't even know you can do it by name, its pointless anyway, why would you try to obtain creature by name? You have Player() and Monster() respectively. You don't even have any guarantee of what monster it will be. I would even vote to just delete this as it's not needed at all.

@infister
Copy link
Author

infister commented Feb 7, 2021

Then remove it or fix it.

https://github.com/otland/forgottenserver/blob/master/data/talkactions/scripts/teleport_to_creature.lua

Use cases

  1. /goto monster
  2. Checking in a script if monster is on the map.

@soul4soul
Copy link
Contributor

Then remove it or fix it.

https://github.com/otland/forgottenserver/blob/master/data/talkactions/scripts/teleport_to_creature.lua

Use cases

1. /goto monster

2. Checking in a script if monster is on the map.

+1 for /goto monstername. I remember using it in a few scripts for single spawn monsters back in the day. Maybe those script could of been made differently but I was happy with what I was doing at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants