• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Rune Lever

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
Can someone edit my rune lever coz my rune lever do runes with normal rune charge. I want 50 all charge.


Code:
local config = {
	[6008] = {potion = 2286, cost = 30000, backpack_id = 1991, charges = 50},
	[6009] = {potion = 2313, cost = 60000, backpack_id = 1994, charges = 50},
	[6010] = {potion = 2305, cost = 30000, backpack_id = 1993, charges = 50},
	[6011] = {potion = 2293, cost = 60000, backpack_id = 1992, charges = 50},
	[6012] = {potion = 2273, cost = 80000, backpack_id = 1995, charges = 50},
	[6013] = {potion = 2268, cost = 110000, backpack_id = 1996, charges = 50},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local potion = config[item.uid]
        if isInArray({1945, 1946}, item.itemid) ~= TRUE then
                return TRUE
        end
        if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, potion.charges) == TRUE then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a bag "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
				doSendAnimatedText(fromPosition, "Purchased", math.random(1,215))
				doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a bag "..getItemNameById(potion.potion)..".")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
        return TRUE
end
 
LUA:
local config = {
	[6008] = {id = 2286, cost = 30000, backpack_id = 1991, charges = 50},
	[6009] = {id = 2313, cost = 60000, backpack_id = 1994, charges = 50},
	[6010] = {id = 2305, cost = 30000, backpack_id = 1993, charges = 50},
	[6011] = {id = 2293, cost = 60000, backpack_id = 1992, charges = 50},
	[6012] = {id = 2273, cost = 80000, backpack_id = 1995, charges = 50},
	[6013] = {id = 2268, cost = 110000, backpack_id = 1996, charges = 50},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = config[item.uid]
	if doPlayerBuyItemContainer(cid, v.backpack_id, v.id, 1, v.cost, v.charges) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought ' .. getItemInfo(v.backpack_id).maxItems .. 'x ' .. getItemInfo(v.id).plural .. ' for ' .. v.cost .. ' gold.')
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need ' .. v.cost .. ' gold for ' .. getItemInfo(v.backpack_id).maxItems .. 'x ' .. getItemInfo(v.id).plural .. '.')
	end
	return true
end
 
Last edited:
Don't have time to edit your script so this is my rune system,
Complete it as you want :D
LUA:
local config = {
        [5009] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = 3}, -- sudden death rune
        [5010] = {potion = 2304, cost = 3600, backpack_id = 2000, charges = 6}, -- gfb
        [5011] = {potion = 2311, cost = 2500, backpack_id = 1998, charges = 4}, -- hmm
		[5012] = {potion = 2313, cost = 5000, backpack_id = 2001, charges = 4}, -- explo
		
		[5013] = {potion = 2365, cost = 1900, backpack_id = 1988, charges = 3}, -- ih
        [5014] = {potion = 2273, cost = 3500, backpack_id = 5949, charges = 3}, --  ultimate healing rune
        [5015] = {potion = 2293, cost = 5000, backpack_id = 2004, charges = 3}, -- magic wall
		[5016] = {potion = 2274, cost = 3600, backpack_id = 2002, charges = 6}, -- avalanche rune
} -- config end --

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local potion = config[item.actionid]
        if isInArray({1945, 1946}, item.itemid) ~= TRUE then
                return TRUE
        end
        if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, potion.charges) == TRUE then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a backpack "..getItemNameById(potion.potion)..".")
        end
end
 
[15/08/2010 22:03:09] [Error - Action Interface]
[15/08/2010 22:03:09] data/actions/scripts/runeslever.lua:onUse
[15/08/2010 22:03:09] Description:
[15/08/2010 22:03:09] data/actions/scripts/runeslever.lua:14: attempt to index local 'potion' (a nil value)
[15/08/2010 22:03:09] stack traceback:
[15/08/2010 22:03:09] data/actions/scripts/runeslever.lua:14: in function <data/actions/scripts/runeslever.lua:9>
 
You are doing something wrong:
1. Did you try to use original version of my script?(Without your edit)
2. Did you paste this line to action.xml
Code:
<action actionid="actionid as in map editor" event="script" value="runelever.lua"/>
3. Make sure that you did these things.
4. Any effects?
 
Back
Top