Ir para conteúdo
  • Cadastre-se

(Resolvido)Mudar Elemento dá Wand por Item


Ir para solução Resolvido por gabrielzika,

Posts Recomendados

  • Respostas 49
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

@Gabrielk  function onUse(cid, item, fromPos, itemEx, toPos) ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden ItemIce = 13744 ItemEarth = 13745 ItemDeath = 13746 ItemEne

@Gabrielk ai Mano function onUse(cid, item, fromPos, itemEx, toPos) ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden ItemIce = 13744 ItemPoison = 13745 ItemDeath = 13746

function onUse(cid, item, fromPos, itemEx, toPos) ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden ItemIce = 13744 ItemPoison = 13745 ItemDeath = 13746 ItemEnergy = 13747 It

@Gabrielk testa com essas 5 se funciona... se funcionar me fala!

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local wandid1 = 7735 -- ID da Wand 1 
local wandid2 = 7736 -- ID da Wand 2 
local wandid3 = 7737 -- ID da Wand 3
local wandid4 = 7738 -- ID da Wand 4
local wandid5 = 7739 -- ID da Wand 5


    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 
	
	local wands1 = wand_left ~= wandid1 and wand_right ~= wandid1
	local wands2 = wand_left ~= wandid2 and wand_right ~= wandid2
    local wands3 = wand_left ~= wandid3 and wand_right ~= wandid3
	local wands4 = wand_left ~= wandid4 and wand_right ~= wandid4
	local wands5 = wand_left ~= wandid5 and wand_right ~= wandid5

    if wands1 or wands2 or wands3 or wands4 or wands5 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk

 

Ve se assim vai...

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local wandid1 = 7735 -- ID da Wand 1 
local wandid2 = 7736 -- ID da Wand 2 
local wandid3 = 7737 -- ID da Wand 3
local wandid4 = 7738 -- ID da Wand 4
local wandid5 = 7739 -- ID da Wand 5


    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).uid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid
	
	local wands1 = wand_left ~= wandid1 and wand_right ~= wandid1
	local wands2 = wand_left ~= wandid2 and wand_right ~= wandid2
    local wands3 = wand_left ~= wandid3 and wand_right ~= wandid3
	local wands4 = wand_left ~= wandid4 and wand_right ~= wandid4
	local wands5 = wand_left ~= wandid5 and wand_right ~= wandid5

    if wands1 or wands2 or wands3 or wands4 or wands5 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local wandid1 = 7735 -- ID da Wand 1 


    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).uid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid
	
	local wands1 = wand_left ~= wandid1 and wand_right ~= wandid1

    if wands1 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk

 

tenta assim, se funcionar eu coloco pra por em outras wands...

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local id = 7735 -- ID da Wand 1 
  
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 

    if wand_left ~= id and wand_right ~= id then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk Test, tenta com essas duas...

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local id = 7735 -- ID da Wand 1 
local id2 = 7736 -- ID da Wand 2  
  
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 

    if wand_left ~= id and wand_right ~= id or wand_left ~= id2 and wand_right ~= id2 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk testa agora

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local id = 7735 -- ID da Wand 1 
local id2 = 7736 -- ID da Wand 2  
  
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 

    if (wand_left ~= id and wand_right ~= id) or (wand_left ~= id2 and wand_right ~= id2) then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrielk

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 13743 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 13744
ItemPoison = 13745
ItemDeath = 13746
ItemEnergy = 13747
ItemPhysical = 13748
ItemHoly = 13749
  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local id = 7735 -- ID da Wand 1 
local id2 = 7736 -- ID da Wand 2  
  
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 

    if wand_left ~= id and wand_right ~= id and wand_left ~= id2 and wand_right ~= id2 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@gabrielzika Funcionou mano. Rep ++

poderia me ajudar também em uma coisa relacionada já ao script.

Tipo, quando eu mudo o elemento e se depois eu passar a wand que eu tava usando que eu mudei o elemento para outro player, a wand fica atacando com todos os elementos, poderia ajeitar isso ? para quando outro player pegar a wand e não tiver elemento. ficar só no physcal.

Spoiler

local min, max = 630,720 --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

 

e se eu quiser adicionar mais wands nesse seu script como faz ?

