Olá, amigos. Eu sei que deve ter algo do tipo aqui no xTibia, mas essa versão que eu criei há muito tempo está o mais completo possível.
Consiste no item Jester Staff transformado no item Elemental Staff, que ao dar Use, muda o elemento e o projétil que sai do cajado.
Pra começar, vamos no items.xml e procuramos o item "Jester Staff" (id 7958)
Vocês vão substituir desde isso:
<item id="7958" article="a" name="jester staff">
até isso:
</item>
Por isso:
<item id="7958" article="a" name="elemental staff"> <attribute key="description" value="Use this item to change its element." /> <attribute key="weight" value="2300" /> <attribute key="weaponType" value="wand" /> <attribute key="range" value="3" /> </item>
Agora, no actions.xml, adicionam a tag:
<action itemid="7958" event="script" value="elemental_staff.lua"/>
E no arquivo elemental_staff.lua, adicionem o seguinte:
function onUse(cid, item, fromPosition, itemEx, toPosition) local st = 2482 local old = getPlayerStorageValue(cid,st) local fromto = {[1] = {15,2},[2] = {46,3},[3] = {47,4},[4] = {41,5},[5] = {39,6},[6] = {17,1} } if getPlayerStorageValue(cid,st) == -1 then setPlayerStorageValue(cid,st,1) old = getPlayerStorageValue(cid,st) end setPlayerStorageValue(cid,st,fromto[getPlayerStorageValue(cid,st)][2]) local gt = getPlayerStorageValue(cid,st) local msgs = {"Fogo","Terra","Energia","Gelo","Sagrado","Escuridão"} doPlayerSendTextMessage(cid,4,"Elemento mudado de \'"..msgs[old].."\' para \'"..msgs[gt].."\'.") doSendMagicEffect(getThingPos(cid),fromto[gt][1]) return true end
Ótimo. O último passo é no weapons.xml, adicionar a tag:
<wand id="7958" level="70" mana="2" min="0" max="0" type="earth" event="script" value="elemental_staff.lua"> <!-- Elemental Staff --> <vocation id="1"/> <vocation id="2"/> </wand>
E no arquivo elemental_staff.lua na pasta scripts adicionar o seguinte:
local min = 65 local max = 100 function damage(cid,type,target,effect) doAreaCombatHealth(cid, type, getThingPos(target), 0, -1*(min), -1*(max), effect) function onUseWeapon(cid, var) local st = 2482 local gt = getPlayerStorageValue(cid,st) local types = { [1] = {3,COMBAT_FIREDAMAGE,15}, [2] = {29,COMBAT_EARTHDAMAGE,46}, [3] = {4,COMBAT_ENERGYDAMAGE,47}, [4] = {28,COMBAT_ICEDAMAGE,41}, [5] = {37,COMBAT_HOLYDAMAGE,39}, [6] = {10,COMBAT_DEATHDAMAGE,17} } if gt == -1 then setPlayerStorageValue(cid,st,1) end local distance = types[gt][1] local type = types[gt][2] local effect = types[gt][3] local target = getCreatureTarget(cid) doSendDistanceShoot(getThingPos(cid),getThingPos(target),distance) addEvent(damage,100,cid,type,target,effect) return true end
Notem que nas primeiras 2 linhas tem as variáveis min e max, que representam respectivamente o dano mínimo e o dano máximo do cajado.
É isso, flw