• 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!

Upgrading system?

I r New

New Member
Joined
Feb 1, 2008
Messages
137
Reaction score
1
I'm not sure how this would work, but I've created 10 custom sets in my server and I would like to request a script so that when you "use" the item after saying !enhance it has a chance of breaking/upgrading.

For example; I have a crossbow, which is a rank 2 weapon. I want to upgrade it to rank 3. I say "!enhance" and use the crossbow; it either breaks or upgrades to rank 3.

It's like the 'Rise of Abbadon' upgrading system, I guess...
Thank-you to anyone who can script this for me :)
 
Hmm.. on my mind is better using Mock Upgrading System.
You have stone and you can upgrade you have % chance to upgrade or downgrade { and you can put stone in boss loot or donation npc }
It's more RPG than !command ;P
 
I rather this sort of upgrading system; I'm already using another upgrading system that you can use special upgrading items to make an item +1, +2, etc.
But now I have these 10 new rank sets. I don't want them lootable, I want them obtainable by upgrading. So you can upgrade it from your backpack. Or it can break.
 
i made this kinda quick so it may not work
action
<action itemid="7529;37432225" event="script" value="upgrading.lua"/>
Code:
		items =	{
			--[itemyour clicking on to upgrade] = newitem, chance a # from 1 to 100
			[7529] = {newitemid = 5161, chance = 50},
			[3743] = {newitemid = 7458, chance = 50},
			[2225] = {newitemid = 9846, chance = 75}
			}
				
		function onUse(cid, item, frompos, item2, topos)   
			if getPlayerStorageValue(cid, 20000) == 1 then
				itemer = items[item.itemid]
				if math.random(1,100) >= itemer.chance  then
					doPlayerAddItem(cid, itemer.newitemid, 1)
					doPlayerSendCancel(cid, "You managed to upgrade your equipment")
				else
					doPlayerSendCancel(cid, "You failed to upgrade your item.")
				end
				doRemoveItem(item.uid, 1)
			else
				doPlayerSendCancel(cid, "You must have out your enchanting item to upgrade equipment")
			end
			return true
		end

talkaction
Code:
function onSay(cid, words, param)
    if getPlayerStorageValue(cid, 20000) == 1 then
		setPlayerStorageValue(cid, 20000, 0)
		doPlayerSendCancel(cid, "You put anyway your enchanting item.")
	else
		setPlayerStorageValue(cid, 20000, 1)
		doPlayerSendCancel(cid, "You take out your enchanting item.")
    end
    return true
end

edit:at down recopy the code i saw a typo
 
Last edited:
I'll test that out soon, thankyou.

Edit: It doesn't remove the item.
Error:
[16/11/2010 22:13:13] [Error - Action Interface]
[16/11/2010 22:13:13] data/actions/scripts/other/upgrading.lua:eek:nUse
[16/11/2010 22:13:13] Description:
[16/11/2010 22:13:13] (luaDoRemoveItem) Item not found
 
Last edited:
Code:
local config = {
	-- item, new_item, chance--
	[{[B][COLOR="red"]id, new_id[/COLOR][/B]}] = 25
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local id = 0
	for x, v in ipairs(config) do
		if x[1] then
			if(math.random(1, 100) >= v[2]) then
				id = doCreateItemEx(x[2], 1)
				if(doPlayerAddItemEx(cid, id, true) ~= RETURNVALUE_NOERROR) then
					return doPlayerSendCancel(cid, "Sorry, not possible.")
				end
				
				doCreatureSay(cid, "Congratulations! You have successfully transformed " .. getItemInfo(x[1]).name .. " to " .. getItemInfo(x[2]).name .. "!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			else
				doCreatureSay(cid, "Try your luck again!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
			end
			break
		end
		
		doRemoveItem(item.uid, 1)
	end
	
	return true
end
 
Last edited:
Code:
local config = {
	-- item, new_item, chance--
	[{[B][COLOR="red"]id, new_id[/COLOR][/B]}] = 25
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local id = 0
	for x, v in ipairs(config) do
		if x[1] then
			if(math.random(100) >= v[2]) then
				id = doCreateItemEx(x[2], 1)
				if(doPlayerAddItemEx(cid, id, true) ~= RETURNVALUE_NOERROR) then
					return doPlayerSendCancel(cid, "Sorry, not possible.")
				end
				
				doCreatureSay(cid, "Congratulations! You have successfully transformed " .. getItemInfo(x[1].itemid).name .. " to " .. getItemInfo(x[2].itemid).name .. "!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			else
				doCreatureSay(cid, "Try your luck again!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
			end
			break
		end
		
		doRemoveItem(item.uid, 1)
	end
	
	return true
end

Doesn't work, JDB. No error. Just doesn't work. =/
 
Back
Top Bottom