Claro que vai mudar, não colocou nenhum query...
só muda in-game, a database continua a mesma.
fica online, vou arrumar, só um segundo.
Por yagoshira004, 10 de nov. de 2015 em Scripts
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Claro que vai mudar, não colocou nenhum query...
só muda in-game, a database continua a mesma.
fica online, vou arrumar, só um segundo.
Fiz rápido, bem simples porém creio que funcione.
function onUse(cid, item, fromPosition, toPosition)
local voc = {1} --id da vocação
local scroll = {} --id do item
local efeito = {} -- efeito
if item.uid == scroll then
doPlayerSetVocation(cid, voc)
doSendMagicEffect(cid, efeito)
end
return true
end
Agora em actions.xml, adicione essa tag:
<action actionid="id do item" script="goldenpaper.lua"/>
info
Grupo: Campones
Registrado: 20/02/10
Posts: 55
Reputação: +1
Char no Tibia: Ynu

Fiz rápido, bem simples porém creio que funcione.
Crie um arquivo chamado goldenpaper.lua em data/actions/scripts e coloque isso:function onUse(cid, item, fromPosition, toPosition) local voc = {1} --id da vocação local scroll = {} --id do item local efeito = {} -- efeito if item.uid == scroll then doPlayerSetVocation(cid, voc) doSendMagicEffect(cid, efeito) end return true endAgora em actions.xml, adicione essa tag:
<action actionid="id do item" script="goldenpaper.lua"/>
Entus, o script está apenas para mudar qualquer vocação para uma nova? Pq o que eu uso muda por exemplo: o master sorcerer para um vip master sorcerer e assim respectivamente, no caso eu teria de criar um item para cada?
Claro que vai mudar, não colocou nenhum query...
só muda in-game, a database continua a mesma.
fica online, vou arrumar, só um segundo.
Desculpe, eu nao sei quase nada de script |:
Ok, estou no aguardo.
Entus, o script está apenas para mudar qualquer vocação para uma nova? Pq o que eu uso muda por exemplo: o master sorcerer para um vip master sorcerer e assim respectivamente, no caso eu teria de criar um item para cada?
Sim, para cada!
Editado Novembro 10 por Entus
info
Grupo: Campones
Registrado: 20/02/10
Posts: 55
Reputação: +1
Char no Tibia: Ynu

Sim, para cada!
Não funciona, nada acontece ao dar "use" apenas uma mensagem : "voce nao pode usar essa runa aqui" algo assim.
Mas agradeço pela ajuda!
Não funciona, nada acontece ao dar "use" apenas uma mensagem : "voce nao pode usar essa runa aqui" algo assim.
Mas agradeço pela ajuda!
Ah, eu testei em Tfs 1.0, vou fazer um mais elaborado e te mando no PM.
Até!
info
Grupo: Cavaleiro
Registrado: 01/04/13
Posts: 156
Reputação: +26
Gênero: Masculino
Char no Tibia: Yugami

