[-]
Shout:
Click Refresh to load shouts.

Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[LUA & OT] Using a Knowledge Parchment
01-14-2009, 03:48 PM (This post was last modified: 01-15-2009 11:42 AM by Jesper_Kladden. Edit Reason: )
Post: #1
[LUA & OT] Using a Knowledge Parchment
This is basicly what it does:

*Checks if the player level is less then 80, if it is you can't use it.
*Adds experience to the player

PHP Code:
local EXP 2000000 -- Amount of EXP to get 
local MESSAGE 
"Earned: 2 000 000 Experience points because of reading this very interresting text." -- The Message to get 
local ID 
1948 -- Parchment 
local CMESSAGE 
"Sorry, minimum level 80 to understand what the inscription says" -- The cancel message to get 
local PDAYS 
-- The amount of days to add to the premium account

function onUse(ciditemfrompositem2topos) -- The Function 
if 
getPlayerLevel(cid) < 80 then -- If the player is less than 80 then do 
doPlayerSendTextMessage(cid23CMESSAGE) -- Send a cancel message that it didn't work 
else   
if item.itemid == ID then -- If the ItemID equals to correct ID then continue 
doPlayerAddExp(cid, EXP) -- Add the Experience to the player 
doPlayerSendTextMessage(cid, 23, MESSAGE) -- Send a text message that everything went well 
doPlayerAddPremiumDays(cid, PDAYS) -- Adds premium account days to the account
doRemoveItem(item.uid, 1) -- Remove the item so you can'
use it over and over again 
end 
return TRUE 
end 
end 

This should be in actions.xml

PHP Code:
<action itemid="1948" script="other/knowledgeparchment.lua"/> 




The code is basicly self explaining (I've written some also)


Rate it , I've been doing LUA for 3 days Big Grin

[Image: image.php?type=sigpic&amp;userid=761...1230799621]
[Image: buttonug.png]
[Image: amini]
Find all posts by this user
Quote this message in a reply
01-15-2009, 11:19 AM
Post: #2
[LUA &amp; OT] Using a Knowledge Parchment
Added so the Script[Action] works perfectly and added what to be in Actions.xml

[Image: image.php?type=sigpic&amp;userid=761...1230799621]
[Image: buttonug.png]
[Image: amini]
Find all posts by this user
Quote this message in a reply
01-15-2009, 11:26 AM
Post: #3
[LUA &amp; OT] Using a Knowledge Parchment
Use tabulators, code should looks pretty nice Smile

Also I don't understand usage of your code.
Find all posts by this user
Quote this message in a reply
01-15-2009, 11:28 AM
Post: #4
[LUA &amp; OT] Using a Knowledge Parchment
What part don't you understand?

[Image: image.php?type=sigpic&amp;userid=761...1230799621]
[Image: buttonug.png]
[Image: amini]
Find all posts by this user
Quote this message in a reply
01-15-2009, 03:18 PM
Post: #5
[LUA &amp; OT] Using a Knowledge Parchment
3/4 of OTServ are in RPG mode.

So what is usage of that code if every 80 level can "hunt" on switching switches.
Find all posts by this user
Quote this message in a reply
01-15-2009, 03:27 PM
Post: #6
[LUA &amp; OT] Using a Knowledge Parchment
Well... If it isn't RPG you can maybe make the server PVP-Enforced? Or just war. And in the body you find these scrolls... I dunno?

And it isn't a switch, it's a parchment.

Also:

The ID can be changed to a Treasure chest (Quest chest) and you get EXP for making quests.

What about that Wink

[Image: image.php?type=sigpic&amp;userid=761...1230799621]
[Image: buttonug.png]
[Image: amini]
Find all posts by this user
Quote this message in a reply
12-10-2009, 09:51 PM
Post: #7
RE: [LUA &amp; OT] Using a Knowledge Parchment
you know you can make 1 unique config no D:?
like
config = { bla = 1, bla1 = 2, etc}
Find all posts by this user
Quote this message in a reply
Post Reply 



Contact UsTProgrammingReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication