whitevo
Feeling good, thats what I do.
Making this into Tutorial requires too much trouble, id rather do in video format if ever.
So i just leave it as it is:
By the time you use these scripts, they might not be exactly the same as in my Whi World server, but have a close resemblance.
Task Master Features:
1. Gives skill points when task completed
2. Tasks can be redone
3. Tasks can be done in party
4. Easy config
5. There can be more than 1 task master NPC
6. Player Friendly hints
-------------------------------------
Task Master.xml NPC>...
task.lua in NPC>SCRIPTS>...
creaturescrpits.xml
So i just leave it as it is:
By the time you use these scripts, they might not be exactly the same as in my Whi World server, but have a close resemblance.
Task Master Features:
1. Gives skill points when task completed
2. Tasks can be redone
3. Tasks can be done in party
4. Easy config
5. There can be more than 1 task master NPC
6. Player Friendly hints
-------------------------------------
Task Master.xml NPC>...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Task Master" script="tasks.lua" walkinterval="2000" speed="200" walkradius="7" floorchange="0" speechbubble="3">
<health max="100" now="100"/>
<look type="264" head="78" body="116" legs="95" feet="121" corpse="20339"/>
</npc>
task.lua in NPC>SCRIPTS>...
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
npcHandler.talkRadius = 1
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()
-- not polished yet to release NPC System, where NPC talk to each-other and players who are
--not even trying to talk to them.
end
function creatureSayCallback(cid, type, msg)
local L = getPlayerLevel(cid)
local noTask = true
local noTaskReport = true
-------- CHAT
local walkawayMessage = taskLocationHinter(cid)
npcHandler:setMessage(MESSAGE_WALKAWAY, walkawayMessage)
if not npcHandler:isFocused(cid) then
if msg == "hi" or msg == "hello" then
npcHandler:addFocus(cid)
for k, v in pairs(tasks) do
if L >= tasks[k].minL and L <= tasks[k].maxL and getPlayerStorageValue(cid, tasks[k].storageID) == -1 then
selfSay("i have {task} for you!", cid)
return true
elseif getPlayerStorageValue(cid, tasks[k].storageID) >= tasks[k].killsRequired then
selfSay("Give me full {report} about your hunt", cid)
return true
end
end
selfSay ("This is a fine day for hunting", cid)
else
return false
end
end
if msg == "bye" or msg == "bb" or msg == "cya" then
selfSay("bye", cid)
npcHandler:releaseFocus(cid)
return true
end
if msgcontains(msg, "help") then
selfSay("This NPC accpets words: {task}, {report}}", cid)
return true
end
-------- SYSTEMS
if msgcontains(msg:lower(), 'task') then
noTask = taskSystem(cid, tasks, noTask)
taskBoolean(cid, noTask)
end
if msgcontains(msg, "report") then
noTaskReport = reportTaskSystem(cid, tasks, noTaskReport)
taskReportBoolean(cid, noTaskReport)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Code:
<event type="modalwindow" name="taskRewards" script="ModalWindow/taskRewards.lua"/>
<event type="kill" name="tasks" script="tasks.lua"/>
Last edited: