• 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 Lever Rune(s) System

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
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:
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...
 
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>
 
so what is it? i added youre script, 0.3.5pl1 .,..,.,.
 
@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.
 
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!
 
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:
 
Well I recently went over the code and changed a few things so it shall work with 0.3.6pl1.
Good luck & Enjoy! :thumbup:

:**

EDIT@

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

Check the first post.
 
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.
 
Back
Top