Ir para conteúdo
  • 0

Sistema Refinamento Nao Funfa


gruly

Pergunta

Daw galera do xtibia

entao eu tentei todos os sistema de refinamento que achieo no google e nen um deles funfo

pq tipo assim,eu uso o item na demon armor e outros itens aparece que nao pode refinar esse item.

entao qual item pode refinar???

SCRIPT

local gain = {

gainArmor='&p+1',loseArmor='&p-1',

gainShield='&s+1',loseShield='&s-1',

gainAttack='&a+1',loseAttack='&a-1',

gainDefense='&d+1',loseDefense='&d-1',

chance='40/((#*(1/(@/1)))*(@/1))',

maxlvl = 7,

reqvoc = {20, 21},

blocked_ids = {8881}

}

 

if not setItemName then

function setItemName(uid,name)

return doItemSetAttribute(uid,'name',name)

end

function setItemArmor(uid,name)

return doItemSetAttribute(uid,'armor',name)

end

function setItemDefense(uid,name)

return doItemSetAttribute(uid,'defense',name)

end

function setItemAttack(uid,name)

return doItemSetAttribute(uid,'attack',name)

end

function getItemAttack(uid)

return getItemAttribute(uid,'attack')

end

function getItemDefense(uid)

return getItemAttribute(uid,'defense')

end

function getItemArmor(uid)

if type(uid) == 'number' then

return getItemAttribute(uid,'armor')

else

return getItemInfo(uid.itemid).armor

end

end

end

function isArmor(uid)

if (getItemArmor(uid) and getItemArmor(uid) ~= 0 and not getItemInfo(uid.itemid,'attack') and not getItemInfo(uid.itemid,'defense') and getItemWeaponType(uid.uid) == 0) then

return true

end

return false

end

function isWeapon(uid)

uid = uid or 0

local f = getItemWeaponType(uid)

if f == 1 or f == 2 or f == 3 then

return TRUE

end

return FALSE

end

function isShield(uid)

uid = uid or 0

if getItemWeaponType(uid) == 4 then

return TRUE

end

return FALSE

end

 

function getWeaponLevel(uid)

uid = uid or 0

local name = getItemName(uid)

local lvl = string.match(name,'+(%d)')

return tonumber(lvl) or 0

end

function doTransform(s,i)

local c = string.gsub(s,'@',gain.maxlvl)

local c = string.gsub(c,'&a',getItemAttack(i.uid) or getItemInfo(i.itemid).attack)

local c = string.gsub(c,'&d',getItemDefense(i.uid) or getItemInfo(i.itemid).defense)

local c = string.gsub(c,'&s',getItemDefense(i.uid) or getItemInfo(i.itemid).defense)

local c = string.gsub(c,'&p',getItemArmor(i.uid) or getItemInfo(i.itemid).armor)

local c = string.gsub(c,'#',getWeaponLevel(i.uid))

local q,err = loadstring('return '..c)

assert(q,err)

return assert(q())

end

function onUse(cid, item, fromPosition, itemEx, toPosition)

toPosition.stackpos = 255

if isInArray(gain.blocked_ids, itemEx.itemid) == TRUE

or getItemWeaponType(itemEx.uid) > 4

or (getItemWeaponType(itemEx.uid) == 0

and isArmor(itemEx) == FALSE)

or itemEx.itemid == 0 then

doPlayerSendTextMessage(cid, 24,"Esse item nao pode ser refinado.")

return TRUE

end

if isCreature(itemEx.uid) == TRUE then

return FALSE

end

local level = getWeaponLevel(itemEx.uid)

local chance = doTransform(gain.chance,itemEx)

if chance >= math.random(0,100) or item.actionid >= 1000 or (item.actionid == 500 and math.random(0,100) <= 25) then

if level+1 > gain.maxlvl then

doSendMagicEffect(toPosition, 2)

return doPlayerSendTextMessage(cid, 24,"Seu item esta no nivel maximo, nao podera refinalo.")

else

setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1))

doPlayerSendTextMessage(cid, 24,"Seu item foi refinado para +"..(level+1)..".")

