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

Yalahar Demons

Mudrock

Member
Joined
Jan 25, 2017
Messages
102
Reaction score
19
Location
Minas Gerais - Brazil
The following code is from the demo hunt that stays in yalahar, it removes the soil normally when the player enters the teleport but teleports the player to the exit position instead of the entrance!

I need help correcting this little problem.

Code:
local config = {
    -- west entrance
    [4244] = { sacrificePosition = Position(32859, 31056, 9), pushPosition = Position(32856, 31054, 9), destination = Position(32860, 31061, 9) },
    --east entrance
    [4245] = { sacrificePosition = Position(32894, 31044, 9), pushPosition = Position(32895, 31046, 9), destination = Position(32888, 31044, 9) }
}

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

    local flame = config[item.actionid]
    if not flame then
        return true
    end

    local sacrificeId, sacrifice = Tile(flame.sacrificePosition):getThing(1).itemid, true
    if not isInArray({8298, 8299, 8302, 8303}, sacrificeId) then
        sacrifice = false
    end

    if not sacrifice then
        player:teleportTo(flame.pushPosition)
        position:sendMagicEffect(CONST_ME_ENERGYHIT)
        flame.pushPosition:sendMagicEffect(CONST_ME_ENERGYHIT)
        return true
    end

    local soilItem = Tile(flame.sacrificePosition):getItemById(sacrificeId)
    if soilItem then
        soilItem:remove()
    end

    player:teleportTo(flame.destination)
    position:sendMagicEffect(CONST_ME_HITBYFIRE)
    flame.sacrificePosition:sendMagicEffect(CONST_ME_HITBYFIRE)
    flame.destination:sendMagicEffect(CONST_ME_HITBYFIRE)
    return true
end
 
Back
Top