Action Runes Lever v1.3

Sherlok

Active Member
Joined
Aug 29, 2008
Messages
2,116
Best answers
0
Reaction score
43
Location
Poland, Wrocław.
Hello,
I've remade Potion Lever v1.0 script by Shawak to sell runes with charges.


Version:
- TFS 0.3.5pl1, tested.

Credits:
80% Shawak
20% Sherlok & Renusek

Example:
17:18 You bought a backpack sudden death rune for 6500 gold coins.

Script:
- data/actions/actions.xml
Lua:
<action uniqueid="1248-1256" event="script" value="runes.lua"/>
- data/actions/scripts/potions.lua
Lua:
  --[[
        Runes Script v1.3
        by Shawak, Sherlok & Renusek
]]--

local config = {
        [1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = 3}, -- sudden death rune
        [1249] = {potion = 2269, cost = 6400, backpack_id = 2002, charges = 2}, -- wild growth rune
        [1250] = {potion = 2274, cost = 3600, backpack_id = 2002, charges = 4}, -- avalanche rune
		[1251] = {potion = 2305, cost = 7000, backpack_id = 2000, charges = 2}, -- fire bomb rune
		
		[1252] = {potion = 2308, cost = 4200, backpack_id = 2000, charges = 3}, -- soulfire rune
        [1253] = {potion = 2278, cost = 14000, backpack_id = 5949, charges = 1}, -- paralyze rune
        [1254] = {potion = 2273, cost = 3500, backpack_id = 2002, charges = 1}, -- ultimate healing rune
		[1255] = {potion = 2261, cost = 900, backpack_id = 2003, charges = 3}, -- destroy field rune
		
		[1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 3}, -- magic wall 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, 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
        return TRUE
end
Post form by Shawak.


Yours,
Sherlok
 

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
You havn't changed anything or?
If yes, make changelog.
 

Cykotitan

Experienced G'
Joined
Nov 4, 2008
Messages
16,894
Best answers
4
Reaction score
817
xD I remember making something very similar to this.
It worked on TFS 0.2 too, though.

Ohh, there it is:
Code:
local config =
{
	[1001] = {backpack_id = 2003, item_id = 2268, cost = 4000, charges = 3, name = "sudden death rune"},
	[1002] = {backpack_id = 2002, item_id = 2273, cost = 3000, charges = 1, name = "ultimate healing rune"},
	[1003] = {backpack_id = 2002, item_id = 2274, cost = 4000, charges = 4, name = "avalanche rune"},
	[1004] = {backpack_id = 1999, item_id = 2278, cost = 3000, charges = 1, name = "paralyze rune"},
	[1005] = {backpack_id = 1998, item_id = 2292, cost = 3000, charges = 10, name = "stalagmite rune"},
	[1006] = {backpack_id = 2004, item_id = 2293, cost = 4000, charges = 3, name = "magic wall rune"},
	[1007] = {backpack_id = 2001, item_id = 2315, cost = 4200, charges = 4, name = "thunderstorm rune"},
	[1008] = {backpack_id = 2001, item_id = 7590, cost = 3500, charges = 1, name = "great mana potion"},
	[1009] = {backpack_id = 2001, item_id = 7589, cost = 4000, charges = 1, name = "strong mana potion"},
	[1010] = {backpack_id = 2001, item_id = 7620, cost = 3100, charges = 1, name = "mana potion"},
	[1011] = {backpack_id = 2000, item_id = 7591, cost = 3100, charges = 1, name = "great health potion"},
	[1012] = {backpack_id = 2000, item_id = 7588, cost = 3600, charges = 1, name = "strong health potion"},
	[1013] = {backpack_id = 2000, item_id = 7618, cost = 3400, charges = 1, name = "health potion"},
	[1014] = {backpack_id = 2000, item_id = 2304, cost = 3600, charges = 4, name = "great fireball rune"},
	[1015] = {backpack_id = 2000, item_id = 2305, cost = 3600, charges = 2, name = "fire bomb rune"},
	[1016] = {backpack_id = 2001, item_id = 2313, cost = 3400, charges = 6, name = "explosion rune"},
	[1017] = {backpack_id = 2001, item_id = 2310, cost = 3500, charges = 3, name = "desintegrate rune"},
	[1018] = {backpack_id = 2002, item_id = 2279, cost = 3200, charges = 4, name = "energy wall rune"},
	[1019] = {backpack_id = 2003, item_id = 2261, cost = 3400, charges = 3, name = "destroy field rune"},
	[1020] = {backpack_id = 2002, item_id = 2271, cost = 3300, charges = 5, name = "icicle rune"}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local buyItem = config[item.uid]
	if buyItem ~= nil then
		if getPlayerMoney(cid) >= buyItem.cost then
			local bp = doCreateItemEx(buyItem.backpack_id, 1)
			for i = 1, getContainerCapById(buyItem.backpack_id) do
				doAddContainerItem(bp, buyItem.item_id, buyItem.charges)
			end
			if doPlayerAddItemEx(cid, bp, 0) == RETURNVALUE_NOERROR then
				doPlayerRemoveMoney(cid, buyItem.cost)
				doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
				doSendAnimatedText(fromPosition, "Purchased", math.random(1,215))
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have purchased a backpack of ".. buyItem.name .."s for ".. buyItem.cost .." gold.")
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough capacity or free space.")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
			end            
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need ".. buyItem.cost .." gold coins for a backpack of ".. buyItem.name .."s.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		end
		return TRUE
	end
	return FALSE
end
 
Last edited:

Hazen

Riariari dorgas mano
Joined
Jun 27, 2009
Messages
39
Best answers
0
Reaction score
0
Shawak, Sherlok & Renusek


Really need 3 persons to make this script? -.-
 

Gemo

New Member
Joined
Sep 25, 2009
Messages
273
Best answers
0
Reaction score
3
Location
Bosnia/Mostar
- data/actions/scripts/potions.lua << wrong

data/actions/scripts/runes.lua << rox

Nice:wub:
 

Rala Knighta

StCarlo! :]
Joined
Mar 25, 2008
Messages
629
Best answers
0
Reaction score
2
Location
Germany
Code:
  <action uniqueid="1248-1256" event="script" value="runes.lua"/>
100% Failure
Right is potions.lua xD
 

kermmm

New Member
Joined
Feb 1, 2009
Messages
46
Best answers
0
Reaction score
0
I don't understand this script.It for what?
 

Cykotitan

Experienced G'
Joined
Nov 4, 2008
Messages
16,894
Best answers
4
Reaction score
817
It's for levers that you can use to buy runes/potions/~whateverYouMightThinkOf~, in backpacks.
 

GuilleMoniz

New Member
Joined
Dec 5, 2016
Messages
23
Best answers
0
Reaction score
3
xD I remember making something very similar to this.
It worked on TFS 0.2 too, though.

Ohh, there it is:
Code:
local config =
{
    [1001] = {backpack_id = 2003, item_id = 2268, cost = 4000, charges = 3, name = "sudden death rune"},
    [1002] = {backpack_id = 2002, item_id = 2273, cost = 3000, charges = 1, name = "ultimate healing rune"},
    [1003] = {backpack_id = 2002, item_id = 2274, cost = 4000, charges = 4, name = "avalanche rune"},
    [1004] = {backpack_id = 1999, item_id = 2278, cost = 3000, charges = 1, name = "paralyze rune"},
    [1005] = {backpack_id = 1998, item_id = 2292, cost = 3000, charges = 10, name = "stalagmite rune"},
    [1006] = {backpack_id = 2004, item_id = 2293, cost = 4000, charges = 3, name = "magic wall rune"},
    [1007] = {backpack_id = 2001, item_id = 2315, cost = 4200, charges = 4, name = "thunderstorm rune"},
    [1008] = {backpack_id = 2001, item_id = 7590, cost = 3500, charges = 1, name = "great mana potion"},
    [1009] = {backpack_id = 2001, item_id = 7589, cost = 4000, charges = 1, name = "strong mana potion"},
    [1010] = {backpack_id = 2001, item_id = 7620, cost = 3100, charges = 1, name = "mana potion"},
    [1011] = {backpack_id = 2000, item_id = 7591, cost = 3100, charges = 1, name = "great health potion"},
    [1012] = {backpack_id = 2000, item_id = 7588, cost = 3600, charges = 1, name = "strong health potion"},
    [1013] = {backpack_id = 2000, item_id = 7618, cost = 3400, charges = 1, name = "health potion"},
    [1014] = {backpack_id = 2000, item_id = 2304, cost = 3600, charges = 4, name = "great fireball rune"},
    [1015] = {backpack_id = 2000, item_id = 2305, cost = 3600, charges = 2, name = "fire bomb rune"},
    [1016] = {backpack_id = 2001, item_id = 2313, cost = 3400, charges = 6, name = "explosion rune"},
    [1017] = {backpack_id = 2001, item_id = 2310, cost = 3500, charges = 3, name = "desintegrate rune"},
    [1018] = {backpack_id = 2002, item_id = 2279, cost = 3200, charges = 4, name = "energy wall rune"},
    [1019] = {backpack_id = 2003, item_id = 2261, cost = 3400, charges = 3, name = "destroy field rune"},
    [1020] = {backpack_id = 2002, item_id = 2271, cost = 3300, charges = 5, name = "icicle rune"}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local buyItem = config[item.uid]
    if buyItem ~= nil then
        if getPlayerMoney(cid) >= buyItem.cost then
            local bp = doCreateItemEx(buyItem.backpack_id, 1)
            for i = 1, getContainerCapById(buyItem.backpack_id) do
                doAddContainerItem(bp, buyItem.item_id, buyItem.charges)
            end
            if doPlayerAddItemEx(cid, bp, 0) == RETURNVALUE_NOERROR then
                doPlayerRemoveMoney(cid, buyItem.cost)
                doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
                doSendAnimatedText(fromPosition, "Purchased", math.random(1,215))
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have purchased a backpack of ".. buyItem.name .."s for ".. buyItem.cost .." gold.")
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough capacity or free space.")
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            end           
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need ".. buyItem.cost .." gold coins for a backpack of ".. buyItem.name .."s.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
        return TRUE
    end
    return FALSE
end

Amazing, Works like a gem and very organized
 
Top