• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Task npc for 8.7

Simply can't download to check this OT... Honestly, it's better if you use a more updated mechanism like TFS 1.5 Nekiro 8.6, which is much better than your server... Just abandon the inferior TFS 0.4x and migrate to TFS 1.x Nekiro, it's already solved!!!... Many scripts and systems you're looking for are always found here on Otland!🤷‍♂️
Post automatically merged:

See what I found on another old forum... It seems like we don't need "lib", just add the NPC and CreatureScript and it's already solved!!!... Let's do it here.

Now in Data/NPC/Scripts create a file called Billie.xml and insert the code inside:
XML:
<?xml version="1.0" encoding="UTF-8"?>

<npc name="Billie" script="Billie.lua" walkinterval="10000" floorchange="0" speed="100">
<health now="150" max="150"/>
<look type="136" head="114" body="119" legs="114" feet="114" corpse="2212"/>

<parameters>
    <parameter key="message_greet" value="Hello |PLAYERNAME|, I need a service... Say {help} or {task} to more informations."/>
</parameters>
</npc>

Now in Data/NPC/Scripts create a file called Billie.lua and insert the code inside:
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


-- VARIABLES --
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
msg = string.lower(msg)

local id_item = 2160 -- ITEM YOU WILL EARN WHEN COMPLETING THE TASK
local quantidade_item = 1 -- NUMBER OF ITEMS YOU WILL WIN
local exp = 500000 -- EXPERIENCE YOU WILL GAIN

local monstro = "Magmar" -- MONSTER NAME
local quantidade_monstro = 50 -- NUMBER OF MONSTERS

local storage = 32500 --NPC STORAGE
local storage_npc = 34900 -- STORAGE THAT THE NPC GIVES TO THE PLAYER TO START THE TASK
local storage_quantidade = 32510 --STORAGE THAT CONTAINS THE NUMBER OF MONSTERS DEFEATED BY THE PLAYER
local storage_task = 32600 -- TASK COMPLETION STORAGE
local storage_mensagem = 32505 -- STORAGE TO MAKE DIALOGUE MORE BEAUTIFUL
local restante = (quantidade_monstro - getPlayerStorageValue(cid, storage_quantidade)) + 1

----------------------------------- [ DIALOGUE WITH NPC] -----------------------------------
 
if msgcontains(msg, 'task') then
 
   if getPlayerStorageValue(cid, storage) == 1 then
      selfSay("You have already done my task.", cid)
      talkState[talkUser] = 0
   return true
 
   else
      if getPlayerStorageValue(cid, storage_npc) < 1 then
         selfSay("I need you kill " ..quantidade_monstro.. " " ..monstro.. ". Do you accept my task?", cid)
      else
         selfSay("Have you already finished my task?", cid)
     end
   talkState[talkUser] = 1
   return true
   end
 

elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then

  if getPlayerStorageValue(cid, storage_mensagem) < 1 and getPlayerStorageValue(cid, storage_npc) < 1 then
    selfSay("Ok, go to complete my task.", cid)
    talkState[talkUser] = 0
    setPlayerStorageValue(cid, storage_mensagem, 1)
    setPlayerStorageValue(cid, storage_npc, 1)
    setPlayerStorageValue(cid, storage_quantidade, 1)
  return true
  end

  if getPlayerStorageValue(cid, storage_task) < 1 then
       selfSay("You don't finish my task yet. You need to kill " ..restante.. " " ..monstro.. " yet." , cid)
    talkState[talkUser] = 0
  return true
 
  else
    selfSay("Congratulations! You finished my task! Receive your reward.", cid)
    doSendMagicEffect(getThingPos(cid), 27)
    doPlayerAddExp(cid, exp)
    doPlayerAddItem(cid, id_item, quantidade_item)
    setPlayerStorageValue(cid, storage, 1)
    talkState[talkUser] = 0
  return true
  end

end
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Now go to Data/Creaturescripts/Scripts and create a file called task_billie and add the code inside:
Lua:
local monstro = "Magmar" -- MONSTER NAME
local quantidade = 50 -- MONSTER QUANTITY
local storage_npc = 34900 -- DON'T MOVE
local storage_quantidade = 32510 -- DON'T MOVE
local storage_task = 32600 -- DON'T MOVE

function onKill(cid, target, lasthit)

if getPlayerStorageValue(cid, storage_npc) > 0 then
   if getPlayerStorageValue(cid, storage_task) < 1 then
      if getPlayerStorageValue(cid, storage_quantidade) < quantidade then
         if isPlayer(cid) and getCreatureName(target) == monstro then            
            local restantes = quantidade - getPlayerStorageValue(cid, storage_quantidade)
            doPlayerSendTextMessage(cid, 27, "Billie: " ..restantes.. " " ..monstro.. " restantes para derrotar." )
    setPlayerStorageValue(cid, storage_quantidade, getPlayerStorageValue(cid, storage_quantidade) + 1)
         return true
         end
   
      elseif getPlayerStorageValue(cid, storage_quantidade) == quantidade then
         doPlayerSendTextMessage(cid, 27, "Billie: You don't have more " ..monstro.. " to defeat. Come back to get your reward.")
         setPlayerStorageValue(cid, storage_quantidade, -1)
         setPlayerStorageValue(cid, storage_task, 1)
      return true
      end

   else
     return true
   end

else
  return true
end

end
Still in Data/Creaturescripts/Scripts, open the login.lua file and look for the part where the event records are located in the code, and add the following line under the last event:
Lua:
registerCreatureEvent(cid, "task_billie")
And finally, in Data/Creaturescripts open creaturescripts.xml and add the tag:
XML:
<event type="kill" name="task_billie" script="task_billie.lua"/>
But I'm not sure if it will work... Let's take advantage and test it there.
this works
Post automatically merged:

how run this server xD
 
Last edited:
Back
Top