Fonte: Otland
Esse é apenas um exemplo.
Essa quest requer que você mate 200 Dragons e/ou Dragon Lords.
Creaturescript
crie um arquivo lua em creaturescripts/scripts/monsterkilldragon.lua e cole o seguinte:
local monsters = { --name = storage ["dragon"] = 55004, ["dragon lord"] = 55004 } function onKill(cid, target) local monster = monsters[getCreatureName(target):lower()] if(isPlayer(target) == FALSE and monster and getPlayerStorageValue(cid, 76669) == 2) then if getPlayerStorageValue(cid, monster) < 200 then local killedMonsters = getPlayerStorageValue(cid, monster) if(killedMonsters == -1) then killedMonsters = 1 end setPlayerStorageValue(cid, monster, killedMonsters + 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 200 dragons.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enough dragons.") setPlayerStorageValue(cid, 76669, 3) end end return TRUE end
em creaturescripts/scripts/login.lua adicione:
registerCreatureEvent(cid, "monsterkill")
em creaturescripts/creaturescripts.xml:
<event type="kill" name="monsterkill" script="monsterkill.lua"/>
[/
NPC
Crie o npc em npc/Martin.xml e adicione:
<?xml version="1.0"?> <npc name="Martin" script="data/npc/scripts/dragon quest.lua" access="3" lookdir="2" walkinterval="2000"> <mana now="800" max="800"/> <health now="132" max="200"/> <look type="151" head="115" body="76" legs="35" feet="117" addons="1" corpse="6080"/> <parameters> <parameter key="message_greet" value="Hi, can you help me? ask me for a {mission}. "/> </parameters> </npc>
em npc/scripts/dragon quest.lua adicione:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local quest = 76669 local reward = 70000 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 if(not npcHandler:isFocused(cid)) then return false elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then npcHandler:say("Great! I'll reward you greatly {ok}?.", cid) talkState[talkUser] = 2 elseif msgcontains(msg, "ok") and talkState[talkUser] == 2 then npcHandler:say("Okay, Hurry up!", cid) setPlayerStorageValue(cid, quest, 2) talkState[talkUser] = 0 elseif msgcontains(msg, "mission") then local str = getPlayerStorageValue(cid, quest) if(str < 2) then npcHandler:say("Great, an adventurer. I need you to slay 200 dragons for me. And then, we might be able to take out those dragon lords. Well, can you slay 200 dragons for me?", cid) talkState[talkUser] = 1 return true elseif(str == 2) then npcHandler:say("Please come back for a reward.", cid) elseif(str == 3) then npcHandler:say("200 dragons, already? You're a true dragon slayer! As I promised, here's your reward.", cid) doPlayerAddItem(cid, 2160, 30) doPlayerAddExp(cid, 1000000) doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and 142 or 134, 2) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been rewarded with the warrior addon!") setPlayerStorageValue(cid, quest, 4) elseif(str == 4) then npcHandler:say("You have done enough for me, I will soon plan our attack!", cid) end talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Este npc vai lhe dar um addon, 1k de exp e 300k gold. Basta mudá-lo para o que quiser
Gostou? por trazer ao Xtibia Rep+ :arrow: