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

Action [Advanced] Potion Lever v1.0

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
I decided to make it, because there was so much requestions.
You can easy add more potions ;).

Version:
- TFS 0.3.5pl1, tested.

Credits:
100% by me ^_^

Example:
16:18 You bought a backpack strong mana potion for 5000 gold coins.

Script:
- data/actions/actions.xml
Lua:
	<action uniqueid="5001-5006" event="script" value="potions.lua"/>
- data/actions/scripts/potions.lua
Lua:
--[[
	Potion Script v1.0
	by Shawak
]]--

local config = {
	[5001] = {potion = 7618, cost = 1000, backpack_id = 2000}, -- health potion
	[5002] = {potion = 7588, cost = 2500, backpack_id = 2000}, -- strong health potion
	[5003] = {potion = 7591, cost = 5000, backpack_id = 2000}, -- great health potion

	[5004] = {potion = 7620, cost = 5000, backpack_id = 2001}, -- mana potion
	[5005] = {potion = 7589, cost = 5000, backpack_id = 2001}, -- string mana potion
	[5006] = {potion = 7590, cost = 5000, backpack_id = 2001}, -- great mana potion
} -- config end --

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, 1) == 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
	return TRUE
end

I hope you like it :thumbup:.

Regards,
Shawak
 
very nice.
was very good script.

this function doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, 1) checks the cap of the player?
if he does not have enough cap he did not buy a bp.

thanks man.
 
very nice.
was very good script.

this function doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, 1) checks the cap of the player?
if he does not have enough cap he did not buy a bp.

thanks man.

If you don't have enaught cap, the backpack are under you. ^_^

PS: Thanks all :D
 
I've remade this script for runes, and what I must do to add charges for runes?

Code:
  --[[
        Runes Script v1.1
        by Shawak & Sherlok
]]--

local config = {
        [1248] = {potion = 2268, cost = 6500, backpack_id = 2003}, -- sudden death rune
        [1249] = {potion = 2269, cost = 6400, backpack_id = 2002}, -- wild growth rune
        [1250] = {potion = 2274, cost = 3600, backpack_id = 2002}, -- avalanche rune
		[1251] = {potion = 2305, cost = 7000, backpack_id = 2000}, -- fire bomb rune
		
		[1252] = {potion = 2308, cost = 4200, backpack_id = 2000}, -- soulfire rune
        [1253] = {potion = 2278, cost = 14000, backpack_id = 5949}, -- paralyze rune
        [1254] = {potion = 2273, cost = 3500, backpack_id = 2002}, -- ultimate healing rune
		[1255] = {potion = 2261, cost = 900, backpack_id = 2003}, -- destroy field rune
} -- config end --

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, 1) == 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
        return TRUE
end
 
Last edited:
Lua:
local config = {
   [1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = NUMBER} -- sudden death rune
  }

doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, potion.charges)
 
Lua:
local config = {
   [1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = NUMBER} -- sudden death rune
  }

doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, potion.charges)

please full script
 
Back
Top