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

Item in actionid then teleport to X

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hi folks!

I'm having some problems in a system here, so.. The ideia is a script to when the player stepin a item X is and ground has actionid Y then will teleport the item X to centerPosition, but I don't know why it is not working, can someone help me on that?

Code:
local centerPosition = Position(1020, 1031, 7)

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
   
    local tile = Tile(position)
    if not tile then
        return false
    end

    local newItem = tile:getItemById(2160)
    if newItem then
        newItem:teleportTo(config.centerPosition)
        newItem:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end
    return true
end


Thanks.
 
Best way to determine an error is to setup either a send to text message to the player or a print statement to the console where the values are used to determine if a value is present or not.

When you ask the server if not value then, what you are doing is suggesting a break point, this prevents the server from crashing or generating errors, you can use these break points to help you determine where the error lies, so place a print statement just about the return value

Example:
Code:
if not value then
    print('value doesn't exist')
    return false
end
 
Best way to determine an error is to setup either a send to text message to the player or a print statement to the console where the values are used to determine if a value is present or not.

When you ask the server if not value then, what you are doing is suggesting a break point, this prevents the server from crashing or generating errors, you can use these break points to help you determine where the error lies, so place a print statement just about the return value

Example:
Code:
if not value then
    print('value doesn't exist')
    return false
end

I know about that, I did it before I test, but I guess I'm not writing it correct.

The mainly ideia here is to edit Printer soccer system, and check if the next Position has action id 9198, if yes, then will transport the item to X Position.
 
Last edited:
Back
Top