Por
Bruno Minervino
Introdução:
É uma wand que ataca vários elementos aleatoriamente, porém não somente isso, você pode alterar o elemento dela com uma talkaction.
Instalação:
Vá até data/weapons/scripts e crie um arquivo chamando wandelementos.lua e coloque o seguinte conteúdo:
local min, max = 1700,1900 --Ataque mínino e ataque máximo
local w = {
[1] = {ef = 36, sh = 3, dmg = COMBAT_FIREDAMAGE},
[2] = {ef = 42, sh = 28, dmg = COMBAT_ICEDAMAGE},
[3] = {ef = 46, sh = 38, dmg = COMBAT_POISONDAMAGE},
[4] = {ef = 17, sh = 31, dmg = COMBAT_DEATHDAMAGE},
[5] = {ef = 47, sh = 35, dmg = COMBAT_ENERGYDAMAGE},
[6] = {ef = 36, sh = 31, dmg = COMBAT_PHYSICALDAMAGE},
[7] = {ef = 49, sh = 37, dmg = COMBAT_HOLYDAMAGE}
}
function onUseWeapon(cid, var)
local effect = getPlayerStorageValue(cid, 4561)
local target = getCreatureTarget(cid)
if target ~= 0 then
local wx = w[effect] or w[math.random(#w)]
doSendDistanceShoot(getThingPos(cid), getThingPos(target), wx.sh)
addEvent(doAreaCombatHealth, 100, cid, wx.dmg, getThingPos(target), 0, -min, -max, wx.ef)
end
return true
end
Altere o min e max de acordo com sua necessidade.
Agora vá em data/weapons/weapons.xml e coloque o seguinte conteúdo:
<wand id="7424" level="100" mana="30" event="script" value="wandelementos.lua">
<vocation id="1"/>
<vocation id="2"/>
<vocation id="5" showInDescription="0"/>
<vocation id="6" showInDescription="0"/>
</wand>
Altere o id, level e mana de acordo com sua necessidade.
Agora vamos configurar a talkaction que troca os elementos.
Vá até data/talkactions/scripts e crie um arquivo chamando elementos.lua e coloque o seguinte conteúdo:
local config = {
wand_id = 7424, --ID da wand
types = {
["all"] = -1, --Ataca os elementos aleatoriamente
["fire"] = 1,
["ice"] = 2,
["poison"] = 3,
["death"] = 4,
["energy"] = 5,
["physical"] = 6,
["holy"] = 7
}
}
function onSay(cid, words, param)
local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid
if wand_left ~= config.wand_id and wand_right ~= config.wand_id then
doPlayerSendCancel(cid, "Voce deve estar equipado com uma ".. getItemNameById(config.wand_id) .." para usar este comando.")
return true
end
if config.types[param] then
setPlayerStorageValue(cid, 4561, config.types[param])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Sua wand ira atacar ".. param .. ".")
else
local str = ""
for i, _ in pairs(config.types) do
str = str .. ", ".. i
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Os elementos disponiveis sao: ".. string.sub(str, 3, #str) ..".")
end
return true
end
Altere o wand_id conforme configurado em weapons.
Agora vá em data/talkactions/talkactions.xml e coloque o seguinte conteúdo:
<talkaction words="!elemento;/elemento" event="script" value="elementos.lua"/>
Exemplo de funcionamento:
https://www.youtube.com/watch?v=HHmZ1RpsrD0
Gostaria de deixar um agradecimento especial para MaXwEllDeN, pela ajuda.
Posts Recomendados
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.