• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Change % for 1 point

renancs

New Member
Joined
Jul 8, 2008
Messages
252
Reaction score
3
I would like someone to swap % to fixed amount, for example, the script is 5% and I would like to increase only 1 point.

local conf = {}

conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
[1] = {successParcent = 85, downrageLevel = 0},
[2] = {successParcent = 80, downrageLevel = 1},
[3] = {successParcent = 75, downrageLevel = 2},
[4] = {successParcent = 70, downrageLevel = 3},
[5] = {successParcent = 65, downrageLevel = 4},
[6] = {successParcent = 60, downrageLevel = 5},
[7] = {successParcent = 55, downrageLevel = 0},
[8] = {successParcent = 50, downrageLevel = 0},
[9] = {successParcent = 45, downrageLevel = 0}
}
conf["upgrade"] = { -- how many parcent attributes are rised?
attack = 5, -- attack %
extraAttack = 10, -- extra Attack %
defense = 5, -- defence %
extraDefense = 10, -- extra defence %
armor = 5, -- armor %
hitChance = 5, -- hit chance %
}

-- // do not touch // --
-- Upgrading system v.3.1 by Azi [Ersiu] --
local upgrading = {
upValue = function (value, level, parcent)
if(not(value>0))then return 0 end
for i=1,level do
value = math.ceil(((value/100)*parcent)+value)+1
end
return (value > 0) and value or 0
end,

getLevel = function (item)
local name = string.explode(getItemName(item), '+')
return (#name == 1) and 0 or math.abs(name[2])
end,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local getItem = getItemInfo(itemEx.itemid)
if((getItem.weaponType > 0 or getItem.armor > 0) and not isItemStackable(itemEx.itemid))then
local level = upgrading.getLevel(itemEx.uid)
if(level < #conf["level"])then
local nLevel = (conf["level"][(level+1)].successParcent >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
if(nLevel > level)then
doSendMagicEffect(toPosition, 30)
doPlayerSendTextMessage(cid, 22, "Congratz! Upgraded was successful, your item has become stronger!")
else
doSendMagicEffect(toPosition, 2)
doPlayerSendTextMessage(cid, 22, "Argh! Upgrading fail... you item lost some of strong!")
end
doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and "+"..nLevel or ""))
doItemSetAttribute(itemEx.uid, "attack", upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
doItemSetAttribute(itemEx.uid, "extraattack", upgrading.upValue(getItem.extraAttack, nLevel, conf["upgrade"].extraAttack))
doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense))
doItemSetAttribute(itemEx.uid, "extradefense", upgrading.upValue(getItem.extraDefense, nLevel, conf["upgrade"].extraDefense))
doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor))
doItemSetAttribute(itemEx.uid, "hitChance", upgrading.upValue(getItem.hitChance,nLevel, conf["upgrade"].hitChance))
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, 19, "Sorry this item is on max level.")
end
else
doPlayerSendTextMessage(cid, 19, "You cannot upgrade this item.")
end
end
 
Simply read the config man: Take a look.. if you'd like it to only go up by +1 then try doing something like this..

Try replacing this in your script:

Code:
conf["upgrade"] = { -- how many parcent attributes are rised?
attack = 1, -- attack %
extraAttack = 0, -- extra Attack %
defense = 1, -- defence %
extraDefense = 0, -- extra defence %
armor = 0, -- armor %
hitChance = 0, -- hit chance %
}

Hopefully that will raise it +1 Atk, and +1 Defence. It wont give you any extra hit chance, defence or attack. Its just going to boost the items main attack/defence by 1%. Which will hopefully be only 1 point for any item you pick.

Its hard to fine tune it to do 1 point for every item without completely changing the script, then coding what you want for each item; which would just be crazy and not worth it..

If this doesnt work for 1 point, your going to have to get into the 0.8% and stuff like that; which would be up to you to test and find out how you want it.

Rep if I've helped ya :)
 
hohoho very nice, thanks so much
rep for u and another request ...

would like each combination above +3 a globalevents show to the server with a message in red.
Combination with success: (player) combined (item) to (+ x)
example:

Combination with success: Dosmus combined demon armor to +3
 
Glad that worked, Hopefully someone can help you with your next request.. I dont know how to do that and I find if you have 100+ players on it would spam the server with to many players combined messages. But hopefully you find a scripter that can help you :)

- Thanks for the rep :)
 
It would not be too much spam, it would be difficult to get this item, not to be that players can identify so much with the system they buy lots of rocks on my site, but I believe that the purchase would happen, but not in large quantities.

however ... I really need the combination appears in the world, is someone who can help me?
 
After:
PHP:
doPlayerSendTextMessage(cid, 22, "Congratz! Upgraded was successful, your item has become stronger!")

Add:
PHP:
doBroadcastMessage("Combination with success: " .. getCreatureName(cid) .. " combined " .. getItem.name .. " +" .. nLevel .. "!", MESSAGE_STATUS_WARNING)

Bye.
 
Nope, add:
Code:
if nLevel >= 3 then
 doBroadcastMessage("Combination with success: " .. getCreatureName(cid) .. " combined " .. getItem.name .. " +" .. nLevel .. "!", MESSAGE_STATUS_WARNING)
end

;3
 
to
doPlayerSendTextMessage(cid, 22, "Congratulations! Upgraded was successful, your item has become stronger!")
else

from

doPlayerSendTextMessage(cid, 22, "Congratulations! Upgraded was successful, your item has become stronger!")
if nLevel >= 3 then
doBroadcastMessage("Combination with success: " .. getCreatureName(cid) .. " combined " .. getItem.name .. " +" .. nLevel .. "!", MESSAGE_STATUS_WARNING)
end
else
?
 
Back
Top