- Joined
- Aug 5, 2008
- Messages
- 1,581
- Reaction score
- 81
The point of the thread is to release all the scripts that i've used on my server. I hope they may help someone. If credits are missing, post in the thread and i'll add them. All of the scripts work for 0.3.6 servers. And I know most of them are scattered around OTland but here is a thread where everyone are at the same one.
Mechanical Fishingrod
+
=
action.xml
action/scripts/tools/mechanical_fishing.lua
Rust Remover
=
action.xml
action/scripts/rustremover.lua
Ceremonial Ankh
action.xml
action/scripts/ceremonial_ankh.lua
Experience Stage Item
action.xml
action/scripts/exp.lua
creaturescripts.xml
creaturescripts/scripts/extraExpRate.lua
Winning Lottery Ticket
action.xml
action/scripts/lotto.lua
I will update it when I have more time. This is all you get for now. Credits to the creators of the scripts! I am just sorting them in one thread.
Mechanical Fishingrod
action.xml
Code:
<action itemid="10223" event="script" value="tools/mechanical_fishing.lua" allowfaruse="1"/>
action/scripts/tools/mechanical_fishing.lua
Code:
local useNails = TRUE
local waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(waterIds, itemEx.itemid) == TRUE then
if itemEx.itemid ~= 493 then
if useNails == FALSE or useNails == TRUE and doPlayerRemoveItem(cid, 8309, 1) == TRUE then
if math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) <= getPlayerSkill(cid, SKILL_FISHING) then
doPlayerAddItem(cid, 10224, 1)
end
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
end
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return TRUE
end
return FALSE
end
Rust Remover
action.xml
Code:
<action itemid="9930" event="script" value="tools/rustremover.lua"/>
action/scripts/rustremover.lua
Code:
local breakChance = 60
local rustyItems = {
[9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor
[9809] = {2464, 2465, 2483, 2463, 2476, 8891, 2487}, --semi-rare rusty armor
[9810] = {2465, 2463, 2476, 8891, 2487, 2466, 2492, 2472}, --rare rusty armor
[9811] = {2468, 2648, 2478, 2647, 2477}, --common rusty legs
[9812] = {2468, 2648, 2478, 2647, 2477, 2488}, --semi-rare rusty legs
[9813] = {2468, 2648, 2478, 2647, 2477, 2488, 2470}, --rare rusty legs
[9814] = {2511, 2510, 2530, 2509, 2513, 2515}, --common rusty shield
[9815] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519}, --semi-rare rusty shield
[9816] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519, 2520, 2514}, --rare rusty shield
[9817] = {2643, 3982, 5462, 7457}, --common rusty boots
[9818] = {2643, 3982, 5462, 7457, 2195}, --semi-rare rusty boots
[9819] = {2643, 3982, 5462, 7457, 2195, 2645}, --rare rusty boots
[9820] = {2458, 2460, 2480, 2481, 2457, 2491}, --common rusty helmet
[9821] = {2458, 2460, 2480, 2481, 2457, 2491, 2497}, --semi rare rusty helmet
[9822] = {2458, 2460, 2480, 2481, 2457, 2491, 2497, 2475, 2498} --rare rusty helmet
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if rustyItems[itemEx.itemid] ~= nil then
if math.random(100) <= breakChance then
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
else
local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])]
doTransformItem(itemEx.uid,newId)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
end
doRemoveItem(item.uid,1)
return TRUE
end
return FALSE
end
Ceremonial Ankh
action.xml
Code:
<action itemid="6561" event="script" value="tools/ceremonial_ankh.lua"/>
action/scripts/ceremonial_ankh.lua
Code:
local blessings = {"\nWisdom of Solitude", "\nSpark of the Phoenix", "\nFire of the Suns", "\nSpiritual Shielding", "\nEmbrace of Tibia"}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local result = "Received blessings:"
for i = 1, 5 do
result = getPlayerBlessing(cid, i) and result .. blessings[i] or result
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 20 > result:len() and "No blessings received." or result)
return TRUE
end
Experience Stage Item
action.xml
Code:
<action itemid="6527" event="script" value="donator/exp.lua"/>
action/scripts/exp.lua
Code:
local config = {
rate = 1.6, -- 4x More Experience
time = 5, -- Hours of Exp Time
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600)
addEvent(endExpRate, config.time * 3600 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
end
return TRUE
end
creaturescripts.xml
Code:
<event type="login" name="expRate" event="script" value="extraExpRate.lua"/>
creaturescripts/scripts/extraExpRate.lua
Code:
local config = {
rate = 1.6, -- 4x More Experience
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onLogin(cid)
local str = getPlayerStorageValue(cid, config.storage)
if(str >= 0 and (str - os.time()) > 0) then
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", str))
addEvent(endExpRate, (str - os.time()) * 1000, cid)
else
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
setPlayerStorageValue(cid, config.storage, -1)
end
return TRUE
end
Winning Lottery Ticket
action.xml
Code:
<action itemid="5957" event="script" value="other/lotto.lua"/>
action/scripts/lotto.lua
Code:
function onUse(cid, item, frompos, item2, topos)
rand = math.random(1,11)
if item.itemid == 5957 then
if rand == 7 then
doPlayerSendTextMessage(cid,25,"WINNER, Congratulations you draw a winner lottery ticket!")
doSendMagicEffect(frompos, 12)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendTextMessage(cid,25,"Try again later, you draw blank.")
doSendMagicEffect(frompos, 12)
doTransformItem(item.uid,item.itemid-1)
end
return
end
end
I will update it when I have more time. This is all you get for now. Credits to the creators of the scripts! I am just sorting them in one thread.
Last edited: