Ir para conteúdo

Posts Recomendados

Olá Xtibianos!

Vim trazer este script bem criativo. Ele permite você mudar o elemento da wand/rod que escolher. Siga as instruções para que funcione corretamente.

 

Créditos:

StrutZ (Otland)

Jano (Otland)

Non Sequitur (Otland)

 

EXPLICAÇÃO

http://imgur.com/kvBzDh5

 

REQUISITOS

 

 

INFORMAÇÕES

-- Config-- Set wand how the wand deals damageDamageTypeWand = {   values = false, -- If this is set to true then it will use the min and max values. If set to false the wand will use the formula     -- Damage Values min/max   wandMinDam = 20,   wandMaxDam = 50,     -- Damage Formula   formula = {     wandMinDam = function(level, maglevel) return -((level / 5) + (maglevel * 1.4) + 8) end,     wandMaxDam = function(level, maglevel) return -((level / 5) + (maglevel * 2.2) + 14) end,   }}-- Modal window config and storage idlocal config = {   storage = 10009,   titleMsg = "Change Weapon Damage Type",   mainMsg = "Choose a damage type from the list",-- End Config   -- Damage Table   [1] = {element = "Holy"},   [2] = {element = "Fire"},   [3] = {element = "Death"},   [4] = {element = "Poison"},   [5] = {element = "Energy"},   [6] = {element = "Earth"},   [7] = {element = "Ice"},}

 

INSTALAÇÃO

  • Instale o Modal Window Helper, citado acima 
  • Registre o script /data/actions/actions.xml adicionando esta linha (Substituindo "ITEMID" com o item que você quiser usar:
<action itemid="ITEMID" script="weapon_damage"/>
<action actionid="ACTIONID" script="weapon_damage"/>

 

  • Crie um novo documento de texto em /data/actions/scripts e nomeie para "weapon_damage.lua" e cole o seguinte:
-- Config -- Set wand how the wand deals damageDamageTypeWand = {    values = false, -- If this is set to true then it will use the min and max values. If set to false the wand will use the formula       -- Damage Values min/max    wandMinDam = 20,    wandMaxDam = 50,       -- Damage Formula    formula = {        wandMinDam = function(level, maglevel) return -((level / 5) + (maglevel * 1.4) + 8) end,        wandMaxDam = function(level, maglevel) return -((level / 5) + (maglevel * 2.2) + 14) end,    }} -- Modal window config and storage idlocal config = {    storage = 10009,    titleMsg = "Change Weapon Damage Type",    mainMsg = "Choose a damage type from the list",-- End Config     -- Damage Table    [1] = {element = "Holy"},    [2] = {element = "Fire"},    [3] = {element = "Death"},    [4] = {element = "Poison"},    [5] = {element = "Energy"},    [6] = {element = "Earth"},    [7] = {element = "Ice"},} function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)    player:sendDamageWindow(config)    return trueend

 

  • Adicione esta linha no seu global.lua:
dofile('data/lib/weapon_damage.lua')
  • Crie um novo documento de texto em /data/lib/ e renomeie para "weapon_damage.lua" e cole isto:
function Player:sendDamageWindow(config)    local function buttonCallback(button, choice)    -- Modal window functionallity        if button.text == "Confirm" then            self:setStorageValue(10009, choice.id)        end    end   -- Modal window design    local window = ModalWindow {        title = config.titleMsg, -- Title of the modal window        message = config.mainMsg, -- The message to be displayed on the modal window    }     -- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)    window:addButton("Confirm", buttonCallback)    window:addButton("Cancel")     -- Set what button is pressed when the player presses enter or escape    window:setDefaultEnterButton("Confirm")    window:setDefaultEscapeButton("Cancel")     -- Add choices from the action script    for i = 1, #config do    local o = config[i].element        window:addChoice(o)    end     -- Send the window to player    window:sendToPlayer(self)end



Registre o item em /data/weapons/weapons.xml Adicionando essa linha:
Essa linha é para se você estiver usando wand

<wand id="ITEM ID HERE" level="300" mana="20" script="weapon_damage.lua"><!-- Shadow's Sceptre --> <vocation name="Sorcerer" /> </wand>

 

Crie um novo documento de texto em /data/weapons/scripts e nomeie para "weapon_damage.lua" e cole:
 

local DamageTypes = {    [1] = {DamageType = COMBAT_HOLYDAMAGE, DamageEffect = CONST_ANI_HOLY},    [2] = {DamageType = COMBAT_FIREDAMAGE, DamageEffect = CONST_ANI_FIRE},    [3] = {DamageType = COMBAT_DEATHDAMAGE, DamageEffect = CONST_ANI_DEATH},    [4] = {DamageType = COMBAT_POISONDAMAGE, DamageEffect = CONST_ANI_POISON},    [5] = {DamageType = COMBAT_ENERGYDAMAGE, DamageEffect = CONST_ANI_ENERGY},    [6] = {DamageType = COMBAT_EARTHDAMAGE, DamageEffect = CONST_ANI_EARTH},    [7] = {DamageType = COMBAT_ICEDAMAGE, DamageEffect = CONST_ANI_ICE}} function onGetFormulaValues(player, level, maglevel)    if DamageTypeWand.values == true then        min = -(DamageTypeWand.wandMinDam)        max = -(DamageTypeWand.wandMaxDam)    else        min = DamageTypeWand.formula.wandMinDam(level, maglevel)        max = DamageTypeWand.formula.wandMaxDam(level, maglevel)    end    return min, maxend local combat = {}for k, dam_Table in pairs(DamageTypes) do    combat[k] = Combat()    combat[k]:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)    combat[k]:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)    combat[k]:setParameter(COMBAT_PARAM_TYPE, dam_Table.DamageType)    combat[k]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, dam_Table.DamageEffect)       -- _G Is used to manually define 'onGetFormulaValues' in this loop in doesnt seem to be able to find the function.    _G['onGetFormulaValues' .. k] = onGetFormulaValues    combat[k]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues" .. k)end function onUseWeapon(player, var)    local value = player:getStorageValue(10009)    local combatUse = combat[value]    if not combatUse then        return true    end    return combatUse:execute(player, var)end

 

Link para o comentário
Compartilhar em outros sites

  • 8 months later...
Em 27/03/2017 at 13:48, Zero Cast disse:

 

Eu não entendia como instalá-lo, poderia explicar melhor?

 

Dica! Os posts abaixo contém apenas downloads

Se estiver procurando por tutoriais de scripting, acesse:

 

Caso queira suporte scripting, acesse:

 

Faça bom uso da seção! ~ Equipe Xtibia.com

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...