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

Player Relocate by QuestValue

Curb

Active Member
Joined
Sep 7, 2014
Messages
82
Solutions
5
Reaction score
34
Give as much information as possible(TFS version, OS, errors, scripts).
Code:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and not creature:getPlayer():isPremium() then
        doRelocate(item:getPosition(),{x = item:getPosition().x + 3, y = item:getPosition().y, z = 07})
        Game.sendMagicEffect(item:getPosition(), 13)
    end
end

Instead of filter by player is premium or not I woud like to filter it by QuestValue.

Can someone help me?
 
Solution
Try this one
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and creature:getStorageValue(603) < 1 then
        doRelocate(item:getPosition(),{x = item:getPosition().x - 1, y = 32059, z = 12})
        Game.sendMagicEffect({x = item:getPosition().x - 1, y = 32059, z = 12}, 13)
    end
end
Read Support board rules before posting your next thread.

I think player's storage value is what you meant? Because every quest should add a storage value to the player if that what you meant you can try this.
Lua:
player:getStorageValue
 
Last edited:
hmm yea Im sorry Im not really into scripting.

Im using nostalrius and it uses this in some scripts setQuestValue(603,1), QuestValue(603)<1

And I want players without this value not to be able to pass a specific tile

Tried this but it didnt work
Code:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and not creature:getPlayer():getPlayerQuestValue(603) <= 1 then
        doRelocate(item:getPosition(),{x = item:getPosition().x - 1, y = 32059, z = 12})
        Game.sendMagicEffect({x = item:getPosition().x - 1, y = 32059, z = 12}, 13)
    end
end

Error when step in the tile:
Untitled.png
 
Try this one
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and player:getStorageValue(603) < 1 then
        doRelocate(item:getPosition(),{x = item:getPosition().x - 1, y = 32059, z = 12})
        Game.sendMagicEffect({x = item:getPosition().x - 1, y = 32059, z = 12}, 13)
    end
end
 
Try this one
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and creature:getStorageValue(603) < 1 then
        doRelocate(item:getPosition(),{x = item:getPosition().x - 1, y = 32059, z = 12})
        Game.sendMagicEffect({x = item:getPosition().x - 1, y = 32059, z = 12}, 13)
    end
end
 
Solution

Lua:
function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player or not player:getStorageValue(603) >= 1 then
        return true
    end

    local toPosition = Position(player:getPosition().x - 1, 32059, 12)
    doRelocate(player:getPosition(), toPosition)
    toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end
 
It worked!

Code:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() and creature:getStorageValue(603) > 0 then
        doRelocate(item:getPosition(),{x = item:getPosition().x + 1, y = 32059, z = 12})
        Game.sendMagicEffect({x = item:getPosition().x + 1, y = 32059, z = 12}, 13)
    end
end

getStorageValue(603) > 0 then

thanks guys
 
Back
Top