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

On use lua

Sami_san

New Member
Joined
May 20, 2016
Messages
76
Reaction score
1
Hello there guys. Anyone got a script that on use doors player gets a vocation?
Tfs 1.2 thanks : ) i can pay for it..
 
Code:
local doors = { -- door position here
    [{x = 0, y = 0, z = 0}] = 1,
    [{x = 0, y = 0, z = 0}] = 2,
    [{x = 0, y = 0, z = 0}] = 3,
    [{x = 0, y = 0, z = 0}] = 4
}

local storage = 123456 -- vocation storage

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) < 1 then
        for position, vocation in pairs(doors) do
            if isInArray(position, item:getPosition()) then
                player:setVocation(vocation)
                player:setStorageValue(storage, vocation)
                return true
            end
        end
    end
    return true
end
Next time use the request boards please.
 
Last edited:
okay and how to add it to actions xml ?
cause like doors i got fromid toid
Is it teleportation door like click on it you pass to another side? or open and close door? but i think in your situation it will be teleportation door, so use it like this
Code:
<action actionid="ACTIONID" event="script" value="PLACEOFTHESCRIPT"/>
After then in your map editor you can replace actionID in that door.
 
its not working. i dont get any error in the console but when i click use on the doors nothing happens and i dont get any message.
 
This script does not teleport you, it also doesn't work with an action id because you didn't ask for it to, it uses the door's item id.
The script is also just a basic template you need to fill in the positions, and the storage.

This is how you assign it to actions.xml.
Code:
<action itemid="door item id" script="PLACEOFTHESCRIPT"/>
 
Back
Top