Added Creature:onChangeZone event
Pull Request Prelude
- [x] I have followed proper The Forgotten Server code styling.
- [x] I have read and understood the contribution guidelines before making this PR.
- [x] I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.
Changes Proposed
- Added Creature.onChangeZone event for scripts where we need to check if a creature changes a zone...
for example:
function Creature:onChangeZone(fromZone, toZone)
if toZone == ZONE_PROTECTION then
self:say("I'm protected!")
end
end
- Added ZONE_NOLOGOUT return to Tile:getZone() method.
Issues addressed:
Can this be achieved with a regular onWalk callback?
Can this be achieved with a regular
onWalkcallback?
It can be done using onStepIn movement but you'd have to register every itemid, actionid or w/e u'll be using and check if a creature is changing zone... but it can be achieved.
It can be done using onStepIn movement but you'd have to register every itemid, actionid or w/e u'll be using and check if a creature is changing zone... but it can be achieved.
I mean, create a more generic onMove callback and there check of previous tile zone is different from current tile zone. It's more robust than creating a callback for every small event that may happen
I mean, create a more generic
onMovecallback and there check of previous tile zone is different from current tile zone. It's more robust than creating a callback for every small event that may happen
wasn't that idea initially rejected due to performance concerns?
I mean, create a more generic
onMovecallback and there check of previous tile zone is different from current tile zone. It's more robust than creating a callback for every small event that may happenwasn't that idea initially rejected due to performance concerns?
that is a good point
needs rebase so we can merge it