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

Looking for a vocation tile script {REP++}

Tonks II

New Member
Joined
Jun 3, 2012
Messages
31
Reaction score
0
Hello dear friends,
I've started my OT, but players when I put starter items as MOD, so they get it when they login, The items gets dropped on ground, so I decided to make it as chests, so..
I'm looking for a vocation tile, Example: You see Trilun (Level ~) He is a sorcerer, When he try to walk on tile that's a chest infront 2 sqms of it, and that tile for Sorcerers [Like has action/unique ID] [Says: You are sorcerer, You can pass].
Other vocations same, You are druid, You can pass.
If he went on Druid's tile, it says [You aren't druid, You can not pass].

I need them like 1 script..

Note: Please full script [Like make voctile.lua on Movements, and put it movements.xml [~~]],
Thanks in advance.
 
Here take a simple script what i made:

Edit data/movements/movements.xml and add this line:
XML:
<movevent type="StepIn" actionid="1000" event="script" value="voctile.lua"/>

Make a lua file named "voctile" at data/movements/scripts and copy & paste the script!
Lua:
---------------------Configuration------By: Otswe----------------------------------------------------
local vocations = {1,2} -- Add VocId, Which vocations can enter!
local entermsg = "Welcome" -- Edit the enter msg to whatever you want!
local failmsg = "Sorry, but you aren\'t the right vocation" -- Edit the fail msg whatever you want!
----------------------------Actual Script-------By: Otswe--------------------------------------------
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) then
    if isInArray(vocations,getPlayerVocation(cid)) then
       doPlayerSendTextMessage(cid,25,entermsg)
       doSendAnimatedText(getCreaturePosition(cid), "WELCOME!", TEXTCOLOR_RED)
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
    else
        doTeleportThing(cid,fromPosition)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid,25,failmsg)
    end
    return true
end
end

Here is a little explanation: When you added the Vocids and you did only add Sorc & Druid vocid. Then only these two vocations can enter the tile which will send a Text, Text Effect and Magic Effect to let them feel comfortable.
If they arent these two vocid then they will not able to enter! They get teleported 1 sqm back and get this msg: ""Sorry, but you aren\'t the right vocation"" and it sends a teleport effect.

Also wanna thank the mod which used "tags" on my script :)
 
Last edited:
are you serious? -.-'

Lua:
local nameTable = { "Sorcerer", "Druid", "Paladin", "Knight" }


function onStepIn(cid, item, pos)
    if (getPlayerVocation(cid) % table.getn(nameTable)) == item.aid then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are a " .. nameTable[item.aid] .. ", you can pass")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a " .. nameTable[item.aid] .. ", you can pass")
        return false
    end
    return false
end


How to use:
If you have other classes, add the names on the nameTable, it's already working with promotions too(Master Sorcerer can go thru Sorcerer tiles), but it doesn't have support for promotion vocation only(only Master Sorcerer can pass)
Add it to the xml(I refuse to give it to you, if you can't do it, go learn!)
Then on the map editor, set the AID of that tile to the vocation you want to let thru(1 for Sorcerers, 2 for Druids, etc..)


@Edit
Mine has an advantage over the one above because you only need 1 script for everything, while the one above you'll need a new file for each different tile(1 script for sorcs only, 1 script for druids only, etc..)
 
Last edited:
are you serious? -.-'

Lua:
local nameTable = { "Sorcerer", "Druid", "Paladin", "Knight" }


function onStepIn(cid, item, pos)
    if (getPlayerVocation(cid) % table.getn(nameTable)) == item.aid then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are a " .. nameTable[item.aid] .. ", you can pass")
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a " .. nameTable[item.aid] .. ", you can pass")
        return false
    end
    return false
end


How to use:
If you have other classes, add the names on the nameTable, it's already working with promotions too(Master Sorcerer can go thru Sorcerer tiles), but it doesn't have support for promotion vocation only(only Master Sorcerer can pass)
Add it to the xml(I refuse to give it to you, if you can't do it, go learn!)
Then on the map editor, set the AID of that tile to the vocation you want to let thru(1 for Sorcerers, 2 for Druids, etc..)


@Edit
Mine has an advantage over the one above because you only need 1 script for everything, while the one above you'll need a new file for each different tile(1 script for sorcs only, 1 script for druids only, etc..)

If I'll go and learn .xml, It will take long time, I just want to fix this script, and later I'll be learning!
Please.
Okay,
Code:
<movevent type="StepIn" actionid="1000" event="script" value="voctile.lua"/>
If it is that, I would put in every tile action 1000? Or I'll duplicate it 4 times with other ids?>

Like, how can I set this tile only can be walkable for sorcerers only?
 
:S use mine, simpler just add:
local vocations = {1,5} -- Add VocId, Which vocations can enter!
 
i dont know what scarlet is based on, i think its
<movevent type="StepIn" itemid="1000" event="script" value="voctile.lua"/>
 
Back
Top