Link para o post
Compartilhar em outros sites

@Gabrielk sobre como por mais wands, agora a outra eu não entendi, me explica!

 

 

function onUse(cid, item, fromPos, itemEx, toPos)

ItemFire = 12601 -- ID dos Itens que precisa pra cada efeito... by: garden
ItemIce = 12429
ItemPoison = 12599
ItemDeath = 12367
ItemEnergy = 12383
ItemPhysical = 13748
ItemHoly = 12602

  
local types = {
      [ItemFire] = {effect = 1, name = "fire"},  -- [ItemID] = {effect = Numero do Efeito, name = Nome do Efeito}
      [ItemIce] = {effect = 2, name = "ice"},
      [ItemPoison] = {effect = 3, name = "poison"},
      [ItemDeath] = {effect = 4, name = "death"},
      [ItemEnergy] = {effect = 5, name = "energy"},
      [ItemPhysical] = {effect = 6, name = "energy"},
      [ItemHoly] = {effect = 7, name = "holy"}
}

local wandid1 = 7735 -- ID da Wand 1 
local wandid2 = 12671 -- ID da Wand 2 
local wandid3 = 12672 -- ID da Wand 3
local wandid4 = 12673 -- ID da Wand 4
local wandid5 = 12674 -- ID da Wand 5
local wandid6 = 12675 -- ID da Wand 6
local wandid7 = 12676 -- ID da Wand 7
local wandid8 = 12677 -- ID da Wand 8
local wandid9 = 12678 -- ID da Wand 9
local wandid10 = 12679 -- ID da Wand 10


    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid 
    
    local wands1 = wand_left ~= wandid1 and wand_right ~= wandid1
    local wands2 = wand_left ~= wandid2 and wand_right ~= wandid2
    local wands3 = wand_left ~= wandid3 and wand_right ~= wandid3
    local wands4 = wand_left ~= wandid4 and wand_right ~= wandid4
    local wands5 = wand_left ~= wandid5 and wand_right ~= wandid5
    local wands6 = wand_left ~= wandid6 and wand_right ~= wandid6
    local wands7 = wand_left ~= wandid7 and wand_right ~= wandid7
    local wands8 = wand_left ~= wandid8 and wand_right ~= wandid8
    local wands9 = wand_left ~= wandid9 and wand_right ~= wandid9
    local wands10 = wand_left ~= wandid10 and wand_right ~= wandid10

    if wands1 and wands2 and wands3 and wands4 and wands5 and wands6 and wands7 and wands8 and wands9 and wands10 then
        doPlayerSendCancel(cid, "Voce deve estar com a wand equipada para usar este efeito.")
        return true
    end
    
    status = getPlayerStorageValue(cid, 4561)
    if status == types[item.itemid].effect then
        doPlayerSendTextMessage(cid, 27, "Desculpe, mais você já está usando o efeito ".. types[item.itemid].name .. ".")
        return true
    end

     setPlayerStorageValue(cid, 4561, types[item.itemid].effect)
     doPlayerSendTextMessage(cid, 27 , "Você mudou o elemento da wand para ".. types[item.itemid].name .. ".")
     doRemoveItem(item.uid, 1)
   return true
end

 

Link para o post
Compartilhar em outros sites

@gabrielzika Tipo assim o script que eu te passei lá em cima é dá wand, dos elementos. Só que ai é por storage a mudança de elemento, então ex: Eu usei o elemento holy(ganhei a storage holy) ai eu to com a wand e tal, mais ai eu vou vender ela. o Elemento muda pelo storage, então se o outro player que eu passar a wand não tiver qualquer storage de elemento, ele fica batendo random todos os elementos. Eu queria que quando a nova pessoa pegasse e que não tivesse nenhum elemento ativo, ficasse com o dano Physical

Link para o post
Compartilhar em outros sites

@Gabrielk bom, não entendi muito bem... mas ve se tá certo

 

 

local min, max = 630,720 --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[6]
                doSendDistanceShoot(getThingPos(cid), getThingPos(target), wx.sh)
                addEvent(doAreaCombatHealth, 100, cid, wx.dmg, getThingPos(target), 0, -min, -max, wx.ef)
        end
        return true
end
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.


×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo