ryandometal
Guitarist!
Hello, I know there are several different versions out there, I even did one a while ago, but would like to share one I use and tastes great!
This script is more one of tasks, that is, you talk to the NPC and receive a mission to kill "x" monsters, when completed this mission, you receive your prize. Simple, no? : P
Come on!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO:
Version tested: TFS 0.2x+ (mystic spirit)
First of all, we will make the NPC, and use Behemoth tasks for example.
Open data/npc/scripts/ and create a file named behemoth_task.lua.
Put this script in.
Now, open data/creaturescripts/scripts/ and create a folder named "task", and create a file "behemoth_task.lua.
Put it:
Now, open creaturescripts.xml and add this line:
Open your monster folder, search for behemoth, and add this line under "flags":
It is! You can change the prizes and the EXP that you won in the tasks.
If you get errors, post here to I fix.
Thank you, and rep++ if you use!
This script is more one of tasks, that is, you talk to the NPC and receive a mission to kill "x" monsters, when completed this mission, you receive your prize. Simple, no? : P
Come on!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO:
Version tested: TFS 0.2x+ (mystic spirit)
First of all, we will make the NPC, and use Behemoth tasks for example.
Open data/npc/scripts/ and create a file named behemoth_task.lua.
Put this script in.
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 43313 <!-- Storage ID used in quest-->
if msgcontains(msg, 'task') or msgcontains(msg, 'mission') or msgcontains(msg, 'quest') then
selfSay("Heh... I you want to do a task? Sure... can you kill 400 behemoths for me?", cid)
talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) or talkState[talkUser] == 4 then
selfSay("Come back here when you finish your mission.", cid)
elseif(getPlayerStorageValue(cid, quest) == 4) or (getPlayerStorageValue(cid, 667) == 1) or talkState[talkUser] == 5 then
selfSay("Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!", cid)
elseif(getPlayerStorageValue(cid, quest) == 3) then
selfSay("Hey, great. You've done well! As a small reward I give you this steel boots!", cid)
doPlayerAddExp(cid, 500000) <--! Exp that you earn when you complete task -->
doSendAnimatedText(getPlayerPosition(cid),"500000", TEXTCOLOR_WHITE_EXP)
doPlayerAddItem(cid,2645,1) <!-- ID of reward-->
setPlayerStorageValue(cid, quest, 0) <!-- If set storage to 0, you can make this task more than one time, but if you want to do this task only 1 time, set it to 4-->
setPlayerStorageValue(cid, 667, 1) <!-- Storage ID used in quest-->
talkState[talkUser] = 5
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay("Thank\'s!, come back for a reward when you kill 400 behemoths {okay}?", cid)
talkState[talkUser]= 3
elseif msgcontains(msg, 'ok') or msgcontains(msg, 'okay') and talkState[talkUser] == 3 then
selfSay("Okay, good hunt!", cid)
setPlayerStorageValue(cid, quest, 2)
talkState[talkUser]= 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Now, open data/creaturescripts/scripts/ and create a folder named "task", and create a file "behemoth_task.lua.
Put it:
Lua:
function onDeath(cid, corpse, killer)
local monster = getCreatureName(cid)
local behemoth = getPlayerStorageValue(killer, 5572)
if (monster == 'behemoth') and getPlayerStorageValue(killer, 43313) == 2 then
doPlayerSendTextMessage(killer,MESSAGE_STATUS_CONSOLE_BLUE,'You need to kill '.. 400-behemoth..' behemoth.')
setPlayerStorageValue(killer,5572, behemoth+1)
if behemoth == 400 then <!-- Change 400 to value of monsters that you want to kill in the task -->
doPlayerSendTextMessage(killer,MESSAGE_STATUS_CONSOLE_BLUE,'You have killed enought behemoths. Come back and talk to NPC for a possible reward.')
setPlayerStorageValue(killer,5572,-1)
setPlayerStorageValue(killer,43313,0)
else
end
end
end
Now, open creaturescripts.xml and add this line:
Lua:
<event type="death" name="behemoth" script="task/behemoth.lua"/>
Open your monster folder, search for behemoth, and add this line under "flags":
Lua:
<script>
<event name="behemoth"/>
</script>
It is! You can change the prizes and the EXP that you won in the tasks.
If you get errors, post here to I fix.
Thank you, and rep++ if you use!
Last edited: