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

A few requests

Tibia Rox

Member
Joined
Feb 4, 2009
Messages
1,181
Reaction score
9
Location
U.S.A
If someone can make me the following scripts, that'd be great!

I need a lever that when you use it, you get 1 key ring for 10 plat coins, a lever for spirit and ultimate health potions.

Thanks in advanced!
 
Cuz this is the script I use:

Code:
[1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = 5}, -- sudden death rune

Theres no way to edit it so you can buy a key ring :D
 
Not tested!

Lever: Key Ring for 10k ...
Code:
local c = {
	item = 5801,
	cost = 10000,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerMoney(cid) >= c.cost) then
	if (item.itemid == 1945) then
        	doTransformItem(item.uid, 1946)
               	doPlayerAddItem(cid, c.item, 1)
		doPlayerRemoveMoney(cid, c.cost)
	elseif (item.itemid == 1946) then
		doTransformItem(item.uid, 1945)
	end
else
	doPlayerSendCancel(cid, "You do not have enough money.")
end
return TRUE
end
 
This should work just fine.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {
		[ACTION_ID] = { id = XXXX, count = 1, cost = 1000 },
		[ACTION_ID] = { id = XXXX, count = 1, cost = 1000 }
	}
	local v = cfg[item.actionid]
	if(getPlayerMoney(cid) < v.cost) then
		doPlayerSendCancel(cid, "You need " .. v.cost .. " gold.")
	local shop_items = doCreateItemEx(v.id, v.count)
	elseif(doPlayerAddItemEx(cid, shop_items, true) ~= RETURNVALUE_NOERROR) then
		doPlayerSendCancel(cid, "You do not have enough capacity or space to carry this item.")
	else
		doPlayerRemoveMoney(cid, v.cost)
		doCreatureSay(cid, getItemNameById(v.id) .. "!", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
	end
	return true
end
 
I got it to work, but now I get this everytime I use the lever.

Code:
[26/03/2010 13:08:40] [Error - Action Interface] 
[26/03/2010 13:08:40] data/actions/scripts/runes.lua:onUse
[26/03/2010 13:08:40] Description: 
[26/03/2010 13:08:40] data/lib/050-function.lua:23: 'for' limit must be a number
[26/03/2010 13:08:40] stack traceback:
[26/03/2010 13:08:40] 	data/lib/050-function.lua:23: in function 'doPlayerGiveItemContainer'
[26/03/2010 13:08:40] 	data/lib/050-function.lua:44: in function 'doPlayerBuyItemContainer'
[26/03/2010 13:08:40] 	data/actions/scripts/runes.lua:30: in function <data/actions/scripts/runes.lua:23>

[26/03/2010 13:08:55] [Error - Action Interface] 
[26/03/2010 13:08:55] data/actions/scripts/runes.lua:onUse
[26/03/2010 13:08:55] Description: 
[26/03/2010 13:08:55] (luaDoCreateItemEx) Item not found
 
Back
Top