Postado Maio 13, 2018 7 anos Tenta assim então: --- Email: <a href="mailto:[email protected]">[email protected]</a> -- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor defense -- # = nivel do item -- @ = max level local gain = { gainArmor='&p+(5)',loseArmor='&p-(3)', gainShield='&s+#',loseShield='&s-(#+3)', gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))', gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))', chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))', maxlvl = 10, blocked_ids = {8881} } local it = { --[itemid] = [percent] [8306] = 7, -- 0% additional [8305] = 100, -- 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. local f = getItemInfo(uid.itemid) if f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE then return true end return false end local function isWeapon(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemInfo(uid.itemid) if table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) then return true end return false end local function isShield(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemInfo(uid.itemid) if f.defense ~= 0 and f.weaponType == WEAPON_SHIELD then return true end return false end local function isBow(uid) -- Function by Mock the bear. local f = getItemInfo(uid.itemid) if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then return true end return false end local function isBow2(uid) -- Function by Mock the bear. local f = getItemInfo(uid.itemid) if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then return false end return true 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, 24,"Voce nao consegue trabalhar neste item.") return TRUE end if isCreature(itemEx.uid) == TRUE then return FALSE end local level = getWeaponLevel(itemEx) local chance = doTransform(gain.chance,itemEx) local nm = getItemName(itemEx.uid) if level == gain.maxlvl then doSendMagicEffect(toPosition, 2) return doPlayerSendTextMessage(cid, 24,"Voce nao pode mais refinar este objeto, ele ja atingiu o seu maximo!") end doPlayerSendTextMessage(cid, 24,"Voce tenta refinar um(a) "..nm.." com "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% de chance de sucesso. ") 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 if level==0 then setItemName(itemEx.uid, nm..' +'..(level+1)..slot) elseif level<=9 then setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -3), "%S.*"), ".*%S")..' +'..(level+1)..slot) else setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -4), "%S.*"), ".*%S")..' +'..(level+1)..slot) end addEvent(doPlayerSendTextMessage,500,cid, 24,"Voce refina com sucesso o objeto e ele avanca para o nivel "..(level+1)..slot..".") doSendMagicEffect(toPosition, 12) if isArmor(itemEx) then local get = doTransform(gain.gainArmor,itemEx) setItemArmor(itemEx.uid,get) elseif isBow(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) elseif isWeapon(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx)) elseif isShield(itemEx) then setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx)) end else -- Give it a second chance, if it success, the item stays the same level. if chance+it[item.itemid] >= math.random(0,100) then addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no mesmo nivel.") else --if not, we'll give it a 15% change to get destroyed. if math.random(0,100) <= 15 then -- And only if the level is above 7. if level > 7 then addEvent(doPlayerSendTextMessage,500,cid, 24,"O objeto nao aguentou a carga do refinamento e acabou sendo destruido no processo.") doRemoveItem(itemEx.uid,1) -- You can set a custom animation for the destruction of the item here if you want. Just change the number to other animation doSendMagicEffect(toPosition, 9) else addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.") end else if level == 0 then addEvent(doPlayerSendTextMessage,500,cid, 24,"Não surte efeito.") 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, 24,"Seu objeto voltou ao normal.") else setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot) addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha e seu objeto volta para o nivel "..(level-1)..slot..".") end if isArmor(itemEx) then setItemArmor(itemEx.uid,doTransform(gain.loseArmor ,itemEx)) elseif isWeapon(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx)) elseif isBow(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isBow2(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isShield(itemEx) then setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx)) end end doSendMagicEffect(toPosition, 9) end end end doRemoveItem(item.uid,1) return true end Editado Maio 13, 2018 7 anos por luangop (veja o histórico de edições)
Postado Maio 14, 2018 7 anos Autor 5 horas atrás, luangop disse: Tenta assim então: --- Email: <a href="mailto:[email protected]">[email protected]</a> -- &a = weapon attack -- &d = weapon defense -- &s = shield defense -- &p = armor defense -- # = nivel do item -- @ = max level local gain = { gainArmor='&p+(5)',loseArmor='&p-(3)', gainShield='&s+#',loseShield='&s-(#+3)', gainAttack='&a+(5*(#))',loseAttack='&a-(3*(#+3))', gainDefense='&d+(5*(#))',loseDefense='&d-(3*(#+3))', chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))', maxlvl = 10, blocked_ids = {8881} } local it = { --[itemid] = [percent] [8306] = 7, -- 0% additional [8305] = 100, -- 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. local f = getItemInfo(uid.itemid) if f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE then return true end return false end local function isWeapon(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemInfo(uid.itemid) if table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) then return true end return false end local function isShield(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemInfo(uid.itemid) if f.defense ~= 0 and f.weaponType == WEAPON_SHIELD then return true end return false end local function isBow(uid) -- Function by Mock the bear. local f = getItemInfo(uid.itemid) if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then return true end return false end local function isBow2(uid) -- Function by Mock the bear. local f = getItemInfo(uid.itemid) if f.weaponType == WEAPON_DIST and f.ammoType ~= 0 then return false end return true 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, 24,"Voce nao consegue trabalhar neste item.") return TRUE end if isCreature(itemEx.uid) == TRUE then return FALSE end local level = getWeaponLevel(itemEx) local chance = doTransform(gain.chance,itemEx) local nm = getItemName(itemEx.uid) if level == gain.maxlvl then doSendMagicEffect(toPosition, 2) return doPlayerSendTextMessage(cid, 24,"Voce nao pode mais refinar este objeto, ele ja atingiu o seu maximo!") end doPlayerSendTextMessage(cid, 24,"Voce tenta refinar um(a) "..nm.." com "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% de chance de sucesso. ") 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 if level==0 then setItemName(itemEx.uid, nm..' +'..(level+1)..slot) elseif level<=9 then setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -3), "%S.*"), ".*%S")..' +'..(level+1)..slot) else setItemName(itemEx.uid, string.match(string.match(string.sub(nm, 1, -4), "%S.*"), ".*%S")..' +'..(level+1)..slot) end addEvent(doPlayerSendTextMessage,500,cid, 24,"Voce refina com sucesso o objeto e ele avanca para o nivel "..(level+1)..slot..".") doSendMagicEffect(toPosition, 12) if isArmor(itemEx) then local get = doTransform(gain.gainArmor,itemEx) setItemArmor(itemEx.uid,get) elseif isBow(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) elseif isWeapon(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx)) elseif isShield(itemEx) then setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx)) end else -- Give it a second chance, if it success, the item stays the same level. if chance+it[item.itemid] >= math.random(0,100) then addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no mesmo nivel.") else --if not, we'll give it a 15% change to get destroyed. if math.random(0,100) <= 15 then -- And only if the level is above 7. if level > 7 then addEvent(doPlayerSendTextMessage,500,cid, 24,"O objeto nao aguentou a carga do refinamento e acabou sendo destruido no processo.") doRemoveItem(itemEx.uid,1) -- You can set a custom animation for the destruction of the item here if you want. Just change the number to other animation doSendMagicEffect(toPosition, 9) else addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha mas seu objeto mantem-se no meso nivel.") end else if level == 0 then addEvent(doPlayerSendTextMessage,500,cid, 24,"Não surte efeito.") 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, 24,"Seu objeto voltou ao normal.") else setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot) addEvent(doPlayerSendTextMessage,500,cid, 24,"O refinamento falha e seu objeto volta para o nivel "..(level-1)..slot..".") end if isArmor(itemEx) then setItemArmor(itemEx.uid,doTransform(gain.loseArmor ,itemEx)) elseif isWeapon(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx)) elseif isBow(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isBow2(itemEx) then setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx)) elseif isShield(itemEx) then setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx)) end end doSendMagicEffect(toPosition, 9) end end end doRemoveItem(item.uid,1) return true end [Error - LuaInterface::loadFile] data/actions/scripts/upgrade.lua:177: '=' expected near '?' [Error - Event::checkScript] Cannot load script (data/actions/scripts/upgrade.lua) data/actions/scripts/upgrade.lua:177: '=' expected near '?'
Postado Maio 14, 2018 7 anos 46 minutos atrás, mullino disse: [Error - LuaInterface::loadFile] data/actions/scripts/upgrade.lua:177: '=' expected near '?' [Error - Event::checkScript] Cannot load script (data/actions/scripts/upgrade.lua) data/actions/scripts/upgrade.lua:177: '=' expected near '?' Tenha certeza de que copiou o código corretamente, pois está apontando erro na linha 177 perto do caractere '?', porém nessa linha não existe '?'
Postado Maio 14, 2018 7 anos @mullino Essa é a linha 177, se você colocou pelo blocos de notas, ta vendo que o começo da frase ta menor ? se você salvar desse jeito, e depois abrir o arquivo vai ter um "?" ponto de interrogação é só apagar ele ! presta atenção que agora quando você abre o arquivo, deposi da letra a tem um pronto de interrogação, só apagar ele
Postado Maio 14, 2018 7 anos Autor 1 hora atrás, Zzyzx disse: @mullino Essa é a linha 177, se você colocou pelo blocos de notas, ta vendo que o começo da frase ta menor ? se você salvar desse jeito, e depois abrir o arquivo vai ter um "?" ponto de interrogação é só apagar ele ! presta atenção que agora quando você abre o arquivo, deposi da letra a tem um pronto de interrogação, só apagar ele Entendi agora.... Estava tentando copiar ums Scripts mas a letra ficava menor e eu não sabia o porquê dissu.... Então é só salvar e abrir de novo e apaga a interrogação... Mas pq o TK está dando issu nos scripts deu ceto mas ainda nao add atack nas arma de pally so add +1 mas o attack nao muda igual das swords
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.