if doPlayerRemoveItem(cid, 6500, 50) then
doCreatureSetStorageValue(cid, 3949, 1)
selfSay('Now i can give you a trip for 5 crystal coins to dangerous island!', cid)
else
selfSay('I feeling... you don\'t have my demonic essences!', cid)
end
if (getCreatureStorageValue(cid, 3949) == 1) then
if doPlayerRemoveMoney(cid, 50000) then
local newpos = {x = 544, y = 841, z = 7}
doTeleportThing(cid, newpos)
selfSay('Beware of strong creatures, there!', cid)
else
selfSay('I don\'t trust you, at the moment!', cid)
end
else
selfSay('My old eyes dont spotted shiny crystal coins on your hands. Come back when you got 5 crystal coins.', cid)
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 1337
local itemID = 1337
local itemName = Demonic Essence
local itemAmount = 1337
local teleport = {x=1000, y=1000, z=7}
if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
if(getPlayerStorageValue(cid, storage) == -1) then
npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
setPlayerStorageValue(cid, storage, 2)
doTeleportThing(cid, teleport)
talkState[talkUser] = 0
else
npcHandler:say("You do not have my items!", cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 50000) == true then
doTelePortThing(cid, position)
else
npcHandler:say("Sorry, you dont have 5 crystal coins!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
All in one NPC edit the locals.
Lua:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid --[[ REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE! ]]-- local storage = 1337 local itemID = 1337 local itemName = Demonic Essence local itemAmount = 1337 local teleport = {x=1000, y=1000, z=7} if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then if(getPlayerStorageValue(cid, storage) == -1) then npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid) setPlayerStorageValue(cid, storage, 1) elseif(getPlayerStorageValue(cid, storage) == 1) then npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid) talkState[talkUser] = 1 elseif(getPlayerStorageValue(cid, storage) == 2) then npcHandler:say("Would you like to travel again for 5 crystal coins?", cid) talkState[talkUser] = 2 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveItem(cid, itemID, itemAmount)) then npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid) setPlayerStorageValue(cid, storage, 2) doTeleportThing(cid, teleport) talkState[talkUser] = 0 else npcHandler:say("You do not have my items!", cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if doPlayerRemoveMoney(cid, 50000) == true then doTelePortThing(cid, position) else npcHandler:say("Sorry, you dont have 5 crystal coins!", cid) talkState[talkUser] = 0 end elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then npcHandler:say("Then not.", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 1337
local itemID = 1337
local itemName = "Demonic Essence"
local itemAmount = 1337
local teleport = {x=1000, y=1000, z=7}
if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
if(getPlayerStorageValue(cid, storage) == -1) then
npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
setPlayerStorageValue(cid, storage, 2)
doTeleportThing(cid, teleport)
talkState[talkUser] = 0
else
npcHandler:say("You do not have my items!", cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 50000) == true then
doTelePortThing(cid, position)
else
npcHandler:say("Sorry, you dont have 5 crystal coins!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 50000) == true then
doTelePortThing(cid, position)
doTeleportThing(cid, teleport)
local storage = 1337
local itemID = 6500
local itemName = "Demonic Essence"
local itemAmount = 50
local teleport = {x=800, y=743, z=2} ----> VOOLCANO
local teleport = {x=400, y=343, z=7} ----> ENIGMA
local teleport1 = {x=400, y=343, z=7}
doTeleportThing(cid, teleport1)
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 1337
local itemID = 6500
local itemName = "Demonic Essence"
local itemAmount = 50
local teleport2 = {x=800, y=743, z=2}
local teleport1 = {x=400, y=343, z=7}
if(msgcontains(msg, 'voolcano')) then
if(getPlayerStorageValue(cid, storage) == -1) then
npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Would you like to travel again for 1 crystal coins?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
setPlayerStorageValue(cid, storage, 2)
doTeleportThing(cid, teleport2)
talkState[talkUser] = 0
else
npcHandler:say("You do not have my items!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 10000) == true then
doTeleportThing(cid, teleport2, true)
else
npcHandler:say("Sorry, you dont have 1 crystal coins!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
--[CENTER]--
if(msgcontains(msg, 'center') or msgcontains(msg, 'center city')) then
if(getPlayerStorageValue(cid, storage) == -1) then
npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Would you like to travel again for 1 crystal coins?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
setPlayerStorageValue(cid, storage, 2)
doTeleportThing(cid, teleport1)
talkState[talkUser] = 0
else
npcHandler:say("You do not have my items!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 10000) == true then
doTeleportThing(cid, teleport1, true)
else
npcHandler:say("Sorry, you dont have 1 crystal coins!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
-- Configuration --
local t = {
volcano = {x=0, y=0, z=0},
center = {x=0, y=0, z=0}
}
local c = {
storage = 1337,
itemID = 6500,
itemName = "Demonic Essence",
itemAmount = 50,
completePrice = 50000
}
if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
if(getPlayerStorageValue(cid, c.storage) == -1) then
npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. c.itemAmount .." ".. c.itemName .."!", cid)
setPlayerStorageValue(cid, c.storage, 1)
elseif(getPlayerStorageValue(cid, c.storage) == 1) then
npcHandler:say("Did you bring me ".. c.itemAmount .." ".. c.itemName .."?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, c.storage) == 3) then
npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, c.itemID, c.itemAmount)) then
npcHandler:say("Thankyou oh wise one, Where would you like to go? {Volcano} or {Center city}", cid)
setPlayerStorageValue(cid, storage, 3)
talkState[talkUser] = 3
else
npcHandler:say("Wrong items!", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'volcano') and talkState[talkUser] == 3) then
doTeleportThing(cid, t.volcano)
setPlayerStorageValue(cid, c.storage, 3)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'center city') and talkState[talkUser] == 3) then
doTeleportThing(cid, t.center)
setPlayerStorageValue(cid, c.storage, 3)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
npcHandler:say("Would you like to go to {volcano} or {center city}?", cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'volcano') and talkState[talkUser] == 4) then
if doPlayerRemoveMoney(cid, c.completePrice) then
doTeleportThing(cid, t.volcano)
talkState[talkUser] = 0
else
npcHandler:say("Not enough money, you need ".. c.completePrice .."!", cid)
end
elseif(msgcontains(msg, 'center city') and talkState[talkUser] == 4) then
if doPlayerRemoveMoney(cid, c.completePrice) then
doTeleportThing(cid, t.center)
talkState[talkUser] = 0
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Change these
Lua:elseif(msgcontains(msg, 'volcano')
to whatever
I - HI
I - Travel
NPC - Would you like to travel again for 5 crystal coins?
I - YES
NPC - Thankyou oh wise one, Where would you like to go? {Volcano} or {Center city}"