forgottenserver
forgottenserver copied to clipboard
Don't delete players on death
Players shouldn't get logged out on death.
Would be great if this could get thoroughly tested.
I like it, I'm going to try it
Dont work and produce the following error:
this happens if you decide to log out instead of continuing, and if you continue, another violation occurs in any call to lua call protection function:
@MillhioreBT
Didn't happen to me on linux, didn't test on windows. But I see one possible reason for this. Check if it's better with new commit.
The first error no longer occurs, but the second continues to appear every time I die with the character, it seems as if from lua it was trying to read a dead pointer or something like that, I will try to compile it with the base files instead of those from my sources to rule out possible errors in my sources
I give up, I did more than 50 tests, in half the cases it seemed to work fine, but when reappearing, you would get guild shields and sometimes some npc icons, some actions such as seeing objects cause the crash, it is quite strange, and in the other half the server it just crashed when trying to move the character from its spawn location.
We hope someone else can check this, the truth is I feel sad that I can not have this functionality at first sight
I give up, I did more than 50 tests, in half the cases it seemed to work fine, but when reappearing, you would get guild shields and sometimes some npc icons, some actions such as seeing objects cause the crash, it is quite strange, and in the other half the server it just crashed when trying to move the character from its spawn location.
We hope someone else can check this, the truth is I feel sad that I can not have this functionality at first sight
That's very odd. I tested with moving and generally still playing after dying and it didn't crash even once... It must be your custom source.
I give up, I did more than 50 tests, in half the cases it seemed to work fine, but when reappearing, you would get guild shields and sometimes some npc icons, some actions such as seeing objects cause the crash, it is quite strange, and in the other half the server it just crashed when trying to move the character from its spawn location. We hope someone else can check this, the truth is I feel sad that I can not have this functionality at first sight
That's very odd. I tested with moving and generally still playing after dying and it didn't crash even once... It must be your custom source.
If it is surely that, since my sources support versions higher than 10.98, I should probably add something else to the changes you made so that then it can also work for me, in the meantime I will wait, I really don't have much idea how to make it work for me
This would be the first PR that does not work for me in my custom fonts, it is quite rare, I hope that other people can try this and confirm if everything is fine or if they are also doing just as badly as me
my problem is related to the lua stack, in case someone else gives them an error and they relate it to the lua stack!
This would be the first PR that does not work for me in my custom fonts, it is quite rare, I hope that other people can try this and confirm if everything is fine or if they are also doing just as badly as me
my problem is related to the lua stack, in case someone else gives them an error and they relate it to the lua stack!
It's probably related to your onDeath or onPrepareDeath events or maybe onThink events? If you could debug this and find the issue, it would be great. This might be issue with something you use (in lua) while tfs does not.
This would be the first PR that does not work for me in my custom fonts, it is quite rare, I hope that other people can try this and confirm if everything is fine or if they are also doing just as badly as me my problem is related to the lua stack, in case someone else gives them an error and they relate it to the lua stack!
It's probably related to your onDeath or onPrepareDeath events or maybe onThink events? If you could debug this and find the issue, it would be great. This might be issue with something you use (in lua) while tfs does not.
i opened my server in debug mode, and put a breakpoint in the function here:
Then I started doing the tests, and indeed at this point the process was interrupted twice, it was enough to give it twice to continue and then everything happened according to your changes, everything perfect, then it disable the breakpoint and then the error happened , and it was always related to the lua stack, it seems like some lua script is running on a different thread and thus not syncing.
I'll try to keep checking this when I can, because I really want this, and I feel sad that I can't add this PR to my custom sources now
I can't test but I have a question.
Will it fire onLogout after player click logout in client after death? Or how does it work? Because AFAIK before it didn't fire onLogout after death.
I can't test but I have a question.
Will it fire onLogout after player click logout in client after death? Or how does it work? Because AFAIK before it didn't fire onLogout after death.
No it wont, because you aren't logging out. It will fire onLogout when you really logout, so when you are getting kicked for inactivity or when you decide to click cancel and not "OK" in the prompt.
Try it: Die -> click to open Store (it will dont open nothing in case) -> make some right-clicks in the map or move with your keyboard I can't reproduce that 100% but if I keep trying, it will crash after few attempts
Try it: Die -> click to open Store (it will dont open nothing in case) -> make some right-clicks in the map or move with your keyboard I can't reproduce that 100% but if I keep trying, it will crash after few attempts
Clicking "store" should probably kick out or respawn, cause it's not used atm, so clicking might have some unintended behaviour, good catch
So I checked it and clicking store actually acts like clicking OK. So not sure what are you talking about. Client 1098.
The store button works for me, in my case I use client 10 to this day it still works wonderfully
I reviewed the changes and it's working fine (with store), I was confused the isRemoved() function with isDead() (I was sleepy) - I had some crashes with the players playing, I'm trying to reproduce the error myself but I couldn't sorry for the bad feedback
Edited: I reproduced some try it: crash 1: 1- Die with a normal player and do nothing 2- With GM use the command /c player
crash 2: 1- Die with a normal player and do nothing 2- With GM use the command /kick player
debbug and probably crash 3: 1- Die with a normal player and do nothing 2- With GM use the command /c player and the player should enter in one teleport (close all sqms near to player goes inside of it) 3- it's like cloning the player, will generate few debbugs
Also I think this function should have one check https://github.com/opentibiabr/otservbr-global/blob/develop/src/creature.cpp#L80 because I reproduced one of crashs in my test server with creature nullptr
Works great, I'll be testing all night, then give my aprove 😍
@Diego-OT could you check again after the latest changes please?
@nekiro new problem to deal with, when you die your ID is deleted from the table: nextUseStaminaTime
and therefore it will produce an error when receiving experience with the stamina option activated.
The problem is here: https://github.com/otland/forgottenserver/blob/7c0d29d95fe69a1d817c77fd5e752643243287f1/data/creaturescripts/scripts/playerdeath.lua#L6-L8
My temporary solution was to create a 30 second scheduled event to remove the key from the table, since 30 seconds is the maximum time the reconnect window can wait before automatically disconnecting completely, I think there are better ways to deal with this anyway.
needs rebase
Any progress on this?
I tested and:
1- Global when player dies, the player goes to the temple instantly, so when we exiva, the exiva will tell us that he is in the temple. Currently the exiva points to the location where the player died 2- Crash: Die with a normal player and do nothing. With GM use the command /c player 3- Player never logout if no button is pressed (not even after 60 seconds) due to sent/receive ping. Also, the byte 0x14 is only called at the time of death and therefore impossible to check after 60 seconds in the case. The bytes that keep sending are 0x1D 0x1C 0x1E
is this buggy or does works?