la no actions.xml coloca
<action itemid="ID DO Item" event="script" value="nome do arquivo.lua"/>
o arquivo.lua coloca isso
local voc = 632 -- ID Da Vocation Que vai virar
local outfit = 916 -- Outfit Da outfit que vai ganhar
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 12832 then -- id do item que vai ter que clickar o mesmo que coloco la no .xml
doPlayerSetVocation(cid,voc)
doCreatureChangeOutfit(cid, {lookType = outfit})
doRemoveItem(item.uid,1)
end
return true
end
na minha opniao no caso da vocation não aparece no account manager pq você não duplica cada vocation e fais que ao deslonga ele simplesmente va para vocation Master X e quando ele deslonga pela 2x ele va para Master Y assim ele não aparece no account manager e resolve o problema
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Não vai funcionar assim, ele disse que a função não tá mudando permanentemente............
precisa de um query....
Eu já fiz, só que me enrolei no query, e não tá dando....
vou pro meu curso, quando voltar eu dou uma outra olhada, quem quiser corrigir:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,1992) == 1 then
doCreatureSay(cid, "Você já usou o golden papper.", TALKTYPE_ORANGE_1)
else if getPlayerLevel(cid) >= 8 then -- a partir de que level podera usar
doCreatureSay(cid, "Legendary!", TALKTYPE_ORANGE_1)
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 1 then
db.query('UPDATE `players` SET `vocation` = 5 WHERE `id` = '.. getPlayerGUID(cid))
doRemoveCreature(cid)
return true
end
if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 2 then
db.query('UPDATE `players` SET `vocation` = 6 WHERE `id` = '.. getPlayerGUID(cid))
doRemoveCreature(cid)
return true
end
if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 3 then
db.query('UPDATE `players` SET `vocation` = 7 WHERE `id` = '.. getPlayerGUID(cid))
doRemoveCreature(cid)
return true
end
if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 4 then
db.query('UPDATE `players` SET `vocation` = 8 WHERE `id` = '.. getPlayerGUID(cid))
doRemoveCreature(cid)
return true
end
return true
else
doCreatureSay(cid, "Você precisa estar level 8 ou mais para usar o Item!",TALKTYPE_ORANGE_1)
end
end
end
Editado Novembro 10 por Caronte
info
Grupo: Cavaleiro
Registrado: 05/01/08
Posts: 153
Reputação: +93
Char no Tibia: nenhum

Ah, eu testei em Tfs 1.0, vou fazer um mais elaborado e te mando no PM.
O que você alega é IMPOSSÍVEL, já que o script que você postou não funciona corretamente em NENHUMA VERSÃO DO TFS!!!
Vamos analisá-lo:
function onUse(cid, item, fromPosition, toPosition)
local voc = {1} --id da vocação
local scroll = {} --id do item
local efeito = {} -- efeito
if item.uid == scroll then
doPlayerSetVocation(cid, voc)
doSendMagicEffect(cid, efeito)
end
return true
end
Você declara as variáveis scroll, voc e efeito como tabelas... depois você quer comparar o uid do item com o itemid que o autor iria preencher na variável scroll, ou seja, NUNCA IRIA DAR CERTO, mas mesmo assim vamos continuar analisando. O modo que você pega os valores das variáveis scroll, voc e efeito está totalmente errado, pois se trata de tabelas, ou seja, você tem que especificar o índice, caso contrário irá retornar a própria tabela, tornando IMPOSSÍVEL sua função funcionar...
Não é a primeira vez que você posta algo sem saber... não digo que é para parar de postar e talz, porque é importante tentarmos ajudar, mas também é importante sabermos o que estamos fazendo e acima de tudo, REALMENTE TESTAR e postar antes de falar que testou.
Tentei fazer por query, ele altera quando roda o script, porém quando o player reloga o server retorna o valor da vocation na database para o que era... vou deixar a função com a alteração na query abaixo, caso queira usar para resolver o problema, pois tenho que ir trabalhar agora... no pior dos casos basta alterar o login.lua padrão...
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,1992) == 1 then
doCreatureSay(cid, "Você já usou o golden papper.", TALKTYPE_ORANGE_1)
else
if getPlayerLevel(cid) >= 8 then
doCreatureSay(cid, "Legendary!", TALKTYPE_ORANGE_1)
local voc = getPlayerVocation(cid)
if voc <= 4 then
doPlayerSetVocation(cid, voc + 4)
db.executeQuery("UPDATE `players` SET `vocation` = "..(voc + 4).." WHERE `id` = "..getPlayerGUID(cid)..";")
end
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)
setPlayerStorageValue(cid,1992,1)
return true
else
doCreatureSay(cid, "Você precisa estar level 8 ou mais para usar o Item!",TALKTYPE_ORANGE_1)
end
end
return true
end
Editado Novembro 10 por Antharaz
info
Grupo: Campones
Registrado: 20/02/10
Posts: 55
Reputação: +1
Char no Tibia: Ynu

Como posso fazer isso? nao faço a minima ideia de como mexer nisso oO
info
Grupo: Cavaleiro
Registrado: 05/01/08
Posts: 153
Reputação: +93
Char no Tibia: nenhum

Bem, é uma gambiarra, mas vai resolver... o script do action do seu item vai ser este:
function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid,1992) == 1 then doCreatureSay(cid, "Você já usou o golden papper.", TALKTYPE_ORANGE_1) else if getPlayerLevel(cid) >= 8 then doCreatureSay(cid, "Legendary!", TALKTYPE_ORANGE_1) local voc = getPlayerVocation(cid) if voc <= 4 then doPlayerSetVocation(cid, voc + 4) end doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS) doRemoveItem(item.uid) setPlayerStorageValue(cid,1992,1) else doCreatureSay(cid, "Você precisa estar level 8 ou mais para usar o Item!",TALKTYPE_ORANGE_1) end end return true end
Agora substitua seu login.lua pelo código abaixo:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type {account} to manage your account and if you want to start over then type {cancel}.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type {account} to create an account or type {recover} to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "petKill") registerCreatureEvent(cid, "loguthunt") registerCreatureEvent(cid, "huntdeath") registerCreatureEvent(cid, "killitem") registerCreatureEvent(cid, "SkullAmulet") registerCreatureEvent(cid, "SkullCheck") registerCreatureEvent(cid, "magebomb") registerCreatureEvent(cid, "perdereifeto") registerCreatureEvent(cid, "RushOutfit") registerCreatureEvent(cid, "pvpsystem") registerCreatureEvent(cid, "RushAttack") registerCreatureEvent(cid, "RushDead") registerCreatureEvent(cid, "petDeath") registerCreatureEvent(cid, "RushCombat") registerCreatureEvent(cid, "ReflectSpellKnight") registerCreatureEvent(cid, "ReflectSpellPally") registerCreatureEvent(cid, "ReflectSpellMage") registerCreatureEvent(cid, "TiraBattle") registerCreatureEvent(cid, "PointSystem") registerCreatureEvent(cid, "petSta") registerCreatureEvent(cid, "deathBroadcast") registerCreatureEvent(cid, "addons") registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "Reward")
end
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "advance")
registerCreatureEvent(cid, "FimVip")
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, VipReceive)
registerCreatureEvent(cid, "PlayerKill")
if (InitArenaScript ~= 0) then
InitArenaScript = 1
-- make arena rooms free
for i = 42300, 42309 do
setGlobalStorageValue(i, 0)
setGlobalStorageValue(i+100, 0)
end
end
-- if he did not make full arena 1 he must start from zero
if getPlayerStorageValue(cid, 42309) < 1 then
for i = 42300, 42309 do
setPlayerStorageValue(cid, i, 0)
end
end
-- if he did not make full arena 2 he must start from zero
if getPlayerStorageValue(cid, 42319) < 1 then
for i = 42310, 42319 do
setPlayerStorageValue(cid, i, 0)
end
end
-- if he did not make full arena 3 he must start from zero
if getPlayerStorageValue(cid, 42329) < 1 then
for i = 42320, 42329 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42355) == -1 then
setPlayerStorageValue(cid, 42355, 0) -- did not arena level
end
setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
setPlayerStorageValue(cid, 42352, 0) -- is not in arena
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid,1992) == 1 and getPlayerLevel(cid) >= 8 and voc <= 4 then
doPlayerSetVocation(cid, voc + 4)
end
return true
end
info
Grupo: Campones
Registrado: 20/02/10
Posts: 55
Reputação: +1
Char no Tibia: Ynu