doSendMagicEffect(toPosition, 26)

if isArmor(itemEx) == TRUE then

local get = doTransform(gain.gainArmor,itemEx)

setItemArmor(itemEx.uid,get)

elseif isWeapon(itemEx.uid) == TRUE then

setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))

setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))

elseif isShield(itemEx.uid) == TRUE then

setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))

end

end

else

 

if level == 0 then

doPlayerSendTextMessage(cid, 24,"Sem efeito.")

doSendMagicEffect(toPosition, 2)

elseif level == gain.maxlvl then

doSendMagicEffect(toPosition, 2)

return doPlayerSendTextMessage(cid, 24,"Seu item esta no nivel maximo, nao podera refinalot.")

elseif level > 0 then

if level == 1 then

setItemName(itemEx.uid, getItemNameById(itemEx.itemid))

doPlayerSendTextMessage(cid, 24,"Seu item voltou ao normal.")

else

setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1))

doPlayerSendTextMessage(cid, 24,"Seu item voltou para +"..(level-1)..".")

end

if isArmor(itemEx) == TRUE then

setItemArmor(itemEx.uid,doTransform(gain.loseArmor ,itemEx))

elseif isWeapon(itemEx.uid) == TRUE then

setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))

setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))

elseif isShield(itemEx.uid) == TRUE then

setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))

end

end

doSendMagicEffect(toPosition, 9)

end

doRemoveItem(item.uid,1)

return TRUE

end

 

<action itemid="8306" script="upgrade.lua"/>

Imagem

 

2u6p8p2.jpg

 

ajuda eu ai pliss dou rep+

Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Quando meu OT era 8.50 eu usava a seguinte script:

 

local conf = {}

 

 

-- // config // --

conf.maxItemLevel = 10 -- max item level

conf.successChance = 60 -- succes upgrade chance

 

conf["upgrade"] = { -- how many parcent attributes are rised?

attack = 5, -- attack %

extraAttack = 10, -- extra Attack %

defence = 5, -- defence %

extraDefence = 10, -- extra defence %

armor = 5, -- armor %

attackSpeed = 3, -- attack speed %

hitChance = 5, -- hit chance %

shootRange = 2, -- shoot range %

}

 

--// end // --

 

function getItemInfo(item)

 

local attr = {}

local name = string.explode(getItemName(item), '+');

if #name == 1 then

attr.name = name[1]

attr.level = math.abs(0)

else

attr.level = math.abs(name[2])

attr.name = name[1]

end

attr.attack = (getItemAttack(item) > 0) and getItemAttack(item) or 0

attr.extraAttack = (getItemExtraAttack(item) > 0) and getItemExtraAttack(item) or 0

attr.defence = (getItemDefense(item) > 0) and getItemDefense(item) or 0

attr.extraDefence = (getItemExtraDefense(item) > 0) and getItemExtraDefense(item) or 0

attr.armor = (getItemArmor(item) > 0) and getItemArmor(item) or 0

attr.attackSpeed = (getItemAttackSpeed(item) > 0) and getItemAttackSpeed(item) or 0

attr.hitChance = (getItemHitChance(item) > 0) and getItemHitChance(item) or 0

attr.shootRange = (getItemShootRange(item) > 0) and getItemShootRange(item) or 0

attr.weight = (getItemWeight(item) > 0) and getItemWeight(item) or 0

 

return attr

end

 

function upgradeValue(value, parcent)

local newValue = math.ceil(((value/100)*parcent)+value)

return (newValue > 0) and newValue or 0

end

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

if toPosition.x == 65535 then

local upgradingItem = getItemInfo(itemEx.uid)

if (upgradingItem.attack > 0 or upgradingItem.defence > 0 or upgradingItem.armor > 0 or upgradingItem.shootRange > 1) then

if (upgradingItem.level < conf.maxItem) then

if conf.successChance >= math.random(1,100) then

setItemName(itemEx.uid, upgradingItem.name.." + "..(upgradingItem.level+1))

setItemAttack(itemEx.uid, upgradeValue(upgradingItem.attack, conf["upgrade"].attack))

