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

RevScripts Xikini script explain please

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,394
Reaction score
162
I tryed to install the script but aint working, + no errors, seems i doing stupid mistake

Do i put actionid 45000 on map in tiles where player stand ? failing to make the script work, help!


Script:
LUA:
--[[

.------..------..------..------..------..------.
|X.--. ||I.--. ||K.--. ||I.--. ||N.--. ||I.--. |
| :/\: || (\/) || :/\: || (\/) || :(): || (\/) |
| (__) || :\/: || :\/: || :\/: || ()() || :\/: |
| '--'X|| '--'I|| '--'K|| '--'I|| '--'N|| '--'I|
`------'`------'`------'`------'`------'`------'

]]--

local config = {
    [45000] = {
        object = {
            position = Position(250, 242, 7),
            itemId = 1514,
            removeTimer = 4 -- seconds
        },
        tilePositions = {
            Position(248, 245, 7),
            Position(250, 245, 7),
            Position(252, 245, 7)
        }
    },
    [45001] = {
        object = {
            position = Position(1000, 1000, 7),
            itemId = 1111,
            removeTimer = 4
        },
        tilePositions = {
            Position(1000, 1000, 7),
            Position(1000, 1000, 7),
            Position(1000, 1000, 7)
        }
    }
}

local function removeAndReAddObject(position, objectId, timer)
    position:sendMagicEffect(CONST_ME_POFF)
    if timer > 0 then
        Tile(position):getItemById(objectId):remove()
        addEvent(removeAndReAddObject, timer, position, objectId, 0)
    else
        Game.createItem(objectId, 1, position)
    end
end

local stepTilesRemoveObject = MoveEvent()
stepTilesRemoveObject:type("stepin")

function stepTilesRemoveObject.onStepIn(player, item, position, fromPosition)

    -- confirm is player
    if not player:isPlayer() then
        return true
    end
    
    -- confirm index
    local actionId = item:getActionId()
    local index = config[actionId]
    if not index then
        print("LUA error: ActionId not in table." .. actionId)
        return true
    end
    
    -- confirm that object exists
    if Tile(index.object.position):getItemCountById(index.object.itemId) == 0 then
        position:sendMagicEffect(CONST_ME_POFF)
        return true
    end
    
    -- confirm if all tiles are occupied
    local positionAmount = #index.tilePositions
    local playerCount = 0
    for i = 1, positionAmount do
        local creature = Tile(index.tilePositions[i]):getTopCreature()
        if not creature or not creature:isPlayer() then
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_RED)
        else
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_GREEN)
            playerCount = playerCount + 1
        end           
    end
    
    -- remove and reAdd stone
    if playerCount == positionAmount then
        removeAndReAddObject(index.object.position, index.object.itemId, index.object.removeTimer * 1000)
    end   
    return true
end

for actionid, _ in pairs(config) do
    stepTilesRemoveObject:aid(actionid) -- adds all actionid's from config
end
stepTilesRemoveObject:register()

multiple-players-required-to-open-passageway-stand-3-tiles-gif.54322
 
The 3 black tiles have the actionId.

object = the pillar
tilePositions = where players stand (aka: black tiles)
i got set on first run that tiles has actionid, then player step on it gets poff effect, and nothing happens. no error either :( cant get why

do the item must be added on rme or the x/y/z spot of object must be empty on rme ?
 
i got set on first run that tiles has actionid, then player step on it gets poff effect, and nothing happens. no error either :( cant get why

do the item must be added on rme or the x/y/z spot of object must be empty on rme ?
Object should be placed on rme
 
Maybe you have actionid 45000 in use already somewhere else?

But anyway!
gg
LUA:
--[[

.------..------..------..------..------..------.
|X.--. ||I.--. ||K.--. ||I.--. ||N.--. ||I.--. |
| :/\: || (\/) || :/\: || (\/) || :(): || (\/) |
| (__) || :\/: || :\/: || :\/: || ()() || :\/: |
| '--'X|| '--'I|| '--'K|| '--'I|| '--'N|| '--'I|
`------'`------'`------'`------'`------'`------'

]]--

local config = {
    [18297] = {
        object = {
            position = Position(32097, 32186, 7),
            itemId = 1497,
            removeTimer = 30 -- seconds
        },
        tilePositions = {
            Position(32095, 32188, 7),
            Position(32099, 32188, 7)
        }
    },
    [18296] = {
        object = {
            position = Position(32077, 32171, 7),
            itemId = 1050,
            removeTimer = 40
        },
        tilePositions = {
            Position(32097, 32205, 8),
            Position(32094, 32207, 9)
        }
    },
    [18298] = {
        object = {
            position = Position(32100, 32186, 7),
            itemId = 1497,
            removeTimer = 40
        },
        tilePositions = {
            Position(32104, 32188, 7),
            Position(32105, 32188, 7)
        }
    }
}

local function removeAndReAddObject(position, objectId, timer)
    position:sendMagicEffect(CONST_ME_POFF)
    if timer > 0 then
        Tile(position):getItemById(objectId):remove()
        addEvent(removeAndReAddObject, timer, position, objectId, 0)
    else
        Game.createItem(objectId, 1, position)
    end
end

local stepTilesRemoveObject = MoveEvent()
stepTilesRemoveObject:type("stepin")

function stepTilesRemoveObject.onStepIn(player, item, position, fromPosition)

    -- confirm is player
    if not player:isPlayer() then
        return true
    end
    
    -- confirm index
    local actionId = item:getActionId()
    local index = config[actionId]
    if not index then
        print("LUA error: ActionId not in table." .. actionId)
        return true
    end
    
    -- confirm that object exists
    if Tile(index.object.position):getItemCountById(index.object.itemId) == 0 then
        position:sendMagicEffect(CONST_ME_POFF)
        return true
    end
    
    -- confirm if all tiles are occupied
    local positionAmount = #index.tilePositions
    local playerCount = 0
    for i = 1, positionAmount do
        local creature = Tile(index.tilePositions[i]):getTopCreature()
        if not creature or not creature:isPlayer() then
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_RED)
        else
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_GREEN)
            playerCount = playerCount + 1
        end           
    end
    
    -- remove and reAdd stone
    if playerCount == positionAmount then
        removeAndReAddObject(index.object.position, index.object.itemId, index.object.removeTimer * 1000)
    end   
    return true
end

for actionid, _ in pairs(config) do
    stepTilesRemoveObject:aid(actionid) -- adds all actionid's from config
end
stepTilesRemoveObject:register()


So first config aint working, second works, third one not working also.

1,3 - configs gives poff effect on step in on tile, and nothing happens
2 - config, on step in gives blinking lights effect and it works.

any hints why 1-3 config aint working ? im so confused.
i tryed different actionids, doesnt change a thing
Post automatically merged:

Maybe you have actionid 45000 in use already somewhere else?

But anyway!
gg
oke found problem, it doesnt work with item '1497' :(
 
Last edited:
LUA:
--[[

.------..------..------..------..------..------.
|X.--. ||I.--. ||K.--. ||I.--. ||N.--. ||I.--. |
| :/\: || (\/) || :/\: || (\/) || :(): || (\/) |
| (__) || :\/: || :\/: || :\/: || ()() || :\/: |
| '--'X|| '--'I|| '--'K|| '--'I|| '--'N|| '--'I|
`------'`------'`------'`------'`------'`------'

]]--

local config = {
    [18297] = {
        object = {
            position = Position(32097, 32186, 7),
            itemId = 1497,
            removeTimer = 30 -- seconds
        },
        tilePositions = {
            Position(32095, 32188, 7),
            Position(32099, 32188, 7)
        }
    },
    [18296] = {
        object = {
            position = Position(32077, 32171, 7),
            itemId = 1050,
            removeTimer = 40
        },
        tilePositions = {
            Position(32097, 32205, 8),
            Position(32094, 32207, 9)
        }
    },
    [18298] = {
        object = {
            position = Position(32100, 32186, 7),
            itemId = 1497,
            removeTimer = 40
        },
        tilePositions = {
            Position(32104, 32188, 7),
            Position(32105, 32188, 7)
        }
    }
}

local function removeAndReAddObject(position, objectId, timer)
    position:sendMagicEffect(CONST_ME_POFF)
    if timer > 0 then
        Tile(position):getItemById(objectId):remove()
        addEvent(removeAndReAddObject, timer, position, objectId, 0)
    else
        Game.createItem(objectId, 1, position)
    end
end

local stepTilesRemoveObject = MoveEvent()
stepTilesRemoveObject:type("stepin")

function stepTilesRemoveObject.onStepIn(player, item, position, fromPosition)

    -- confirm is player
    if not player:isPlayer() then
        return true
    end
   
    -- confirm index
    local actionId = item:getActionId()
    local index = config[actionId]
    if not index then
        print("LUA error: ActionId not in table." .. actionId)
        return true
    end
   
    -- confirm that object exists
    if Tile(index.object.position):getItemCountById(index.object.itemId) == 0 then
        position:sendMagicEffect(CONST_ME_POFF)
        return true
    end
   
    -- confirm if all tiles are occupied
    local positionAmount = #index.tilePositions
    local playerCount = 0
    for i = 1, positionAmount do
        local creature = Tile(index.tilePositions[i]):getTopCreature()
        if not creature or not creature:isPlayer() then
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_RED)
        else
            index.tilePositions[i]:sendMagicEffect(CONST_ME_MAGIC_GREEN)
            playerCount = playerCount + 1
        end          
    end
   
    -- remove and reAdd stone
    if playerCount == positionAmount then
        removeAndReAddObject(index.object.position, index.object.itemId, index.object.removeTimer * 1000)
    end  
    return true
end

for actionid, _ in pairs(config) do
    stepTilesRemoveObject:aid(actionid) -- adds all actionid's from config
end
stepTilesRemoveObject:register()


So first config aint working, second works, third one not working also.

1,3 - configs gives poff effect on step in on tile, and nothing happens
2 - config, on step in gives blinking lights effect and it works.

any hints why 1-3 config aint working ? im so confused.
i tryed different actionids, doesnt change a thing
Post automatically merged:


oke found problem, it doesnt work with item '1497' :(
Probably because it's classified as a field...

Try 10546. I think it looks like a magic wall, but is a static object
 
Back
Top