LucasFerraz
Systems Analyst
All scripts working 100% like tibiarl.
I hope It will contribute to your RPG Server.
Surprise Bags
Treasure Map
Spellwand
Explosive Present
Dolls
Blessed Wooden Stake
Obsidian Knife
Fishing Rod
Waterskin
Ceremonial Ankh
Baking
Baking, blewoutcandle
Custome Bags
Rust Remover
Fireworksrocket
Piggy Bank
Watch
MOVEMENTS
Pillow
Partycake
Swimming
Trap
I hope It will contribute to your RPG Server.
XML:
<!-- Others -->
<action fromid="6570" toid="6571" event="script" value="other/surprisebag.lua"/>
<action itemid="5706" event="script" value="other/treasuremap.lua"/>
<action itemid="7735" script="other/spellwand.lua" allowfaruse="1"/>
<action itemid="8110" script="other/explosivepresent.lua"/>
<action itemid="7737" script="other/costumebags.lua"/>
<action itemid="7738" script="other/costumebags.lua"/>
<action itemid="7739" script="other/costumebags.lua"/>
<action itemid="6576" event="script" value="other/fireworksrocket.lua"/>
<action itemid="2114" event="script" value="other/piggybank.lua"/>
<action itemid="6091" event="script" value="other/watch.lua"/>
<!-- Dolls -->
<action itemid="5080" script="prologue/dolls.lua"/> // Panda Teddy
<action itemid="5669" script="prologue/dolls.lua"/> // Mysterious Voodoo Skull
<action itemid="5670" script="prologue/dolls.lua"/> // Enigmated Voodoo Skull
<action itemid="5791" script="prologue/dolls.lua"/> // Stuffed Dragon
<action itemid="6512" script="prologue/dolls.lua"/> // Santa Doll
<action itemid="7183" script="prologue/dolls.lua"/> // Baby Seal Doll
<action itemid="8974" script="prologue/dolls.lua"/> // Oracle Figurine
<action itemid="8977" script="prologue/dolls.lua"/> // TibiaCity Encyclopedia
<action itemid="8981" script="prologue/dolls.lua"/> // Golden Newspaper
<action itemid="8982" script="prologue/dolls.lua"/> // Norseman Doll
<action itemid="9006" script="prologue/dolls.lua"/> // Toy Spider
<!-- Tools -->
<action itemid="5942" event="script" value="tools/blessed_wooden_stake.lua"/>
<action itemid="5908" event="script" value="tools/obsidian_knife.lua"/>
<action itemid="10223" event="script" value="tools/fishing.lua" allowfaruse="1"/>
<action itemid="7734" script="tools/waterskin.lua"/>
<action itemid="6561" script="tools/ceremonialankh.lua"/>
<action itemid="9930" event="script" value="tools/rust_remover.lua"/>
<!-- Baking -->
<action itemid="2694" script="other/baking.lua"/> <!--Wheat-->
<action itemid="2692" script="other/baking.lua"/> <!--Flour-->
<action itemid="2693" script="other/baking.lua"/> <!--Lump of dough-->
<action itemid="6277" script="other/baking.lua"/> <!--Lump of cake dough-->
<action itemid="2566" script="other/baking.lua"/> <!--Kitchen knife-->
<action itemid="2561" script="other/baking.lua"/> <!--Baking tray-->
<action itemid="8848" script="other/baking.lua"/> <!--Baking tray (with cookies)-->
<action itemid="8846" script="other/baking.lua"/> <!--Lump of chocolate dough-->
<action itemid="6280" event="script" value="other/blewoutcandle.lua"/>
Surprise Bags
Lua:
local PRESENT_BLUE = {2687, 6394, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114}
local PRESENT_RED = {2152, 2153, 5944, 2492, 2520, 2195, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = 1
if(item.itemid == 6570) then
local randomChance = math.random(1, #PRESENT_BLUE)
if(randomChance == 1) then
count = 10
elseif(randomChance == 2) then
count = 3
end
doPlayerAddItem(cid, PRESENT_BLUE[randomChance], count)
elseif(item.itemid == 6571) then
local randomChance = math.random(1, #PRESENT_RED)
if randomChance > 0 and randomChance < 4 then
count = 10
end
doPlayerAddItem(cid, PRESENT_RED[randomChance], count)
end
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
return true
end
Treasure Map
Lua:
local t, p, storage = {
[0] = 'north',
[1] = 'east',
[2] = 'south',
[3] = 'west',
[4] = 'south-west',
[5] = 'south-east',
[6] = 'north-west',
[7] = 'north-east'
},
{x=32346, y=32947, z=7},
101
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, storage) == 1 then
return doCreatureSay(cid, 'You already found the treasure.', TALKTYPE_ORANGE_1, false, cid)
end
local k = getThingPos(cid)
if doComparePositions(k, p) then
doCreatureSetStorage(cid, storage, 1)
doPlayerAddItem(cid, 2152, 50)
doRemoveItem(item.uid)
doCreatureSay(cid, 'Yo-ho. I\'ve found a treasure.', TALKTYPE_ORANGE_1, false, cid)
else
doCreatureSay(cid, 'Treasure is to the ' .. t[getDirectionTo(k, p)] .. '.', TALKTYPE_ORANGE_1, false, cid)
end
return true
end
Spellwand
Lua:
local outfits = {"rat", "green frog", "chicken"} --possible outfits
local duration = 45 --duration of the outfit in seconds
local breakchance = 7 --chance of losing the wand
function onUse(cid, item, fromPosition, itemEx, toPosition)
if math.random(100) <= breakchance then
doSummonCreature("Mad Sheep",toPosition)
doRemoveItem(item.uid,1)
return TRUE
end
if isPlayer(itemEx.uid) == TRUE then
doSetMonsterOutfit(itemEx.uid,outfits[math.random(#outfits)],duration*1000)
doSendMagicEffect(toPosition,CONST_ME_MAGIC_BLUE)
return TRUE
end
end
Explosive Present
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doRemoveItem(item.uid,1)
doCreatureSay(cid,"KABOOOOOOOOOOM!",TALKTYPE_ORANGE_1)
doSendMagicEffect(fromPosition,CONST_ME_FIREAREA)
end
Dolls
Lua:
local book = {"Weirdo, you're a weirdo! Actually all of you are!", "Pie for breakfast, pie for lunch and pie for dinner!", "All hail the control panel!", "I own, Tibiacity owns, perfect match!", "Hug me! Feed me! Hail me!"}
local dragon = {"Fchhhhhh!", "Zchhhhhh!"}
local news = {"It's news to me.", "News, updated as infrequently as possible!", "Extra! Extra! Read all about it!", "Fresh off the press!"}
local norseman = {"Hail TibiaNordic!", "So cold..", "Run, mammoth!"}
local santa = {"Ho ho ho!", "Jingle bells, jingle bells...", "Have you been naughty?", "Have you been nice?", "Merry Christmas!", "Can you stop squeezing me now... I'm starting to feel a little sick."}
local skull = {"It's not winning that matters, but winning in style.", "Today's your lucky day. Probably.", "Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.", "That is one stupid question.", "You'll need more rum for that.", "Do or do not. There is no try.", "You should do something you always wanted to.", "If you walk under a ladder and it falls down on you it probably means bad luck.", "Never say 'oops'. Always say 'Ah, interesting!'", "Five steps east, fourteen steps south, two steps north and seventeen steps west!"}
function onUse(cid, item, frompos, item2, topos)
local n = math.random(1, 20)
if item.itemid == 5791 then
if n == 1 then
doCreatureSay(cid,"Aaa... CHOO!", 0x13)
doSendMagicEffect(frompos, 6)
doTransformItem(item.uid,6566)
doDecayItem(item.uid)
elseif n == 2 then
doCreatureSay(cid,"You... will.... burn!!", 0x13)
doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -1, -1, CONST_ME_FIREATTACK)
doTransformItem(item.uid,6566)
doDecayItem(item.uid)
elseif n == 3 then
doCreatureSay(cid,"Grooaaaaar *cough*", 0x13)
doSendMagicEffect(getPlayerPosition(cid), 2)
doTransformItem(item.uid,6566)
doDecayItem(item.uid)
else
doCreatureSay(cid, dragon[math.random(1, #dragon)], 0x13)
doTransformItem(item.uid,6566)
doDecayItem(item.uid)
end
elseif item.itemid == 8974 then
doCreatureSay(cid,"ARE YOU PREPARED TO FACE YOUR DESTINY?", 0x13)
doTransformItem(item.uid,8975)
doDecayItem(item.uid)
elseif item.itemid == 5080 then
doCreatureSay(cid,"Hug me!", 0x13)
doTransformItem(item.uid,6568)
doDecayItem(item.uid)
elseif item.itemid == 6512 then
doCreatureSay(cid, santa[math.random(1, #santa)], 0x13)
doTransformItem(item.uid,6567)
doDecayItem(item.uid)
elseif item.itemid == 8981 then
doCreatureSay(cid, news[math.random(1, #news)], 0x13)
doTransformItem(item.uid,9004)
doDecayItem(item.uid)
elseif item.itemid == 8977 then
doCreatureSay(cid, book[math.random(1, #book)], 0x13)
doTransformItem(item.uid,9002)
doDecayItem(item.uid)
elseif item.itemid == 8982 then
doCreatureSay(cid, norseman[math.random(1, #norseman)], 0x13)
doTransformItem(item.uid,8985)
doDecayItem(item.uid)
elseif item.itemid == 5669 then
doCreatureSay(cid, skull[math.random(1, #skull)], 0x13)
doSendMagicEffect(frompos, 13)
doTransformItem(item.uid,5670)
doDecayItem(item.uid)
elseif item.itemid == 5670 then
doPlayerSendTextMessage(cid,25,"It is not time yet.")
doSendMagicEffect(frompos, 12)
elseif item.itemid == 7183 then
doTransformItem(item.uid,7184)
doDecayItem(item.uid)
elseif item.itemid == 9006 then
doTransformItem(item.uid,9007)
doDecayItem(item.uid)
end
return 0
end
Blessed Wooden Stake
Lua:
local config = {
level = 2
}
local DUSTS = {
-- Demons
[2956] = {20, 5905},
-- Vampires
[2916] = {20, 5906}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < config.level) then
doPlayerSendCancel(cid, "You have to be at least Level " .. config.level .. " to use this tool.")
return true
end
local dust = DUSTS[itemEx.itemid]
if(not dust) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local random = math.random(1, 100)
if(random <= dust[1]) then
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerAddItem(cid, dust[2], 1)
elseif(dust[3] and random >= dust[3]) then
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerAddItem(cid, dust[4], 1)
else
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
doTransformItem(itemEx.uid, itemEx.itemid + 1)
return true
end
Obsidian Knife
Lua:
local MINOTAUR_LEATHER, LIZARD_LEATHER, GREEN_DRAGON_LEATHER, RED_DRAGON_LEATHER, HARDENED_BONE, BEHEMOTH_FANG = 5878, 5876, 5877, 5948, 5925, 5893
local config = {
[3090] = {25, MINOTAUR_LEATHER},
[2871] = {25, MINOTAUR_LEATHER},
[2866] = {25, MINOTAUR_LEATHER},
[2876] = {25, MINOTAUR_LEATHER},
[3104] = {25, GREEN_DRAGON_LEATHER},
[2881] = {25, RED_DRAGON_LEATHER},
[2931] = {25, BEHEMOTH_FANG},
[4256] = {25, LIZARD_LEATHER},
[4259] = {25, LIZARD_LEATHER},
[4262] = {25, LIZARD_LEATHER},
[11285] = {25, LIZARD_LEATHER},
[11277] = {25, LIZARD_LEATHER},
[11269] = {25, LIZARD_LEATHER},
[11273] = {25, LIZARD_LEATHER},
[11281] = {25, LIZARD_LEATHER},
[3031] = {25, HARDENED_BONE}
}
local pumpkin_items = {
[1] = {2683},
[2] = {2688, 50},
[3] = {6571},
[4] = {6492},
[5] = {6574},
[6] = {6526},
[7] = {2096},
[8] = {9005, 20}
}
local sculpting = {
[7441] = {randsize = 4, newid = 7442},
[7442] = {randsize = 5, newid = 7444},
[7444] = {randsize = 6, newid = 7445},
[7445] = {randsize = 7, newid = 7446},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 8961 then
if getPlayerStorageValue(cid, 81279) <= 0 then
doCreatureSay(cid, "Happy Halloween!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), math.random(28,30))
setPlayerStorageValue(cid, 81279, 1)
local v = pumpkin_items[math.random(#pumpkin_items)]
doPlayerAddItem(cid, v[1], v[2] or 1)
else
doCreatureSay(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, false, cid)
end
return true
end
-- Sculpting
local v = sculpting[itemEx.itemid]
if v then
if(math.random(v.randsize) == 1) then
doTransformItem(itemEx.uid, v.newid)
else
doRemoveItem(itemEx.uid)
doCreatureSay(cid, "The attempt at sculpting failed miserably.", TALKTYPE_ORANGE_1)
end
doSendMagicEffect(toPosition, CONST_ME_HITAREA)
return true
end
-- summons
if itemEx.actionid == 91347 then
return doPlayerSendCancel(cid, "You cant skin a summon corpse.")
end
-- Skinning
v = config[itemEx.itemid]
if not v then
return false
elseif math.random(100) <= v[1] then
doPlayerAddItem(cid, v[2], 1)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
end
doTransformItem(itemEx.uid, itemEx.itemid + 1)
doDecayItem(itemEx.uid)
return true
end
Fishing Rod
Lua:
local config = {
waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = getConfigValue("rateSkill"),
allowFromPz = false,
useWorms = true
}
--water elementals config
local find_anything = 30 -- chance to find anything.
local difficulty = 40 -- 1-100 range for difficulty. The higher it is, the less likely it is that player will get a good item
local items = {
[10499] = {2238, 2226, 2148, 2376, 2509, 2168, 7588, 7589, 2152, 2146, 2149, 2169, 7632, 7633, 9811, 9808, 8764, 10220}, -- normal water and massive. I noticed that they are the same one.(based on tibiawikia) QuaS
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,21007) == 1000 then
doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Here, Fishy Fishy!\"")
doPlayerAddAchievement(cid, 7)
end
if items[itemEx.itemid] ~= nil then
if math.random(100) <= find_anything then
doTransformItem(itemEx.uid, 2016)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, 1)
else
local geti = items[itemEx.itemid]
local newId
for i = 1, #items[itemEx.itemid] do
local x = math.random(100)
if (x < difficulty) then
newId = geti[i]
break
elseif (i >= #items[itemEx.itemid]) then
newId = geti[#items[itemEx.itemid]]
end
end
doTransformItem(itemEx.uid, 2016)
doPlayerAddItem(cid, newId, 1)
doSendMagicEffect(toPosition, 1)
end
end
if(not isInArray(config.waterIds, itemEx.itemid)) then
return false
end
if((config.allowFromPz or not getTileInfo(getCreaturePosition(cid)).protection) and itemEx.itemid ~= 493 and
math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) < getPlayerSkill(cid, SKILL_FISHING) and
(not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1)))) then
doPlayerAddItem(cid, ITEM_FISH, 1)
setPlayerStorageValue(cid, 21007, getCreatureStorage(cid, 21007) + 1)
doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return true
end
Waterskin
Lua:
local doniczka_z_ziarnami = 7679 -- > 7678(wzrost), 7665(doniczka) (dacay)
local doniczka_z_listkami = 7670 -- > 7680+(math.rand(0,3)*2) (decay)
local roslinki_1 = {7681, 7683, 7685, 7687} -- > id + 7 (decay)
local roslinki_2 = {7689, 7691, 7693, 7695} -- > id - 1 (decay)
local podlane_roslinki = {7665, 7678, 7680, 7682, 7684, 7686, 7688, 7690, 7692, 7694}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(isInArray(podlane_roslinki,itemEx.itemid) == TRUE) then
doCreatureSay(cid, "Your plant doesn't need water.", TALKTYPE_ORANGE_1)
return TRUE
elseif(itemEx.itemid == 7679) then
if(math.random(1,3) == 1) then
doCreatureSay(cid, "Your plant has grown to the next stadium!", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, 7678)
doDecayItem(itemEx.uid)
else
doCreatureSay(cid, "You watered your plant.", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, 7665)
doDecayItem(itemEx.uid)
end
elseif(itemEx.itemid == 7670) then
doCreatureSay(cid, "Your plant has grown to the next stadium!", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, 7680+(math.random(0,3)*2))
doDecayItem(itemEx.uid)
elseif(isInArray(roslinki_1,itemEx.itemid) == TRUE) then
doCreatureSay(cid, "Your plant has grown to the next stadium!", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, itemEx.itemid+7)
doDecayItem(itemEx.uid)
elseif(isInArray(roslinki_2,itemEx.itemid) == TRUE) then
doCreatureSay(cid, "You watered your plant.", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, itemEx.itemid-1)
doDecayItem(itemEx.uid)
end
return TRUE
end
Ceremonial Ankh
Lua:
function onUse(cid, item)
first = ""
second = ""
third = ""
fourth = ""
fifth = ""
if getPlayerBlessing(cid, 1) then
first = "The Spiritual Shielding"
end
if getPlayerBlessing(cid, 2) then
second = "The Embrace of Tibia"
end
if getPlayerBlessing(cid, 3) then
third = "The Fire of the Suns"
end
if getPlayerBlessing(cid, 4) then
fourth = "The Wisdom of Solitude"
end
if getPlayerBlessing(cid, 5) then
fifth = "The Spark of the Phoenix"
end
doPlayerSendTextMessage(cid,25,"You have the followings Blessings:\n"..first.."\n"..second.."\n"..third.."\n"..fourth.."\n"..fifth.."")
return TRUE
end
Baking
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local liquidContainers = {1775, 2005}
local ovens = {1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363}
local lumpsOfChocolateDough = getPlayerItemCount(cid, 6277) + getPlayerItemCount(cid, 6574)
if item.itemid == 2692 and isInArray(liquidContainers, itemEx.itemid) == TRUE and itemEx.type == 1 then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, 2693, 1)
doChangeTypeItem(itemEx.uid, item.type - item.type)
elseif item.itemid == 2694 and itemEx.itemid == 1381 then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, 2692, 1)
elseif item.itemid == 2693 and isInArray(ovens, itemEx.itemid) == TRUE then
doChangeTypeItem(item.uid, item.type - 1)
doCreateItem(2689, 1, toPosition)
elseif item.itemid == 2692 and isInArray(liquidContainers, itemEx.itemid) == TRUE and itemEx.type == 6 then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, 6277, 1)
doChangeTypeItem(itemEx.uid, itemEx.type - itemEx.type)
elseif item.itemid == 6277 and isInArray(ovens, itemEx.itemid) == TRUE then
doChangeTypeItem(item.uid, item.type - 1)
doCreateItem(6278, 1, toPosition)
elseif item.itemid == 2566 and (itemEx.itemid == 2679 or itemEx.itemid == 2680) and getPlayerItemCount(cid, 6278) > 0 then
doRemoveItem(itemEx.uid, 1)
doPlayerRemoveItem(cid, 6278, 1)
doPlayerAddItem(cid, 6279, 1)
elseif item.itemid == 6277 and itemEx.itemid == 2561 then
doRemoveItem(item.uid, 1)
doTransformItem(itemEx.uid, 8848)
elseif item.itemid == 8848 and isInArray(ovens, itemEx.itemid) == TRUE then
doTransformItem(item.uid, 2561)
doCreateItem(2687, 12, toPosition)
elseif item.itemid == 6277 and itemEx.itemid == 6574 then
doRemoveItem(itemEx.uid, 1)
doChangeTypeItem(item.uid, item.type - 1)
if (getPlayerItemCount(cid, 6277) + getPlayerItemCount(cid, 6574)) ~= lumpsOfChocolateDough then
doPlayerAddItem(cid, 8846, 1)
else
doCreateItem(8846, 1, toPosition)
end
elseif item.itemid == 8846 and isInArray(ovens, itemEx.itemid) == TRUE then
doChangeTypeItem(item.uid, item.type - 1)
doCreateItem(8847, 1, toPosition)
else
return FALSE
end
return TRUE
end
Baking, blewoutcandle
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doTransformItem(item.uid, 6279)
doCreatureSay(cid, getPlayerName(cid) .. " blew out the candle.", TALKTYPE_ORANGE_1)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
return TRUE
end
Custome Bags
Lua:
local common = {"orc warrior", "pirate cutthroat", "dworc voodoomaster", "dwarf guard", "minotaur mage"}
local uncommon = {"quara hydromancer", "diabolical imp", "banshee", "frost giant", "lich"}
local deluxe = {"serpent spawn", "demon", "juggernaut", "behemoth", "rahemos"}
local duration = 18000 --the time the outfit will last
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,21029) == 100 then
doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Masquerader\".")
doPlayerAddAchievement(cid, 29)
end
if item.itemid == 7737 then
doSetMonsterOutfit(cid,common[math.random(#common)],duration*1000)
elseif item.itemid == 7738 then
doSetMonsterOutfit(cid,uncommon[math.random(#uncommon)],duration*1000)
elseif item.itemid == 7739 then
doSetMonsterOutfit(cid,deluxe[math.random(#deluxe)],duration*1000)
end
doRemoveItem(item.uid,1)
setPlayerStorageValue(cid, 21029, getCreatureStorage(cid, 21029) + 1)
doSendMagicEffect(fromPosition,CONST_ME_MAGIC_BLUE)
return TRUE
end
Rust Remover
Lua:
local t = {
[9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor
[9809] = {2464, 2465, 2483, 2463, 2476, 8891, 2487}, --semi-rare rusty armor
[9810] = {2464, 2465, 2483, 2463, 2476, 8891, 2487, 2466, 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)
local k = t[itemEx.itemid]
if k then
if math.random(10) <= 6 then
doRemoveItem(itemEx.uid)
doCreatureSay(cid, "You broke it.", TALKTYPE_ORANGE_1)
else
local v = k[math.random(#k)]
doTransformItem(itemEx.uid, v)
doCreatureSay(cid, 'You removed the rust, revealing a '.. getItemInfo(v).name .. '.', TALKTYPE_ORANGE_1)
local n = math.max(0, getCreatureStorage(cid, 21065)) + 1
if n <= 1000 then
doCreatureSetStorage(cid, 21065, n)
if n == 1000 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Congratulations! You earned the achievement "Polisher".')
doPlayerAddAchievement(cid, 65)
end
end
end
return doChangeTypeItem(item.uid, item.type - 1)
end
end
Fireworksrocket
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,21024) == 250 then
doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Fireworks in the Sky\".")
doPlayerAddAchievement(cid, 24)
end
if fromPosition.x ~= CONTAINER_POSITION then
fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
doSendMagicEffect(fromPosition, fireworksEffect)
else
doSendMagicEffect(fromPosition, CONST_ME_HITBYFIRE)
doSendMagicEffect(fromPosition, CONST_ME_EXPLOSIONAREA)
doCreatureSay(cid, "Ouch! Rather place it on the ground next time.", TALKTYPE_ORANGE_1)
doCreatureAddHealth(cid, -10)
end
doRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, 21024, getCreatureStorage(cid, 21024) + 1)
return TRUE
end
Piggy Bank
Lua:
local coin = {2148}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,21018) == 50 then
doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Allowance Collector\".")
doPlayerAddAchievement(cid, 18)
end
local count = 1
if item.itemid == 2114 then
local randomChance = math.random(1)
if randomChance == 1 then
count = math.random(1,2)
elseif randomChance == 2 then
count = 3
end
doPlayerAddItem(cid, coin[randomChance], count)
end
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doTransformItem(item.uid, 2115)
setPlayerStorageValue(cid, 21018, getCreatureStorage(cid, 21018) + 1)
return TRUE
end
Watch
Lua:
local config = {
tibianTime = true,
twentyFour = true
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local _time = ""
if(config.tibianTime) then
local varh = (os.date('%M') * 60 + os.date('%S')) / 150
local tibH = math.floor(varh)
local tibM = math.floor(60 * (varh - tibH))
if(tibH < 10) then
tibH = '0' .. tibH
end
if(tibM < 10) then
tibM = '0' .. tibM
end
_time = tibH .. ':' .. tibM
else
if(config.twentyFour) then
_time = os.date('%H:%M')
else
_time = os.date('%I:%M %p')
end
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The time is " .. _time .. ".")
return true
end
MOVEMENTS
XML:
<!-- Traps -->
<movevent type="StepIn" itemid="1510" event="script" value="trap.lua"/>
<movevent type="StepOut" itemid="1511" event="script" value="trap.lua"/>
<movevent type="StepIn" itemid="1512" event="script" value="trap.lua"/>
<movevent type="StepOut" itemid="1513" event="script" value="trap.lua"/>
<movevent type="StepIn" itemid="2579" event="script" value="trap.lua"/>
<movevent type="RemoveItem" itemid="2579" event="script" value="trap.lua"/>
<!-- Swimming -->
<movevent type="StepIn" actionid="4828-4831" event="script" value="swimming.lua"/>
<movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/>
<movevent type="StepIn" itemid="8072" event="script" value="pillow.lua"/>
<movevent type="AddItem" tileitem="1" itemid="6279" event="script" value="partycake.lua"/>
Pillow
Lua:
function onStepIn(cid, item, pos)
doCreatureSay(cid,"Faaart!",TALKTYPE_ORANGE_1)
end
Partycake
Lua:
function onAddItem(moveitem, tileitem, pos)
if moveitem.itemid == 2048 then
doRemoveItem(tileitem.uid, 1)
doRemoveItem(moveitem.uid, 1)
doCreateItem(6280, 1, pos)
end
end
Swimming
Lua:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local BORDERS = {
[7943] = {x = 0, y = -2, back = SOUTH},
[7944] = {x = -2, y = 0, back = EAST},
[7945] = {x = 0, y = 2, back = NORTH},
[7946] = {x = 2, y = 0, back = WEST},
[7947] = {x = 2, y = 1, back = WEST},
[7948] = {x = -2, y = 1, back = NORTH},
[7949] = {x = 2, y = -1, back = WEST},
[7950] = {x = -2, y = -1, back = EAST},
[7951] = {x = 2, y = 2, back = WEST},
[7952] = {x = -2, y = 2, back = NORTH},
[7953] = {x = 2, y = -2, back = WEST},
[7954] = {x = -2, y = -2, back = SOUTH}
}
BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if(not isPlayer(cid)) then
return true
end
local border = BORDERS[item.itemid]
if(not border) then
return false
end
local pos, newPos = getCreaturePosition(cid), {}
newPos = pos
newPos.x = pos.x + border.x
newPos.y = pos.y + border.y
if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
doMoveCreature(cid, border.back)
doRemoveCondition(cid, CONDITION_OUTFIT)
else
if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
return false
end
local tmp = getCreaturePosition(cid)
doTeleportThing(cid, newPos)
if(not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
end
doRemoveConditions(cid, true)
doSetCreatureOutfit(cid, outfit, -1)
end
return true
end
Trap
Lua:
function onStepIn(cid, item, pos)
if item.itemid == 2579 then
if isPlayer(cid) ~= TRUE then
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -15, -30, CONST_ME_NONE)
doTransformItem(item.uid, item.itemid - 1)
end
else
if isPlayer(cid) == TRUE then
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
doTransformItem(item.uid, item.itemid + 1)
end
end
return TRUE
end
function onStepOut(cid, item, pos)
doTransformItem(item.uid, item.itemid - 1)
return TRUE
end
function onRemoveItem(item, tile, pos)
if getDistanceBetween(getThingPos(item.uid), pos) > 0 then
doTransformItem(item.uid, item.itemid - 1)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_POFF)
end
return TRUE
end
Last edited: