Parabéns pelo conteúdo, obrigado por compartilhar com o fórum.
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Aprender spells por comando
TA
action
Aprender spells por comando
Por TaaG, 14 de nov. de 2015 em Actions e Talkactions
spells
magia
tibia
command
aprender
learn
2
1.9k


info
Grupo: Artesão
Registrado: 19/11/12
Posts: 113
Reputação: +63
Essa talkaction serve para que o player execute tal comando para aprender a tal spell se tiver a quantidade certa do item.
Exemplo:
!learnspell exori frigo
Se quiser usar só uma quantidade de um único item por spell:
aprendespell.lua (data/talkactions/scripts)
local tab = { ["exori frigo"] = {spell = "Ice Strike", item = {1234, 5}}, -- ["nome da spell"] = {spell = "nome da conjuração da spell", item = {itemid, quantidade}}, ["exori mort"] = {spell = "Death Strike", item = {1234, 5}}, ["exori vis"] = {spell = "Energy Strike", item = {1234, 5}}, ["exori flam"] = {spell = "Flame Strike", item = {1234, 5}}, ["exori tera"] = {spell = "Terra Strike", item = {1234, 5}}, ["exori san"] = {spell = "Divine Missile", item = {1234, 5}} } function onSay(cid, words, param, channel) local sparam = string.lower(param) if(param == "") then return doPlayerSendCancel(cid, "Enter the name of the spell you want to learn.") end if not (tab[sparam]) then return doPlayerSendCancel(cid, "Spell not found.") end if(getPlayerLearnedInstantSpell(cid, tab[sparam].spell)) then return doPlayerSendCancel(cid, "You already have learned this spell.") end if(getPlayerItemCount(cid, tab[sparam].item[1]) >= tab[sparam].item[2]) then doPlayerLearnInstantSpell(cid, tab[sparam].spell) doPlayerRemoveItem(cid, tab[sparam].item[1], tab[sparam].item[2]) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned the spell!") else doPlayerSendCancel(cid, "You need "..tab[sparam].item[2].." "..getItemNameById(tab[sparam].item[1]).." to learn this spell.") end return true endJá se quiser 2 itens por spell, use este script (mesmo arquivo):
local tab = { ["exori frigo"] = {spell = "Ice Strike", item = {1234, 5}, item2 = {5678, 9}}, -- ["nome da spell"] = {spell = "nome da conjuração da spell", item = {itemid, quantidade}, item2 = {itemid, quantidade}}}, ["exori mort"] = {spell = "Death Strike", item = {1234, 5}, item2 = {5678, 9}}, ["exori vis"] = {spell = "Energy Strike", item = {1234, 5}, item2 = {5678, 9}}, ["exori flam"] = {spell = "Flame Strike", item = {1234, 5}, item2 = {5678, 9}}, ["exori tera"] = {spell = "Terra Strike", item = {1234, 5}, item2 = {5678, 9}}, ["exori san"] = {spell = "Divine Missile", item = {1234, 5}, item2 = {5678, 9}} } function onSay(cid, words, param, channel) local sparam = string.lower(param) if(param == "") then return doPlayerSendCancel(cid, "Coloque o nome da spell que deseja aprender.") end if not (tab[sparam]) then return doPlayerSendCancel(cid, "Spell not found.") end if(getPlayerLearnedInstantSpell(cid, tab[sparam].spell)) then return doPlayerSendCancel(cid, "You already have learned this spell.") end if(getPlayerItemCount(cid, tab[sparam].item[1]) >= tab[sparam].item[2] and (getPlayerItemCount(cid, tab[sparam].item2[1]) >= tab[sparam].item2[2])) then doPlayerLearnInstantSpell(cid, tab[sparam].spell) doPlayerRemoveItem(cid, tab[sparam].item[1], tab[sparam].item[2]) doPlayerRemoveItem(cid, tab[sparam].item2[1], tab[sparam].item2[2]) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned the spell!") else doPlayerSendCancel(cid, "You need "..tab[sparam].item[2].." "..getItemNameById(tab[sparam].item[1]).." and "..tab[sparam].item2[2].." "..getItemNameById(tab[sparam].item2[1]).." to learn this spell.") end return true endtalkactions.xml (data/talkactions/scripts):
Não se esqueça de ativar a obtenção da spell na tag da mesma.
É só mudar o valor, de 0 para 1, onde está escrito needlearn:
Créditos: Suicide/Wise
Editado Novembro 14 por TaaG