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

Close theard!

Status
Not open for further replies.

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,780
Solutions
31
Reaction score
2,299
Location
Sweden?
Request: Click get vocation and teleported to temple!
Tfs: 0.3.6

All is right but i forgott when you click you will recive a item too!

Example if the player click on the item = sword, it will come fireworks he get the vocation and a outfit which i can put! then when he get the vocation and the outfit he get teleported to temple!

Rep+++
 
Last edited:
no its a vocation like if you were at rookard the item doesnt get removed!

Cyberm you will fix it to me?
 
Last edited by a moderator:
XML:
<action itemid="2345" event="script" value="promo.lua"/>
LUA:
local _setup = {
    newVocation = 2,
    outfit = {lookType=234,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
    newTownId = 4,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if not isRookie(cid) then
        doPlayerSendCancel(cid, 'You already have a vocation.')
        return true
    end 
        
    doPlayerSetTown(cid, _setup.newTownId}
    doTeleportThing(cid, getTownTemplePosition(_setup.newTownId)) 
    doSendMagicEffect(getThingPos(cid), CONST_ME_ENERGYAREA)
    doCreatureChangeOutfit(cid, _setup.outfit)
    doPlayerSetVocation(cid, _setup.newVocation)
    doPlayerSave(cid)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! You have been promoted to '.. getPlayerVocationName(cid)..'!!')    
    
    local pos = getThingPos(cid)
    for i = 1, 15 do
        doSendDistanceShoot({x = pos.x + math.random(-4, 4), y = pos.y + math.random(-4, 4), z = pos.z}, pos, CONST_ANI_SMALLHOLY)
    end
    return true
end
 
I get this error :/

[11/11/2010 16:46:40] [Error - LuaScriptInterface::loadFile] data/actions/scripts/voc.lua:13: ')' expected near '}'
[11/11/2010 16:46:40] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/voc.lua)
[11/11/2010 16:46:40] data/actions/scripts/voc.lua:13: ')' expected near '}'
 
lolz:p
LUA:
local _setup = {
    newVocation = 2,
    outfit = {lookType=234,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
    newTownId = 4,
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if not isRookie(cid) then
        doPlayerSendCancel(cid, 'You already have a vocation.')
        return true
    end 
 
    doPlayerSetTown(cid, _setup.newTownId)
    doTeleportThing(cid, getTownTemplePosition(_setup.newTownId)) 
    doSendMagicEffect(getThingPos(cid), CONST_ME_ENERGYAREA)
    doCreatureChangeOutfit(cid, _setup.outfit)
    doPlayerSetVocation(cid, _setup.newVocation)
    doPlayerSave(cid)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! You have been promoted to '.. getPlayerVocationName(cid)..'!!')    
 
    local pos = getThingPos(cid)
    for i = 1, 15 do
        doSendDistanceShoot({x = pos.x + math.random(-4, 4), y = pos.y + math.random(-4, 4), z = pos.z}, pos, CONST_ANI_SMALLHOLY)
    end
    return true
end
 
Thx rep! i will maybe need other scripts! you are a very good scripter :D
 
All is right but i forgott when you click you will recive a item too!
Code:
    itemToGive = 2345, --itemid
    itemCount = 1, --#of items to give
LUA:
local _setup = {
    newVocation = 2,
    outfit = {lookType=234,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
    newTownId = 4,
    itemToGive = 2345,
    itemCount = 1,
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if not isRookie(cid) then
        doPlayerSendCancel(cid, 'You already have a vocation.')
        return true
    end 
 
    doPlayerAddItem(cid, _setup.itemToGive, _setup.itemCount, true)
    doPlayerSetTown(cid, _setup.newTownId)
    doTeleportThing(cid, getTownTemplePosition(_setup.newTownId)) 
    doSendMagicEffect(getThingPos(cid), CONST_ME_ENERGYAREA)
    doCreatureChangeOutfit(cid, _setup.outfit)
    doPlayerSetVocation(cid, _setup.newVocation)
    doPlayerSave(cid)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! You have been promoted to '.. getPlayerVocationName(cid)..' and received a prize!!')    
 
    local pos = getThingPos(cid)
    for i = 1, 15 do
        doSendDistanceShoot({x = pos.x + math.random(-4, 4), y = pos.y + math.random(-4, 4), z = pos.z}, pos, CONST_ANI_SMALLHOLY)
    end
    return true
end
 
Status
Not open for further replies.
Back
Top