forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

PERMANENT (conditions) or (buffs/debuffs) to player that lasts even through death and login/logout

Open Coldensjo opened this issue 1 year ago • 9 comments

Explanation of what you want to do that is currently impossible

Adding a condition, buff or debuff to player that persists through death, login, logout, essentially forever until force removed through scripts. Sort of like https://elderscrolls.fandom.com/wiki/Standing_Stones

Available workarounds

It's possible to add a condition and a storage, then check for the storage onLogin and apply the condition if the player has the storage, but this workaround is annoying.

Coldensjo avatar May 15 '24 19:05 Coldensjo

it's can be done by using onLogin script + check for storage from my site this feature is nice to have, nothing mandatory

ArturKnopik avatar May 16 '24 16:05 ArturKnopik

Sounds like asking for a memory leak, but I can understand that this is a feature that would be nice to have.

nekiro avatar Jun 12 '24 09:06 nekiro

Sounds like asking for a memory leak, but I can understand that this is a feature that would be nice to have.

player->getStorageValue(storage.conditions.reserved+(subIdOffset), value)

where memory leak?

Wirless avatar Nov 12 '24 12:11 Wirless

I believe, Condition class should get a parameter that allows it. We already save/load Conditions to/from database, I dont know why you all consider to do it with storages onLogin, instead of doing it nicely in C++.

Tofame avatar Mar 13 '25 16:03 Tofame

I believe, Condition class should get a parameter that allows it. We already save/load Conditions to/from database, I dont know why you all consider to do it with storages onLogin, instead of doing it nicely in C++.

In case of death all coinditions are removed, after death relog we can use onLogin to check storage and add condition to player if needed

ArturKnopik avatar Mar 13 '25 16:03 ArturKnopik

In case of death all coinditions are removed, after death relog we can use onLogin to check storage and add condition to player if needed

This shows 2 concerns:

  • Death should not relog. I'm quite certain Tibia no longer relogs, not sure if it ever has done that.
  • This type of permament condition just could be omitted in the removal of conditions. Maybe the -1 condition ticks were meant to make the condition permament, because they do actually act like that with the exception of disappearing on death/on relog.

Tofame avatar Mar 13 '25 18:03 Tofame

It's possible to add a condition and a storage, then check for the storage onLogin and apply the condition if the player has the storage, but this workaround is annoying.

It's annoying if you have to manually write the same repetitive logic everywhere.
But nothing stops you from creating a new method in data/lib/core/player.lua and having this method do all the magic.
Then you just need to call a new method called addPermanentCondition and pass the condition as a parameter, and that's it. Now simply reuse that method in all the places you want.

MillhioreBT avatar Mar 13 '25 19:03 MillhioreBT

It's possible to add a condition and a storage, then check for the storage onLogin and apply the condition if the player has the storage, but this workaround is annoying.

It's annoying if you have to manually write the same repetitive logic everywhere. But nothing stops you from creating a new method in data/lib/core/player.lua and having this method do all the magic. Then you just need to call a new method called addPermanentCondition and pass the condition as a parameter, and that's it. Now simply reuse that method in all the places you want.

Re-applying them assumes, you remember them somehow or you prepare the same conditions every server startup, and are unable to make them on your own, dynamically, instead select a chosen one from available static permanent ones.... or any other vision you currently have to go with storages 🤔 How do you two, plan to remember that e.g.

Condition adding manashield, subid 5 is permanent
Condition adding 5% mana, with subid 2 is permanent
Condition adding 10% paral, with subid 21 is permanent etc.

In storage you can save numbers, not some complex information.

Instead, this should be

condition:setParameter(PERMANENT, 1)

edit: actually 2nd time I will mention that there is -1 param in codition, that makes a condition "unending" untill a death/relog. This should've been a permanent one ....or -1 keeps being unending, and similarly to this, a permanent one will work, but won't be removed. A conditions that are saved as a blob. Afaik this is implemented in databases already.

Tofame avatar Mar 13 '25 19:03 Tofame

In storage you can save numbers, not some complex information.

The information of a condition is just numbers. Nothing stops you from being able to save each of these numbers in a series of keys.

I'm just saying that it's not hard to simulate this in Lua.

I agree that there should be a way to have permanent conditions on the sources side.
The name isPermanent is quite misleading and doesn't exactly reflect what it does.

In my server, I have a parameter that indicates whether conditions can be removed automatically. This way, I can have truly permanent conditions. The only way to remove them is when the time runs out or, in the case of infinite ones, when I manually remove them with scripts.

Surely there is a better way to approach this situation. I would also like to change the name from isPermanent to something else and reserve isPermanent for the true use case.

MillhioreBT avatar Mar 13 '25 19:03 MillhioreBT