warriorfrog
Active Member
- Joined
- Jul 29, 2015
- Messages
- 334
- Reaction score
- 35
I made my oracle NPC, its work, but i want to... when player leave from rookgaard, all he items depot from town id 7 (rookgaard) send to main (town id 9)...
Should be possible? Anyone know how could do it?
Should be possible? Anyone know how could do it?
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local pos = {x=503, y=716, z=6}
local townid = 9
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg:lower(), "sorcerer") then
if(getPlayerLevel(cid) ~= 8) then
selfSay("You need be level 8 to go to main!", cid)
return true
end
if(getPlayerVocation(cid) ~= 0) then
selfSay("You have a vocation!", cid)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
return true
end
doPlayerSetVocation(cid, 1)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
elseif msgcontains(msg:lower(), "druid") then
if(getPlayerLevel(cid) ~= 8) then
selfSay("You need be level 8 to go to main!", cid)
return true
end
if(getPlayerVocation(cid) ~= 0) then
selfSay("You have a vocation!", cid)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
return true
end
doPlayerSetVocation(cid, 2)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
elseif msgcontains(msg:lower(), "paladin") then
if(getPlayerLevel(cid) ~= 8) then
selfSay("You need be level 8 to go to main!", cid)
return true
end
if(getPlayerVocation(cid) ~= 0) then
selfSay("You have a vocation!", cid)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
return true
end
doPlayerSetVocation(cid, 3)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
elseif msgcontains(msg:lower(), "knight") then
if(getPlayerLevel(cid) ~= 8) then
selfSay("You need be level 8 to go to main!", cid)
return true
end
if(getPlayerVocation(cid) ~= 0) then
selfSay("You have a vocation!", cid)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
return true
end
doPlayerSetVocation(cid, 4)
doPlayerSetTown(cid, townid)
doTeleportThing(cid, pos)
end
-- remove all items from depot town id 7 and send everything to depot town id 9
end -- fim function
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())