• 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 [Tfs 1.1] Boots affect speed on tile

Apollos

Dude who does stuff
Joined
Apr 22, 2009
Messages
829
Solutions
123
Reaction score
655
Location
United States
Working on boots that stop slow walking on certain tiles. The concept is apparently beyond my scripting skills, I may be way off but this is what I have so far, it causes speed to double every tile until server crash.

Lua:
function onStepIn(cid, item, position, fromPosition)
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2641 then
        print(getCreatureSpeed(cid))
        doChangeSpeed(cid, getCreatureSpeed(cid) + 100)
    end
    return true
end

function onStepOut(cid, item, position, fromPosition)
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2641 then
        print(getCreatureSpeed(cid))
        doChangeSpeed(cid, getCreatureSpeed(cid) - 100)
    end
    return true
end
 
Solution
That's because doChangeSpeed's second param is actually whats going to be added to the player's current speed
So it'd be:
doChangeSpeed(cid, 100)
which would increment the player's speed by 100.
Now, if you want to change the speed only once, you could try with storages or comparing with base speed (although boh's and other speed items would affect)
That's because doChangeSpeed's second param is actually whats going to be added to the player's current speed
So it'd be:
doChangeSpeed(cid, 100)
which would increment the player's speed by 100.
Now, if you want to change the speed only once, you could try with storages or comparing with base speed (although boh's and other speed items would affect)
 
Solution
That's because doChangeSpeed's second param is actually whats going to be added to the player's current speed
So it'd be:
doChangeSpeed(cid, 100)
which would increment the player's speed by 100.
Now, if you want to change the speed only once, you could try with storages or comparing with base speed (although boh's and other speed items would affect)

Thanks, that makes sense. lol Well basically my idea is boots that you don't lose speed on cave grounds. I now have it to this point but so far it's not making a difference to the character speed visually but the print functions are showing that it is working.

Lua:
local dirt = {351,352,353,354,355,9021,9022,9023,9024,9025}

function onStepIn(cid, item, position, fromPosition)
    local tile = Tile(fromPosition)
    local ground = tile:getGround()
   
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2641 then
        if isInArray(dirt, ground.itemid) == true then
            return
        else
        print(getCreatureSpeed(cid))
        doChangeSpeed(cid, 500)
        end
    end
    return true
end

function onStepOut(cid, item, position, fromPosition)
    local tile = Tile(getPlayerPosition(cid))
    local ground = tile:getGround()
   
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2641 then
        if isInArray(dirt, ground.itemid) == true then
            return
        else
            print(getCreatureSpeed(cid))
            doChangeSpeed(cid, -500)   
        end
    end
    return true
end
 
Was testing this on my god, which wasn't affecting his speed. Works with players, have it fully working now after a lot of bug tweaks. Ended up using a player storage and a global storage.
 
Back
Top