Jump to content

Wand of Elements


Bruno

Recommended Posts

Introdução:

É uma wand que ataca vários elementos aleatoriamente, porém não somente isso, você pode travar um único elemento através de uma talkaction.

 

OBS: Testado em tfs 0.4

 

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:

Agradeço MaXwEllDeN pela ajuda.

Link to comment
Share on other sites

ficaria legal se para mudar e travar no elemento fosse por click ai dava use na wand e aparece o elemento em você e mudava o elemento da wand ficaria bem legal

Link to comment
Share on other sites

ficaria legal se para mudar e travar no elemento fosse por click ai dava use na wand e aparece o elemento em você e mudava o elemento da wand ficaria bem legal

É uma possibilidade sim :)

 

Massa D+, prescisamos trocar uma ideia sobre scripts, você me ensinar um pouco.

Rep+.

Obrigado man.

Opa, claro, podemos conversar sim!

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Oi isto aqui foi testado en TFS 1.2? Versao do server 10.78? Server?

 

Obrigada...

 

Tou querendo façer uma, so que nao com wand senao com axe,sword, club, arrow... vc acha quee é posibel que ele ataque com elementos?

 

parabens pelo scritp acho que ta otima a ideia :D +REP

Link to comment
Share on other sites

Oi isto aqui foi testado en TFS 1.2? Versao do server 10.78? Server?

 

Obrigada...

 

Tou querendo façer uma, so que nao com wand senao com axe,sword, club, arrow... vc acha quee é posibel que ele ataque com elementos?

 

parabens pelo scritp acho que ta otima a ideia :D +REP

Testado em tfs 0.4

Obrigado :)

Link to comment
Share on other sites

caramba muito legal, gostei da ideia do Click por elemento, se o bruno puder incrementar no tópico eu agradeço

Abraços Brunão

Vlw man :)

Assim que eu tiver com um tempinho eu implemento ^^

Abraço!

Link to comment
Share on other sites

×
×
  • Create New...