• 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!

Lua stepin

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
128
Location
Brazil
YouTube
caruniawikibr
Does anyone know how to do this?
You can only step on a certain floor if you have a certain item on your feet.
tfs 1.5
 
Solution
data/scripts/," and you can create a folder called "Movements" or customize it whenever you want. There's no problem!
Lua:
local config = {
    specialFloorIds = {10003,10004},-- Special floor IDs
    requiredBootsId = 7457 -- Required item ID (boots)
}

local specialFloor = MoveEvent()

function specialFloor.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end

    local player = creature:getPlayer()
    local boots = player:getSlotItem(CONST_SLOT_FEET)

    if not boots or boots:getId() ~= config.requiredBootsId then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need to wear the special boots to step on this floor.")
        player:teleportTo(fromPosition, true)...
data/scripts/," and you can create a folder called "Movements" or customize it whenever you want. There's no problem!
Lua:
local config = {
    specialFloorIds = {10003,10004},-- Special floor IDs
    requiredBootsId = 7457 -- Required item ID (boots)
}

local specialFloor = MoveEvent()

function specialFloor.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end

    local player = creature:getPlayer()
    local boots = player:getSlotItem(CONST_SLOT_FEET)

    if not boots or boots:getId() ~= config.requiredBootsId then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need to wear the special boots to step on this floor.")
        player:teleportTo(fromPosition, true)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Welcome to the special floor!")

    return true
end

for _, index in pairs(config.specialFloorIds) do
    specialFloor:uid(index)
end

specialFloor:type("stepin")
specialFloor:register()
 
Last edited:
Solution
Lua:
local config = {
    specialFloorIds = {10003,10004},-- Special floor IDs
    requiredBootsId = 7457 -- Required item ID (boots)
}

local specialFloor = MoveEvent()

function specialFloor.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end

    local player = creature:getPlayer()
    local boots = player:getSlotItem(CONST_SLOT_FEET)

    if not boots or boots:getId() ~= config.requiredBootsId then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need to wear the special boots to step on this floor.")
        player:teleportTo(fromPosition, true)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Welcome to the special floor!")

    return true
end

for _, index in pairs(config.specialFloorIds) do
    specialFloor:uid(index)
end

specialFloor:type("stepin")
specialFloor:register()
One question, there are no movements in scripts, only actions, does this go to actions?
 
I'm going to test it, I'm finishing adding a quest, so I'm going to add the special floor as well to test.
many busy xD
Post automatically merged:

Tested it, and it worked well before sending the script. I used the UniqueID; you need to input the UniqueID through the RME.

sorry I didn't understand
 
Last edited:
I'm going to test it, I'm finishing adding a quest, so I'm going to add the special floor as well to test.
many busy xD
Post automatically merged:



sorry I didn't understand

put uniqueID on the ground and the script will work
 
That's ok, I understand, but if I set uniqueid on several floors, it will be like replication in TFS. What is the way to edit the itemid as uid in the editor? That's what I didn't understand.
ah you want the script work with itemID ( groundID ) instead of uniqueID?
 
Yes, let's say I want to walk over all the water on the map, that would be item IDs....
1712422211099.png
ok i remove uid and change to id... work now
Post automatically merged:

ty matheus, work now <3
Post automatically merged:

1712423575571.png

I'm trying to add this effect when the player steps on the floor, however, I also have a problem, it's possible to throw items on top. How to solve both things?
Post automatically merged:

i try add effect bubbles on floor
Lua:
function specialFloor.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end


    local player = creature:getPlayer()
    local boots = player:getSlotItem(CONST_SLOT_FEET)


    if not boots or boots:getId() ~= config.requiredBootsId then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry not possible")
        player:teleportTo(fromPosition, true)
        -- position:sendMagicEffect(CONST_ME_POFF)
        return false
    end
    for x = -1, 1 do        for y = -1, 1 do            position:sendMagicEffect(CONST_ME_BUBBLES)        end    end
    
    return true
end


but no work, Does anyone know how I do it?
Post automatically merged:

1712430168795.png

nice!
 
Last edited:
Back
Top