Postado Agosto 11, 2016 8 anos Fala galeraaa do tk venho aqui pedir ajuda a concertar este npc, oque ele faz é um npc de missão, ele te manda matar alguns monstros e quando acabar vc ganha a recompensa o problema é que até a parte de aceitar a missão esta tudo ok, mas quando você vai matar os monstros não esta contando para a missão. creaturescripts/scripts/monsterkilldragon.lua Spoiler 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 creaturescripts/scripts/login.lua registerCreatureEvent(cid, "monsterkill") creaturescripts/creaturescripts.xml <event type="kill" name="monsterkill" script="monsterkilldragon.lua"/> em npc/Martin.xml <?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="200" 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> npc/scripts/dragon quest.lua Spoiler 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()) acredito que resolvendo este problema ajudarão também muitos outros membros do forum que querem ter npc parecido com este aqui. ja sabem repzin like a boss pela ajuda.
Postado Agosto 13, 2016 8 anos Autor alguém ajuda aquiiiiiii #UP Editado Agosto 13, 2016 8 anos por rheynkhen (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.