• 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 Question about script

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
How can i execute this, using movements script.

If the player get the storageValue stopped under the sqm with stepIn function the local text dont open yes?

Well...
Have a function to check is the player is there In position to execute the script here?


Example, if the player is there stopped on position A, or postion B and receive storage1100,1

Position A: 3461,2361,7
Position B: 3451,2371,7

Execute this part:
if player:getStorageValue(1100) >= 1 then
local text = 'You have found a new cave'
player:showTextDialog(item:getId(), text)
end
 
Solution
Lua:
local positions = {
    Position(3461,2361,7),
    Position(3451,2371,7)
}

function onStepIn(creature, item, position, fromPosition)
    if table.contains(positions, position) then
        -- do what you want here
    end
    return true
end
I mean, you have everything you need already.

Just copy paste that into a onStepIn script and apply an actionid to the tile in the map editor.
The actionid on the tile you want it to trigger gives you the function you want as well as the location you want.
 
Guys correct me if I'm wrong, in tfs0.4 it will be like:

Code:
local config = {
   storageId = 1100
}

function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) then
        if getPlayerStorageValue(cid, config.storageId) ~= 1 then
            setPlayerStorageValue(cid, config.storageId, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a new cave.')
            
        -- next visit in this place, should be deleted after test
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You were already here.')
        end
    end
    
    return true
end
 
unfortunately it didn't work, it only works if the player out sqm and enter again, i need that script check the player position, and if the player position is A or B, then execute this

Lua:
if player:getStorageValue(1100) >= 1 then
local text = 'You have found a new cave'
player:showTextDialog(item:getId(), text)
end
 
Back
Top