canary icon indicating copy to clipboard operation
canary copied to clipboard

Conditions are not being reseted upon death

Open Zapotoczny opened this issue 3 years ago • 9 comments

Oki so I have a bug with soulfire runes, fire bombs and all this kind of mechanic, some example: Person A fights with person B, A soulfires person B, after for example 2 minutes, person A dies, and respawn in temple but person B is still soulfired, so almost instantly person A gets skull even after she died coz this fire damage does not reset.

Someone have idea how to fix it?

Zapotoczny avatar Jul 03 '21 22:07 Zapotoczny

Add this on logout: player:removeAllConditions()

function Player.removeAllConditions(self) local conditions = { CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_BLEEDING, CONDITION_HASTE } for i = 1, #conditions do self:removeCondition(conditions[i]) end end

xThauma avatar Jul 03 '21 22:07 xThauma

Add this on logout: player:removeAllConditions()

function Player.removeAllConditions(self) local conditions = { CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_BLEEDING, CONDITION_HASTE } for i = 1, #conditions do self:removeCondition(conditions[i]) end end

you can show me exactly how to add it?

Zapotoczny avatar Jul 04 '21 07:07 Zapotoczny

Function to functions.lua and execution in logout.lua

xThauma avatar Jul 04 '21 07:07 xThauma

I put this into player_death.lua `local conditions = { CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_BLEEDING, CONDITION_HASTE } for i = 1, #conditions do killer:removeCondition(conditions[i]) end And it delete all condition, but if player B will go back on fire, player A get skull :/

Zapotoczny avatar Jul 04 '21 09:07 Zapotoczny

after for example 2 minutes, person A dies, and respawn in temple but person B is still soulfired, so almost instantly person A gets skull even after she died coz this fire damage does not reset.

It's related to player ID generator code: https://github.com/opentibiabr/otservbr-global/blob/develop/src/creatures/players/player.h#L155-L161

In all old engines player ID changed every relog, so after relog 'fire condition' and 'fire filed' had no owner - it's 'owner id' pointed to not existing player. In otservbr it was changed, because client 12.x expects same ID of player every relog, to keep windows/backpacks positions and other settings for given player.

gesior avatar Jul 16 '21 10:07 gesior

after for example 2 minutes, person A dies, and respawn in temple but person B is still soulfired, so almost instantly person A gets skull even after she died coz this fire damage does not reset.

It's related to player ID generator code: https://github.com/opentibiabr/otservbr-global/blob/develop/src/creatures/players/player.h#L155-L161

In all old engines player ID changed every relog, so after relog 'fire condition' and 'fire filed' had no owner - it's 'owner id' pointed to not existing player. In otservbr it was changed, because client 12.x expects same ID of player every relog, to keep windows/backpacks positions and other settings for given player.

So no one has any idea how to fix it in the current version

Zapotoczny avatar Jul 16 '21 10:07 Zapotoczny

Your issue will be transferred to the canary repository

dudantas avatar Oct 06 '21 13:10 dudantas

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

github-actions[bot] avatar Jan 05 '22 02:01 github-actions[bot]

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

github-actions[bot] avatar Jul 06 '22 03:07 github-actions[bot]