• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Swim related problems.

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I want to make a movements script which checks for a certain action id and if the sqm had the action id it will sent a message + adding the normal swimming conditions. But secondly I only want the msg to happen when you aren't already in the swimming condition.

And after that I want to create the 'WATERSPLASH' effect on the moment you jump into any water (at change outfit condition)

I've tried fixing this but wasn't really getting far.
This is what I got so far:
Code:
local outfit =
    {
        lookType = 267,
        lookHead = 0,
        lookBody = 0,
        lookLegs = 0,
        lookFeet = 0,
        lookAddons = 0
    }

function onStepIn(cid, item, position, fromPosition)
    if item.actionid == 55557 then
        doCreatureSay(cid, "Pff! This water is hot.", TALKTYPE_ORANGE_1)
        doSetCreatureOutfit(cid, outfit, -1)
        doSendMagicEffect(position, CONST_ME_POFF)
    else
    doSetCreatureOutfit(cid, outfit, -1)

end
end

function onStepOut(cid, item, position, fromPosition)
    doRemoveCondition(cid, CONDITION_OUTFIT)
end

also tried adding:
Code:
    if item.actionid == 55557 and outfit == -1 then
But that just removed the msg.

At last I tried adding the splash effect at 'onStepIn':
Code:
        doSendMagicEffect(position, CONST_ME_POFF)
But that kind of created the splash effect every time I swim a sqm.


Hope any of you can help me out.

Thanks in advance.
 
You can use isInArray and check for the itemid of the previous ground you stepped on and if it's not any of the swim water ids, send the magic effect and other things.
Code:
if isInArray({4620, 4621, 4622, 4623, 4624, 4625}, getThingfromPos(fromPosition).itemid) == FALSE then
     doSendMagicEffect(position, CONST_ME_WATERSPLASH)
end
 
This is strange it was working a couple mins back but now I went to test it again and I can't seem to get the msg when I jump into the water with the action id.
Swimming.lua
Code:
local outfit =
    {
        lookType = 267,
        lookHead = 0,
        lookBody = 0,
        lookLegs = 0,
        lookFeet = 0,
        lookAddons = 0
    }

function onStepIn(cid, item, position, fromPosition)
    if item.actionid == 55558 then
            position.x = position.x + 5
            doTeleportThing(cid, position)
            doSendMagicEffect(position, CONST_ME_BUBBLES)
    elseif item.actionid == 55557 then
    if isInArray({4405}, getThingfromPos(fromPosition).itemid) == TRUE then
        doCreatureSay(cid, "Pff! This water is hot.", TALKTYPE_ORANGE_1)
        doSetCreatureOutfit(cid, outfit, -1)
        doSendMagicEffect(position, CONST_ME_POFF)
            doSendMagicEffect(position, CONST_ME_WATERSPLASH)
    else
        doSetCreatureOutfit(cid, outfit, -1)
end
    else
        doSetCreatureOutfit(cid, outfit, -1)
    if isInArray({4620, 4621, 4622, 4623, 4624, 4625}, getThingfromPos(fromPosition).itemid) == FALSE then
            doSendMagicEffect(position, CONST_ME_WATERSPLASH)
end

end
end

function onStepOut(cid, item, position, fromPosition)
    doRemoveCondition(cid, CONDITION_OUTFIT)
end
 
The action id is given to the water and should only give the effect when I'm jumping into the water from land (land being item id: 4405).
 
Then you can use this part aswell for that
Code:
if isInArray({4620, 4621, 4622, 4623, 4624, 4625}, getThingfromPos(fromPosition).itemid) == FALSE then
      doSendMagicEffect(position, CONST_ME_WATERSPLASH)
end
Under the magic effect, check for actionid and add the other things it's supposed to do.
 
Back
Top