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

Crash using reload in spells #87

Closed
Peixonauta2 opened this issue Jun 20, 2021 · 13 comments · Fixed by #329
Closed

Crash using reload in spells #87

Peixonauta2 opened this issue Jun 20, 2021 · 13 comments · Fixed by #329
Labels
Area: Source Priority: Critical Represents a risk to live servers Status: Pending Review This PR or Issue requires a review Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@Peixonauta2
Copy link
Contributor

Describe the bug

The "/reload spell" command can cause server crash. This happens because monsters will begin to cast random spells and if one of those random spells require a player structure, the server will crash. This bug also happens if using revscripts spells and then reloading scripts.

How to Reproduce?

Set a monster to use any registered spell.
NOTE: The spell needs to be a registered spell (spells.xml or revscript spell) and not a configured spell at monster's file.
If the monster is using a register spell, such as sudden death rune, for example:
{name ="sudden death", interval = 2000, chance = 16, minDamage = -450, maxDamage = -550, range = 7, target = true}
It will begin to cast another spell.
If the monster is using a configured spell, such as a recreation of sudden death rune, for example:
{name ="combat", interval = 2000, chance = 16, type = COMBAT_PHYSICALDAMAGE, minDamage = -450, maxDamage = -550, range = 7, shootEffect = CONST_ANI_SUDDENDEATH, effect = CONST_ME_MORTAREA, target = true}
It will not cast another spell.

Give us all details to reproduce the behavior:

  1. Make sure that the monster that you are using to test it have a registered spell
  2. Use /reload spell (if using spells.xml to register the spell) or /reload scripts (if using revscripts to register the spell)
  3. The monster will begin to cast another spell
  4. Crash if the random spell requires a player structure

Screenshots

First, the monster is using sudden death rune, as it should (before using /reload):
image

image

After using /reload scripts:
image

Different spell than sudden death, which is the one registered:
image

Environment

  • Windows 10
  • Last commit

Additional context

Found a way to "fix" it, but I don't really know if it is effective: reload monsters scripts after reloading scripts on game.cpp
image
(Sorry, I'm new on github and don't really know how to use it properly, just want to contribute a little.)

@beats-dh
Copy link
Collaborator

So when you use the /reload scripts command will it reload monsters too?

@Peixonauta2
Copy link
Contributor Author

It's dumb, I know but since I'm no C++ expert, I didn't find another way to resolve it. I'm not suggesting this as a solution, just reporting what I did to be able to reload scripts without getting all monsters crazy.

@beats-dh
Copy link
Collaborator

It's dumb, I know but since I'm no C++ expert, I didn't find another way to resolve it. I'm not suggesting this as a solution, just reporting what I did to be able to reload scripts without getting all monsters crazy.

It's not stupid, it was a good idea. Did you notice any crash or choke on the reload?

@Peixonauta2
Copy link
Contributor Author

Peixonauta2 commented Jun 21, 2021

It's dumb, I know but since I'm no C++ expert, I didn't find another way to resolve it. I'm not suggesting this as a solution, just reporting what I did to be able to reload scripts without getting all monsters crazy.

It's not stupid, it was a good idea. Did you notice any crash or choke on the reload?

No, actually the reload execution was fast and the crashes stopped. I recommend more people to test it.
Do you think that this has anything to do with revscripts monsters? I don't remember of this problem happening before when monsters used to be registered as xml.

@beats-dh
Copy link
Collaborator

It's dumb, I know but since I'm no C++ expert, I didn't find another way to resolve it. I'm not suggesting this as a solution, just reporting what I did to be able to reload scripts without getting all monsters crazy.

It's not stupid, it was a good idea. Did you notice any crash or choke on the reload?

No, actually the reload execution was fast and the crashes stopped. I recommend more people to test it.
Do you think that this has anything to do with revscripts monsters? I don't remember of this problem happening before when monsters used to be registered as xml.

It may have to do with monster changes to rev, you can test this modification along with the PR of spells in rev opentibiabr/otservbr-global-archived#2588.

@majestyotbr
Copy link
Contributor

So when you use the /reload scripts command will it reload monsters too?

No, the /reload scripts just update the scripts, to reload the monsters you should use the command /reload monsters because the monsters are still in data/monster, they are not in data/scripts.

@majestyotbr
Copy link
Contributor

Remember, the command /reload should be used only for tests.

@majestyotbr
Copy link
Contributor

/reload scripts
/reload monsters

@Peixonauta2
Copy link
Contributor Author

Peixonauta2 commented Jun 22, 2021

Remember, the command /reload should be used only for tests.

Agree with this. Just reported because it may be annoying to get your tests to crash.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 120 days with no activity.

@dudantas
Copy link
Contributor

dudantas commented Oct 6, 2021

Your issue will be transferred to the canary repository

@dudantas dudantas transferred this issue from opentibiabr/otservbr-global-archived Oct 6, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2022

This issue is stale because it has been open 120 days with no activity.

@github-actions github-actions bot added the Stale No activity label Jan 5, 2022
@andersonfaaria andersonfaaria added Priority: Critical Represents a risk to live servers Area: Source and removed Stale No activity labels Apr 6, 2022
@andersonfaaria andersonfaaria changed the title BUG: Spells and Monster Crash using reload in spells Apr 6, 2022
@andersonfaaria andersonfaaria added Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. Status: Pending Review This PR or Issue requires a review labels Apr 6, 2022
@andersonfaaria
Copy link
Contributor

I actually liked the work-around to ask to reload monsters upon reloading scripts. It's clearly a depency that can't be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Source Priority: Critical Represents a risk to live servers Status: Pending Review This PR or Issue requires a review Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
5 participants