Mjmackan
Mapper ~ Writer
Hey! Using the swimming script (pretty much) with some changes onto new water id i get slowed until i cannot move, the addCondition seems to be the culprit.
I have tried adding:
Before the setCondition, but didn't work, only thing that works seems to be removing the setCondition but then im just running on top of water like some jesus-ahh.
The script:
I have tried adding:
creature:removeCondition(CONDITION_OUTFIT)Before the setCondition, but didn't work, only thing that works seems to be removing the setCondition but then im just running on top of water like some jesus-ahh.
The script:
LUA:
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({ lookType = 2015 })
condition:setTicks(-1)
function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
end
if creature:getStorageValue(943943) <= os.time() then
creature:sendTextMessage(MESSAGE_STATUS_SMALL, "This water isn't safe to swim in, rent a boat in order to enter.")
local fromTile = Tile(fromPosition)
if fromTile and fromTile:getItemById(33707) then
-- Came from another water tile then send to safe position with delay
creature:sendTextMessage(MESSAGE_STATUS_WARNING, "Your boat rental has expired. You have been returned to safety.")
addEvent(function()
if creature and creature:isPlayer() then
creature:teleportTo(Position(842, 1098, 6))
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end, 300) -- 300ms delay
else
-- Normal case will teleport back immediately
creature:teleportTo(fromPosition, false)
end
else
creature:addCondition(condition)
end
return true
end
function onStepOut(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
end
creature:removeCondition(CONDITION_OUTFIT)
return true
end