• 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!

NPC Grizzly Adams (Killing in the name of... Quest) All tasks, more real-tibia

mmheo

New Member
Joined
Sep 14, 2017
Messages
144
Best answers
0
Reaction score
1
it's weird because the script /npc works on my windows host but if i test this on linux the npc says
Code:
16:45 Tester: hi
16:45 Grizzly Adams: Welcome, Tester! I have been expecting you.
16:46 Tester: tasks
16:46 Grizzly Adams: I don't have any task for you right now.

any ideas about why it's this happening? or how to solve?
same problem anyone know how to fix it
 

royalmichael

New Member
Joined
Apr 21, 2020
Messages
51
Best answers
0
Reaction score
2
This is the new script for Killing in the name of... Quest that i made. It includes mort features to real-tibia.

Features:
  • You can start only the tasks acording to your level and/or storage
  • You can repeat tasks (Times can be changed)
  • You can start 3 task at same time (Count can be changed)
  • Rewards are easy to configure and have a lot of features
    • The rewards types are:
      • money/REWARD_MONEY: Gives money to the player.
      • exp/experience/REWARD_EXP: Gives experience points to the player.
      • achievement/ach/REWARD_ACHIEVEMENT: Gives an achievement to player. This works with my achievements system.
      • storage/stor/REWARD_STORAGE: Gives a storage to the player.
      • points/point/REWARD_POINT: Gives Paw & Fur points to the player.
      • items/item/object/REWARD_ITEM: Gives an item to the player.
    • The flags for reward are:
      • value: Here you declare the variables for the rewards. Size of table depends of the type of reward. Example: If reward type = "experience" then value must be {1000}. If reward type = "item" then value must be {2195, 1} (Itemid, count)
      • storage: This flag is used to set an storage to the player when it receives the reward. Used to avoid be rewarded more than one time when task is repeated. Example: storage = {1250, 1}. When player receives a reward, it'll obtain the storage 1250 with value 1 and won't receive the same reward again after repeating the same task.
  • You can check the tasks started.
  • You can check how many Paw & Fur points you have, and also your rank.
  • When a monster is killed, you'll receive a message of how many already killed.
  • Tasks names are declared in the variable 'raceName' but if you want to give a name different to the 'raceName' you can add the variable 'name' to the task (You can see the example in the second task of Necromancers and Priestess)

Note: The system to kill bosses isn't added here. The thing that you can do is add an action-id to the teleports to room bosses and check with a script if player has x storage

First of all, you need to add this lib:
Lua:
RANK_NONE = 0
RANK_HUNTSMAN = 1
RANK_RANGER = 2
RANK_BIGGAMEHUNTER = 3
RANK_TROPHYHUNTER = 4
RANK_ELITEHUNTER = 5

REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5

        end
    elseif msg:lower() == "cancel" then
        local started = getPlayerStartedTasks(cid)
        if started and #started > 0 then
            selfSay("Cancelling a task will make the count restart. Wich task you want to cancel?", cid)
            talkState[talkUser] = 2
        else
            selfSay("You haven't started any task yet.", cid)
        end
    elseif getTaskByName(msg) and talkState[talkUser] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
        local task = getTaskByName(msg)
        if getCreatureStorage(cid, KILLSSTORAGE_BASE + task) > 0 then
            selfSay("You currently killed " .. getCreatureStorage(cid, KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", cid)
        else
            selfSay("Are you sure you want to cancel this task?", cid)
        end
        talkState[talkUser] = 3
        cancel[cid] = task
    elseif msg:lower() == "yes" and talkState[talkUser] == 3 then
        doCreatureSetStorage(cid, QUESTSTORAGE_BASE + cancel[cid], -1)
        doCreatureSetStorage(cid, KILLSSTORAGE_BASE + cancel[cid], -1)
        selfSay("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", cid)
        talkState[talkUser] = 0
    elseif isInArray({"points", "rank"}, msg:lower()) then
        selfSay("At this time, you have " .. getCreatureStorage(cid, POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 5 and "are an Elite Hunter" or getPlayerRank(cid) == 4 and "are a Trophy Hunter" or getPlayerRank(cid) == 3 and "are a Big Game Hunter" or getPlayerRank(cid) == 2 and "are a Ranger" or getPlayerRank(cid) == 1 and "are a Huntsman" or "haven't been ranked yet") .. ".", cid)
        talkState[talkUser] = 0
    end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Add this line to creaturescripts.xml
XML:
     <event type="kill" name="KillingInTheNameOf" event="script" value="killinginthenameof.lua"/>
data/creaturescripts/scripts/killinginthenameof.lua
Lua:
function onKill(cid, target, lastHit)

    local started = getPlayerStartedTasks(cid)
    if isPlayer(target) or isSummon(target) then return true end
    if started and #started > 0 then
        for _, id in ipairs(started) do
            if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
                if getCreatureStorage(cid, KILLSSTORAGE_BASE + id) < 0 then
                    doCreatureSetStorage(cid, KILLSSTORAGE_BASE + id, 0)
                end
                if getCreatureStorage(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
                    doCreatureSetStorage(cid, KILLSSTORAGE_BASE + id, getCreatureStorage(cid, KILLSSTORAGE_BASE + id) + 1)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureStorage(cid, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
                end
            end
        end
    end
    return true
end
And this line to login.lua
Lua:
    registerCreatureEvent(cid, "KillingInTheNameOf")
And now, i think you are ready to start a task :D
In tfs 1.2 dont work ehh..
 

krithiuss

New Member
Joined
May 2, 2015
Messages
6
Best answers
0
Reaction score
0
hello, i have the tasks sistem in my server, but how can I put tibia coins reward from each task?
 
Top