Muito obrigado Antharaz! Estou a mt tempo tentando resolver isso!
Agradeço mt!
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Bem, é uma gambiarra, mas vai resolver... o script do action do seu item vai ser este:
function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid,1992) == 1 then doCreatureSay(cid, "Você já usou o golden papper.", TALKTYPE_ORANGE_1) else if getPlayerLevel(cid) >= 8 then doCreatureSay(cid, "Legendary!", TALKTYPE_ORANGE_1) local voc = getPlayerVocation(cid) if voc <= 4 then doPlayerSetVocation(cid, voc + 4) end doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS) doRemoveItem(item.uid) setPlayerStorageValue(cid,1992,1) else doCreatureSay(cid, "Você precisa estar level 8 ou mais para usar o Item!",TALKTYPE_ORANGE_1) end end return true end
Agora substitua seu login.lua pelo código abaixo:
local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type {account} to manage your account and if you want to start over then type {cancel}.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type {account} to create an account or type {recover} to recover an account.") end if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "petKill") registerCreatureEvent(cid, "loguthunt") registerCreatureEvent(cid, "huntdeath") registerCreatureEvent(cid, "killitem") registerCreatureEvent(cid, "SkullAmulet") registerCreatureEvent(cid, "SkullCheck") registerCreatureEvent(cid, "magebomb") registerCreatureEvent(cid, "perdereifeto") registerCreatureEvent(cid, "RushOutfit") registerCreatureEvent(cid, "pvpsystem") registerCreatureEvent(cid, "RushAttack") registerCreatureEvent(cid, "RushDead") registerCreatureEvent(cid, "petDeath") registerCreatureEvent(cid, "RushCombat") registerCreatureEvent(cid, "ReflectSpellKnight") registerCreatureEvent(cid, "ReflectSpellPally") registerCreatureEvent(cid, "ReflectSpellMage") registerCreatureEvent(cid, "TiraBattle") registerCreatureEvent(cid, "PointSystem") registerCreatureEvent(cid, "petSta") registerCreatureEvent(cid, "deathBroadcast") registerCreatureEvent(cid, "addons") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Idle") if(config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") registerCreatureEvent(cid, "Reward") end registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "AdvanceSave") registerCreatureEvent(cid, "advance") registerCreatureEvent(cid, "FimVip") registerCreatureEvent(cid, "SkullCheck") registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, VipReceive) registerCreatureEvent(cid, "PlayerKill") if (InitArenaScript ~= 0) then InitArenaScript = 1 -- make arena rooms free for i = 42300, 42309 do setGlobalStorageValue(i, 0) setGlobalStorageValue(i+100, 0) end end -- if he did not make full arena 1 he must start from zero if getPlayerStorageValue(cid, 42309) < 1 then for i = 42300, 42309 do setPlayerStorageValue(cid, i, 0) end end -- if he did not make full arena 2 he must start from zero if getPlayerStorageValue(cid, 42319) < 1 then for i = 42310, 42319 do setPlayerStorageValue(cid, i, 0) end end -- if he did not make full arena 3 he must start from zero if getPlayerStorageValue(cid, 42329) < 1 then for i = 42320, 42329 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42355) == -1 then setPlayerStorageValue(cid, 42355, 0) -- did not arena level end setPlayerStorageValue(cid, 42350, 0) -- time to kick 0 setPlayerStorageValue(cid, 42352, 0) -- is not in arena local voc = getPlayerVocation(cid) if getPlayerStorageValue(cid,1992) == 1 and getPlayerLevel(cid) >= 8 and voc <= 4 then doPlayerSetVocation(cid, voc + 4) end return true end
Gambiarra mesmo eim, kkkkk.
info
Grupo: Campones
Registrado: 20/02/10
Posts: 55
Reputação: +1
Char no Tibia: Ynu
EAE,
to precisando de uma ajuda com uma action, que ao usar o item, o player troca de vocação, tipo uma promotion, porem como a vocação é VIP, ela nao pode aparecer no acc manager.
Estou usando o seguinte script:
function onUse(cid, item, fromPosition, itemEx, toPosition)
Meu vocations.xml :
<?xml version="1.0" encoding="UTF-8"?>