Olá, galerinha do xtibia vi esse sistema em 1 site e eles estavam vendendo por 9,90 então resolvi fazer e postar de graça
primeiramente va em
data/talkactions/scripts crie um arquivo chamando wand.lua e coloque isso dentro
function onSay(cid, words, param)
local param = string.lower(param)
local table = {
["fire"] = 12031,
["ice"] = 12032,
["earth"] = 12033,
["death"] = 12034,
["energy"] = 12035,
["holy"] = 12036
}
local id = 12609 --- aqui vai o id da wand
local a = table[param]
if not a then
doPlayerSendTextMessage(cid, 28, "Digite !wand info para saber os elementos disponiveis")
return true
end
if (param == "info") then
for element, stor in pairs(table) do
text = "Elementos: "..element..""
doPlayerPopupFYI(cid, text)
end
end
if getPlayerItemCount(cid, id) >= 1 then
setPlayerStorageValue(cid, 12031, 0)
setPlayerStorageValue(cid, 12032, 0)
setPlayerStorageValue(cid, 12033, 0)
setPlayerStorageValue(cid, 12034, 0)
setPlayerStorageValue(cid, 12035, 0)
setPlayerStorageValue(cid, 12036, 0)
setPlayerStorageValue(cid, a, 1)
doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. param .. ".")
else
doPlayerSendTextMessage(cid, 28, "Desculpe, mais você precisa ter a ".. getItemNameById(id) .. " para trocar o elemento.")
end
return true
end
em talkactions.xml
<talkaction words="!wand" event="script" value="wand.lua"/>
agora em data/weapons/scripts crie um arquivo e renomeie para wand1.lua e adicione isso dentro:
w = {
[12031] = {ef = 36, sh = 3, dmg = COMBAT_FIREDAMAGE},
[12032] = {ef = 42, sh = 28, dmg = COMBAT_ICEDAMAGE},
[12033] = {ef = 45, sh = 38, dmg = COMBAT_POISONDAMAGE},
[12034] = {ef = 17, sh = 31, dmg = COMBAT_DEATHDAMAGE},
[12035] = {ef = 11, sh = 35, dmg = COMBAT_ENERGYDAMAGE},
[12036] = {ef = 49, sh = 37, dmg = COMBAT_HOLYDAMAGE}
}
function onUseWeapon(cid, var)
min, max = 300, 300 -- dano minimo e maximo
target = getCreatureTarget(cid)
for stor, info in pairs(w) do
if getPlayerStorageValue(cid, stor) == 1 then
if target ~= 0 then
doSendDistanceShoot(getThingPos(cid), getThingPos(target), info.sh)
addEvent(doAreaCombatHealth, 100, cid, info.dmg, getThingPos(target), 0, -min, -max, info.ef)
end
end
end
return true
end
em weapons.xml
<wand id="xxx" level="50" mana="13" min="0" max="0" type="earth" event="script" value="wand1.lua"> <!-- wand of effects --> <vocation id="1"/> <vocation id="2"/> <vocation id="5"/> <vocation id="6"/>
em items.xml
<item id="xxx" article="the" name="nome da sua wand"> <attribute key="description" value="Você pode mudar o elemento da wand digitando !wand elemento desejado." /> <attribute key="weight" value="2300" /> <attribute key="weaponType" value="wand" /> <attribute key="shootType" value="holy" /> <attribute key="range" value="8" />
em data/creaturescripts/scripts login.lua antes do ultimo return true adicione essa linha:
if getPlayerStorageValue(cid, 12036) == -1 then setPlayerStorageValue(cid, 12036, 1) end
PS : Testado, e funcionando
PS2 : Podem postar em outros fórums se colocarem créditos
PS3 : Tem que ser o mesmo id em items.xml talkactions.xml e weapons.xml




















