Action Lever Rune(s) System

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
The Forgotten Server 0.3.6pl1

Update Log: v1.1
  • Checks if you have enough space and cap.
  • Charges added to the runes in the shop.
  • ALL is easily configurable.

data/actions/actions.xml
PHP:
<action actionid="1000;1001" event="script" value="runes.lua"/>
data/actions/scripts/runes.lua
Code:
local shop = {
   [1000] = {
     id = 2268, container = 2000, cost = 5000, charges = 3, effect = CONST_ME_GIFT_WRAPS
   },
   [1001] = {
     id = 2273, container = 2001, cost = 3000, charges = 3, effect = CONST_ME_GIFT_WRAPS
   }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local v = shop[item.actionid]
   local weight = getItemWeightById(v.id, tonumber(getItemInfo(v.container).maxItems)) + getItemWeightById(v.container, 1)
   if(getPlayerFreeCap(cid) >= weight) then
     if(getPlayerMoney(cid) >= v.cost) then
       local bp = doCreateItemEx(cid, v.container, 1)
       if(doPlayerAddItemEx(cid, bp) ~= RETURNVALUE_NOERROR) then
         doPlayerSendCancel(cid, "Sorry, you do not have enough space.")
       else
         for i = 1, tonumber(getItemInfo(v.container).maxItems) do
           doAddContainerItem(bp, v.id, v.charges or 1)
         end
         doPlayerRemoveMoney(cid, v.cost)
         doSendMagicEffect(getThingPos(cid), v.effect)
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have purchased a backpack of " .. getItemInfo(v.id).plural .. ".")
       end
     else
       doPlayerSendCancel(cid, "Sorry, you must have " .. v.cost .. " gold.")
     end
   else
     doPlayerSendCancel(cid, "Sorry, you need " .. weight:format("%.2f") .. " oz. to carry this container of " .. getItemInfo(v.id).plural .. ".")
   end
   return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Last edited:

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
833
Best answers
0
Reaction score
26
Location
Poland/ Wroclaw
Imagine event:

Player Don't have a Cap, :
1: more than 18 cap:
Click: it takes a cash, adding backpack, nothing inside.
2: less than 18 cap:
You make "do not drop on map" so container don't drop on groun but there will be errors that script want to add items to container that don't exist o_O

Another Event:
Player don't have a space in inventory:
Like up[2]: You make "do not drop on map" so container don't drop on groun but there will be errors that script want to add items to container that don't exist

Om Nom Nom...
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
@Shawak:
But if he want, why not?
 

wlj

retierd
Joined
Jan 7, 2009
Messages
1,201
Best answers
0
Reaction score
1
PHP:
[21/09/2009 18:07:26] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:26] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:26] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:26] stack traceback:
[21/09/2009 18:07:26] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:27] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:27] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:27] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:27] stack traceback:
[21/09/2009 18:07:27] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:28] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:28] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:28] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:28] stack traceback:
[21/09/2009 18:07:28] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:48] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:48] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:48] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:48] stack traceback:
[21/09/2009 18:07:48] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:49] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:49] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:49] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:49] stack traceback:
[21/09/2009 18:07:49] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:50] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:50] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:50] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:50] stack traceback:
[21/09/2009 18:07:50] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:51] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:51] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:51] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:51] stack traceback:
[21/09/2009 18:07:51] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:52] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:52] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:52] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:52] stack traceback:
[21/09/2009 18:07:52] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:53] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:53] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:53] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:53] stack traceback:
[21/09/2009 18:07:53] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:54] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:54] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:54] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:54] stack traceback:
[21/09/2009 18:07:54] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>

[21/09/2009 18:07:55] Lua Script Error: [Action Interface] 
[21/09/2009 18:07:55] data/actions/scripts/tools/leverrune.lua:onUse

[21/09/2009 18:07:55] data/actions/scripts/tools/leverrune.lua:41: attempt to index field '?' (a nil value)
[21/09/2009 18:07:55] stack traceback:
[21/09/2009 18:07:55] 	data/actions/scripts/tools/leverrune.lua:41: in function <data/actions/scripts/tools/leverrune.lua:40>
 

wlj

retierd
Joined
Jan 7, 2009
Messages
1,201
Best answers
0
Reaction score
1
so what is it? i added youre script, 0.3.5pl1 .,..,.,.
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
Why are you using returns while you have else ? :p
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
@Up,
Lol...
Yea, his is much better.

I will change it some when I get home.
Although, I am 99% certain that it works fine, with no errors.
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
I wasn't referring to you :) What I mean was that I will make a better script than his and he has to delete his because it's stupid to have one that is worse (according to him) ;)

Just keep releasing, whatever it is!
 

zkum

corruption
Joined
May 9, 2009
Messages
2,300
Best answers
0
Reaction score
52
Location
Sweden
Colandus, i think you love Shawak. Do you? :) haha
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
I wasn't referring to you :) What I mean was that I will make a better script than his and he has to delete his because it's stupid to have one that is worse (according to him) ;)

Just keep releasing, whatever it is!
Ahh, okay :wub:
 

Gregor

New Member
Joined
Feb 29, 2008
Messages
770
Best answers
0
Reaction score
3
Location
UK/POLAND
Well I recently went over the code and changed a few things so it shall work with 0.3.6pl1.
Good luck & Enjoy! :thumbup:
:**

[email protected]

I think PUFFS is not good for this script, players may abuse it to make crash/lags
 
Last edited:
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Update/Bump

Check the first post.
 

menfes

Sociopat
Joined
Feb 7, 2009
Messages
380
Best answers
0
Reaction score
4
Location
Space
Wow, why are so many people trying to insult JDB so much? He makes good scripts, and instead of being negative you can try to be more positive and write good stuff instead of bad, or write bad stuff but in a good way.
 
Top