erinsx
Princess of the Internet
- Joined
- Nov 3, 2015
- Messages
- 7
- Reaction score
- 10
I did this for TFS 1.2
It is a very simple quest! My quest is called Benji's Plans, that's what I'll show you here.
First: the NPC. Make a file called Benji.xml in /data/npc/ and add this.
Next, Benji's LUA! make a file caled benji.lua in /data/npc/scripts and add this.
Note the unique storage ID i am using for this quest, 12555. You can use whatever you want, as long as it hasn't been used before.
Next, your prize chest. In my quest, Benji asked that you bring him back his ship plans, so along with some other prizes, those are in there too.
The ActionID of the chest MUST be 2000 to work as a quest chest.
The next part will make it show up in the client quest log.
Open /data/XML/quests.xml, and add:
This will register in the quest log when you have accepted the quest, and when you have completed it.
All you have to do now is place Benji, and the prize chest on the map!
Here is how this quest works:
Benji asks you to get back his ship plans.
If you agree, storage value 12555 is set to 1, and the quest has begun.
If you talk to Benji during this time, he will mention that you haven't yet found his plans.
Once you have found his plans, return to him, and he will take the plans, give you a Backpack of Holding in return, thank you, and set storage id 12555 to 2, which will register in the quest log that it is completed.
Any time you attempt to talk to Benji after completing the quest, he will simpy thank you for your help.
Sorry if this is a mess, or useless information, but i thought some might find it useful!
It is a very simple quest! My quest is called Benji's Plans, that's what I'll show you here.
First: the NPC. Make a file called Benji.xml in /data/npc/ and add this.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Benji" script="benji.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="151" head="17" body="54" legs="114" feet="0" />
<parameters>
<parameter key="message_greet" value="Hey! Want to {chat}?"/>
</parameters>
</npc>
Next, Benji's LUA! make a file caled benji.lua in /data/npc/scripts and add this.
Code:
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local player = Player(cid)
if msg == "chat" and player:getStorageValue(12555) ~= 1 and player:getStorageValue(12555) ~= 2 then
selfSay('Can you {help} me adventurer? A bunch of orcs and minotaurs and bonelords jumped me, and ran off with my ship building plans!', cid)
talkState[talkUser] = 1
end
if msg == "help" and talkState[talkUser] == 1 then
selfSay('They ran off south and went underground. Could you get my {plans} back for me? You will be rewarded!', cid)
talkState[talkUser] = 2
end
if msg == "plans" and talkState[talkUser] == 2 then
player:setStorageValue(12555, 1)
selfSay('Okay, you are looking for a hole in the ground to the south. It should have a sign next to it! good luck!', cid)
talkState[talkUser] = 0
end
if msg == "chat" and player:getStorageValue(12555) == 1 and player:getStorageValue(12555) ~= 2 then
if player:getItemCount(ItemType(7702):getId()) > 0 then
player:removeItem(ItemType(7702):getId(), 1)
selfSay('You got it! Thank you so much! Take this special backpack as a reward.', cid)
player:addItem(ItemType(2365):getId(), 1)
player:setStorageValue(12555, 2)
talkState[talkUser] = 0
else
selfSay('Not found my plans yet? I see. Take your time and do your best.', cid)
talkState[talkUser] = 0
end
end
if msg == "chat" and player:getStorageValue(12555) ~= 1 and player:getStorageValue(12555) == 2 then
selfSay('Thank you so much for helping me! It means a lot.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Note the unique storage ID i am using for this quest, 12555. You can use whatever you want, as long as it hasn't been used before.
Next, your prize chest. In my quest, Benji asked that you bring him back his ship plans, so along with some other prizes, those are in there too.
The ActionID of the chest MUST be 2000 to work as a quest chest.
The next part will make it show up in the client quest log.
Open /data/XML/quests.xml, and add:
Code:
<quest name="Benjis Plans" startstorageid="12555" startstoragevalue="1">
<mission name="Find Benjis Stolen Plans" storageid="12555" startvalue="1" endvalue="2">
<missionstate id="1" description="You have been sent to find Benjis stolen ship building plans." />
<missionstate id="2" description="You have found Benjis plans and returned them!" />
</mission>
</quest>
This will register in the quest log when you have accepted the quest, and when you have completed it.
All you have to do now is place Benji, and the prize chest on the map!
Here is how this quest works:
Benji asks you to get back his ship plans.
If you agree, storage value 12555 is set to 1, and the quest has begun.
If you talk to Benji during this time, he will mention that you haven't yet found his plans.
Once you have found his plans, return to him, and he will take the plans, give you a Backpack of Holding in return, thank you, and set storage id 12555 to 2, which will register in the quest log that it is completed.
Any time you attempt to talk to Benji after completing the quest, he will simpy thank you for your help.
Sorry if this is a mess, or useless information, but i thought some might find it useful!