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

Action Vocation Booths

Chris

Inactive
Senator
Joined
Aug 11, 2008
Messages
2,628
Solutions
2
Reaction score
240
Hello guys.
I decided to release a few of my scripts ( Training Booths , Vocation Booths , Teleportatin Spell ). These scripts were only tested on TFS Alpha 3.

Vocation Booths
What you need to do is to add an action id of 9005 (sorcerer) / 9006 (druid) / 9007 (paladin) / 9008 (knight) to whatever door you'd like. Then only the required vocation may enter the specific door.



data/actions/scripts/booths/vocation/sorcerers.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    
    
    
    -- Check if the vocation is sorcerer.
    if isSorcerer(cid) then
    
        -- Check if the door is vertical.
        if isInArray(verticalOpenDoors, item.itemid + 1) == TRUE then
            
            -- West side of the door (going east).
            if ( charPos.x == doorPos.x - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 1)
                doSendMagicEffect({x = doorPos.x + 1, y = doorPos.y, z = doorPos.z}, 12)
            -- East side of the door (going west).
            elseif ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 3)
                doSendMagicEffect({x = doorPos.x - 1, y = doorPos.y, z = doorPos.z}, 12)
            end
        
        -- Check if the door is horizontal.    
        elseif isInArray(horizontalOpenDoors, item.itemid + 1) == TRUE then
            
            -- North side of the door (going south).
            if ( charPos.y == doorPos.y - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 2)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y + 1, z = doorPos.z}, 12)
            -- South side of the door (going north).
            elseif ( charPos.y == doorPos.y + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 0)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y - 1, z = doorPos.z}, 12)
            end
            
        end
    
    else
        
        -- Send an error message.
        doPlayerSendTextMessage(cid, 24, "Only sorcerers are allowed to enter this door.")
        doSendMagicEffect(getCreaturePos(cid), 2)
        
    end
    return TRUE

end
data/actions/scripts/booths/vocation/druids.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    
    
    
    -- Check if the vocation is druid.
    if isDruid(cid) then
    
        -- Check if the door is vertical.
        if isInArray(verticalOpenDoors, item.itemid + 1) == TRUE then
            
            -- West side of the door (going east).
            if ( charPos.x == doorPos.x - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 1)
                doSendMagicEffect({x = doorPos.x + 1, y = doorPos.y, z = doorPos.z}, 12)
            -- East side of the door (going west).
            elseif ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 3)
                doSendMagicEffect({x = doorPos.x - 1, y = doorPos.y, z = doorPos.z}, 12)
            end
        
        -- Check if the door is horizontal.    
        elseif isInArray(horizontalOpenDoors, item.itemid + 1) == TRUE then
            
            -- North side of the door (going south).
            if ( charPos.y == doorPos.y - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 2)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y + 1, z = doorPos.z}, 12)
            -- South side of the door (going north).
            elseif ( charPos.y == doorPos.y + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 0)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y - 1, z = doorPos.z}, 12)
            end
            
        end
    
    else
        
        -- Send an error message.
        doPlayerSendTextMessage(cid, 24, "Only druids are allowed to enter this door.")
        doSendMagicEffect(getCreaturePos(cid), 2)
        
    end
    return TRUE

end
data/actions/scripts/booths/vocation/paladins.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    
    
    
    -- Check if the vocation is paladin.
    if isPaladin(cid) then
    
        -- Check if the door is vertical.
        if isInArray(verticalOpenDoors, item.itemid + 1) == TRUE then
            
            -- West side of the door (going east).
            if ( charPos.x == doorPos.x - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 1)
                doSendMagicEffect({x = doorPos.x + 1, y = doorPos.y, z = doorPos.z}, 12)
            -- East side of the door (going west).
            elseif ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 3)
                doSendMagicEffect({x = doorPos.x - 1, y = doorPos.y, z = doorPos.z}, 12)
            end
        
        -- Check if the door is horizontal.    
        elseif isInArray(horizontalOpenDoors, item.itemid + 1) == TRUE then
            
            -- North side of the door (going south).
            if ( charPos.y == doorPos.y - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 2)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y + 1, z = doorPos.z}, 12)
            -- South side of the door (going north).
            elseif ( charPos.y == doorPos.y + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 0)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y - 1, z = doorPos.z}, 12)
            end
            
        end
    
    else
        
        -- Send an error message.
        doPlayerSendTextMessage(cid, 24, "Only paladins are allowed to enter this door.")
        doSendMagicEffect(getCreaturePos(cid), 2)
        
    end
    return TRUE

end
data/actions/scripts/booths/vocation/knights.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    
    
    
    -- Check if the vocation is knight.
    if isKnight(cid) then
    
        -- Check if the door is vertical.
        if isInArray(verticalOpenDoors, item.itemid + 1) == TRUE then
            
            -- West side of the door (going east).
            if ( charPos.x == doorPos.x - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 1)
                doSendMagicEffect({x = doorPos.x + 1, y = doorPos.y, z = doorPos.z}, 12)
            -- East side of the door (going west).
            elseif ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 3)
                doSendMagicEffect({x = doorPos.x - 1, y = doorPos.y, z = doorPos.z}, 12)
            end
        
        -- Check if the door is horizontal.    
        elseif isInArray(horizontalOpenDoors, item.itemid + 1) == TRUE then
            
            -- North side of the door (going south).
            if ( charPos.y == doorPos.y - 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 2)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y + 1, z = doorPos.z}, 12)
            -- South side of the door (going north).
            elseif ( charPos.y == doorPos.y + 1 and charPos.z == doorPos.z ) then
                -- Teleport player.
                doTeleportThing(cid, doorPos)
                doMoveCreature(cid, 0)
                doSendMagicEffect({x = doorPos.x, y = doorPos.y - 1, z = doorPos.z}, 12)
            end
            
        end
    
    else
    
        -- Send an error message.
        doPlayerSendTextMessage(cid, 24, "Only knights are allowed to enter this door.")
        doSendMagicEffect(getCreaturePos(cid), 2)
        
    end
    return TRUE

end

data/actions/
actions.xml

PHP:
    <!-- Vocation Booths -->
    <action actionid="9005" script="booths/vocations/sorcerers.lua" />
    <action actionid="9006" script="booths/vocations/druids.lua" />
    <action actionid="9007" script="booths/vocations/paladins.lua" />
    <action actionid="9008" script="booths/vocations/knights.lua" />
There you go, have fun with it.
 
Last edited:
I'm pretty sure I did.
Vocation Booths
What you need to do is to add an action id of 9005 (sorcerer) / 9006 (druid) / 9007 (paladin) / 9008 (knight) to whatever door you'd like. Then only the required vocation may enter the specific door.
 
For example, the Sorcerers training booth can only be accessed by Sorcerers.
 
This is an old script made when I kinda first got into Lua, could be done a lot better. But thanks for the comment I suppose.
 
Back
Top