setItemExtraAttack(itemEx.uid, upgradeValue(upgradingItem.extraAttack, conf["upgrade"].extraAttack))

setItemDefense(itemEx.uid, upgradeValue(upgradingItem.defence, conf["upgrade"].defence))

setItemExtraDefense(itemEx.uid, upgradeValue(upgradingItem.extraDefence, conf["upgrade"].extraDefence))

setItemArmor(itemEx.uid, upgradeValue(upgradingItem.armor, conf["upgrade"].armor))

setItemAttackSpeed(itemEx.uid, upgradeValue(upgradingItem.attackSpeed, conf["upgrade"].attackSpeed))

setItemHitChance(itemEx.uid, upgradeValue(upgradingItem.hitChance, conf["upgrade"].hitChance))

setItemShootRange(itemEx.uid, upgradeValue(upgradingItem.shootRange, conf["upgrade"].shootRange))

doSendMagicEffect(toPosition, 51)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Refinação Foi Bem-Sucedida, O Item Se Tornou Mais Forte!")

else

doRemoveItem(itemEx.uid, itemEx.type)

doSendMagicEffect(toPosition, 2)

doPlayerSendTextMessage(cid, 22, "Refinação Falho...Você Perdeu A Mega Refiner")

end

doRemoveItem(item.uid, 1)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Este Item Esta No Level Maximo!")

end

else

doPlayerSendCancel(cid, "Você Não Pode Refinar Este Item!")

end

else

doPlayerSendCancel(cid, "Você Só Poder Refinar Items Equipados No Xar Ou Na Bp!")

end

return TRUE;

end

 

 

 

agora que passei para 8.60 está dando erro, eu queria que alguem arrumasse a formula pra mim, por que não posso usar a nova, porque ja tem varias pessoas com espada refinada, e se colocar o novo sistema vai bug o attack delas..

 

E no meu OT o seguinte erro é :

 

 

[Error - Action Interface]

[13/05/2012 04:11:36] data/actions/scripts/refiner.lua:onUse

[13/05/2012 04:11:36] Description:

[13/05/2012 04:11:36] data/lib/050-function.lua:234: attempt to index a boolean value

[13/05/2012 04:11:36] stack traceback:

[13/05/2012 04:11:36] data/lib/050-function.lua:234: in function 'getItemName'

[13/05/2012 04:11:36] data/actions/scripts/mega refiner.lua:24: in function 'getItemInfo'

[13/05/2012 04:11:36] data/lib/050-function.lua:527: in function 'getItemDescriptions'

[13/05/2012 04:11:36] data/lib/050-function.lua:234: in function 'getItemName'

[13/05/2012 04:11:36] data/actions/scripts/mega refiner.lua:24: in function 'getItemInfo'

[13/05/2012 04:11:36] data/actions/scripts/refiner.lua:53: in function <data/actions/scripts/refiner.lua:50>

Editado por BogaOT
Link para o comentário
Compartilhar em outros sites

  • 0

This is script work on tfs 0.4 version, :D

 

--- Perfect refine system by Mock the bear (MTB).
--- Email: <a href="mailto:mock_#####@hotmail.com">mock_#####@hotmail.com</a>
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(1)',loseArmor='&p-(1)',
gainShield='&s+#',loseShield='&s-(#+1)',
gainAttack='&a+(1*(#))',loseAttack='&a-(1*(#+1))',
gainDefense='&d+(1*(#))',loseDefense='&d-(1*(#+1))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 5,
blocked_ids = {8881},{2128}
}
local it = {
--[itemid] = [percent]
[8303] = 0, -- 0% additional
[8302] = 50, -- 50%
}
if not setItemName then
   function setItemName(uid,name)
 return doItemSetAttribute(uid,'name',name)
   end
   function setItemArmor(uid,name)
 return doItemSetAttribute(uid,'armor',name)
   end
function setItemDefense(uid,name)
 return doItemSetAttribute(uid,'defense',name)
end
function setItemAttack(uid,name)
 return doItemSetAttribute(uid,'attack',name)
end
function getItemAttack(uid)
 return getItemAttribute(uid,'attack')
