• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[NPC] Wands and Rods For 8.1

Taffy-OTCritic

Banned User
Joined
Dec 13, 2007
Messages
42
Reaction score
0
Location
On Earth. Dont You?
This is a updated script of Razer's. His is for 8.0, this is the one for 8.1. Wasn't hard to make, I just edited a few things.

Prices are also lower than RL Tibia, easy to change. This was for my server.

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'wand of vortex') then
if getPlayerVocation(cid) == 1 then
if getPlayerStorageValue(cid, 1000) == -1 then
selfSay('Here is your first wand young sorcerer.')
doPlayerAddItem(cid,2190,1)
setPlayerStorageValue(cid,1000,1)
else
selfSay('Do you want to buy wand of vortex for 500 gold coins?')
talkState = 1
end
else
selfSay('Wand of Vortex is only for sorcerers.')
end
elseif msgcontains(msg, 'snakebite rod') then
if getPlayerVocation(cid) == 2 then
if getPlayerStorageValue(cid, 1000) == -1 then
selfSay('Here is your first rod young druid.')
doPlayerAddItem(cid,2182,1)
setPlayerStorageValue(cid,1000,1)
else
selfSay('Do you want to buy wand of vortex for 500 gold coins?')
talkState = 2
end
else
selfSay('Snakebite Rod is only for druids.')
end
elseif msgcontains(msg, 'yes') and talkState == 1 then
if doPlayerRemoveMoney(cid, 500) == TRUE then
doPlayerAddItem(cid, 2190, 1)
selfSay('Here you are.')
else
selfSay('Sorry '..getCreatureName(cid)..', you don\'t have enough money.')
end
elseif msgcontains(msg, 'yes') and talkState == 2 then
if doPlayerRemoveMoney(cid, 500) == TRUE then
doPlayerAddItem(cid, 2182, 1)
selfSay('Here you are.')
else
selfSay('Sorry '..getCreatureName(cid)..', you don\'t have enough money.')
end
elseif msgcontains(msg, 'no') and (talkState > 1 and talkState < 2) then
selfSay("Then not.")
talkState = 0
end
return true
end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 1000, 'wand decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'energy'}, 2187, 5000, 'wand cosmic')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 10000, 'wand inferno')

shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 1000, 'necrotic')
shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 5000, 'terra')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 10000, 'hailstorm')


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Credits to Razer for the base of this.
 
Back
Top