Open gesior opened 8 years ago
I can't find anything too, but I found something curious on Player::addInFightTicks(bool pzlock /= false/) pzlock is never used, so this pzlock should be what was being used to pzLock players
Removing condition in-fight, is reseting pz locked state.
If you want to add it, you should probably lua-register addInFightTicks.
If this is not what you are looking for, creating (and adding lua support) a new method that only manipulates pzLocked property of player is not hard.
I thought of making a lua method that calls addInFightTicks, but adding infight ticks is already handled via conditions so we would have two of the same.
Maybe that is still the best option?
@marksamman thoughts?
in fight ticks is battle lock, not pz lock
@ranisalt yeah, with conditions. But Player::addInFightTicks has a flag to pz lock a player (tho it's never used)
Never used? Check LUA scripts, they check it in many places: player:isPzLocked()
There is also code in sources.. canLogout (a bit weird, because it check in-fight and pz lock, when it's not possible to get pz lock without in-fight): https://github.com/otland/forgottenserver/blob/c280660f9b6e3c422b3ebf5913247bded2c65d57/src/player.cpp#L3757 send icons: https://github.com/otland/forgottenserver/blob/c280660f9b6e3c422b3ebf5913247bded2c65d57/src/player.cpp#L503
Removing condition in-fight [when I want to remove pz lock only] could be abused by players to logout in some situations. Of course you can get end time of current in-fight and add new in-fight with same time just after removing current, but it's a lot of code.. and I'm not sure, if it's possible to create conditions dynamically, isn't it blocked for 'not in function' part of code [script system initialization] or something, like it was in 0.3.6?
It would be better to get access to old function 'player:setPzLocked(bool value)' in TFS 1.2 :)
@gesior it seems there was a misunderstanding, pzLocked is used, the argument for addInFightTicks pzlock is not
And it's possible to dynamically create a condition now.
Is there any way to set player pz locked/not pz locked? Add some condition or what? In old TFSes it was in LUA: doPlayerSetPzLocked(attacker, true)
I could not find it anywhere in sources (variable pzLocked is protected and there is no function to access it, so I think that this function does not exist in LUA).
Problem is when I want to set damage to 0 in 'onHealthChange' event, but still give pz lock to attacker.