end
function getItemDefense(uid)
 return getItemAttribute(uid,'defense')
end
function getItemArmor(uid)
  if type(uid) == 'number' then
  return getItemAttribute(uid,'armor')
  else
  return getItemInfo(uid.itemid).armor
  end
end
end

local function isArmor(uid) -- Function by Mock the bear.
   if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then
 return true
end
return false
end
local function isWeapon(uid) -- Function by Mock the bear.
uid = uid or 0
local f = getItemWeaponType(uid)
if f == 1 or f == 2 or f == 3 then
 return true
end
return false
end
local function isShield(uid) -- Function by Mock the bear.
uid = uid or 0
if getItemWeaponType(uid) == 4 then
 return true
end
return false
end
local function isBow(uid) -- Function by Mock the bear.
uid = uid or 0
if getItemWeaponType(uid) == 5 then
 return true
end
return false
end
local function getWeaponLevel(uid) -- Function by Mock the bear.
  uid = uid or 0
  local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or ''
  local lvl = string.match(name,'%s%+(%d+)%s*')
  return tonumber(lvl) or 0
end
local function doTransform(s,i) -- Function by Mock the bear.
   local c = string.gsub(s,'@',gain.maxlvl)
   local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack))
   local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
   local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
   local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor))
   local c = string.gsub(c,'#',getWeaponLevel(i))
   local q = assert(loadstring('return '..c))
   return math.floor(assert(q()))
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
	 if item.uid == 0 or item.itemid == 0 then return false end
  toPosition.stackpos = 255
	 if isInArray(gain.blocked_ids, itemEx.itemid)
	  or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
	   or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
		 or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
		    doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You cant refine this item.")
		    return TRUE
	 end
	 if isCreature(itemEx.uid) == TRUE then
	    return FALSE
	 end
    local level = getWeaponLevel(itemEx)
    local chance = doTransform(gain.chance,itemEx)
 if level == gain.maxlvl then
  doSendMagicEffect(toPosition, 2)
	    return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your item is on max level, you can't upgrade it.")
 end
 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!")
    if chance+it[item.itemid] >= math.random(0,100) then
  local nm = getItemName(itemEx.uid)
  local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
  slot = slot~='' and ' '..slot or slot
	    setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot)
	    addEvent(doPlayerSendTextMessage,500,cid,MESSAGE_INFO_DESCR,"Your item has been upgrated to +"..(level+1)..slot..".")
	    doSendMagicEffect(toPosition, 12)
	    if isArmor(itemEx) then
   local get = doTransform(gain.gainArmor,itemEx)
   setItemArmor(itemEx.uid,get)
  elseif isBow(itemEx.uid) then
   setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
  elseif isWeapon(itemEx.uid) then
   setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
   setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
	    elseif isShield(itemEx.uid) then
   setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
  end
    else
  if level == 0 then
   addEvent(doPlayerSendTextMessage,500,cid,MESSAGE_INFO_DESCR,"No effect.")
   doSendMagicEffect(toPosition, 2)
  elseif level > 0 then
  local nm = getItemName(itemEx.uid)
  local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
   slot = slot~='' and ' '..slot or slot
   if level == 1 then
 setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot)
 addEvent(doPlayerSendTextMessage,500,cid,MESSAGE_INFO_DESCR,"Your item back to normal.")
   else
 setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
 addEvent(doPlayerSendTextMessage,500,cid,MESSAGE_INFO_DESCR,"Your item back to +"..(level-1)..slot..".")
   end
   if isArmor(itemEx) then
 setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
   elseif isWeapon(itemEx.uid) then
 setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
 setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
   elseif isBow(itemEx.uid) then
 setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
   elseif isShield(itemEx.uid) then
 setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
   end
  end
  doSendMagicEffect(toPosition, 9)
    end
doRemoveItem(item.uid,1)
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

cara este sistema é muito bom, mas, eu vi um sistema que add skills nos itens, será que teria como postar esse se alguem tiver ?, eu tenho um pedaço desse script aki mais deve esta faltando alguma coisa pq ele add os atributos no item mais nao da os skill pro char

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...