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

CreatureEvent [CreatureEvent/Npc] Killing in the name of... [Now player can choose the task]

Hi, this is working great in TFS 0.4 8.6

But summoned monsters count as part of the task.

What do I have to do in order to avoid that? Thanks!
 
Hi, this is working great in TFS 0.4 8.6

But summoned monsters count as part of the task.

What do I have to do in order to avoid that? Thanks!
this line avoid that but idk why it doesnt work for you as expected
Code:
if isPlayer(target) or isSummon(target) then return true end
 
Thank you very much. Now is working.
I think I copied an old version of the script.
 
Last edited:
By the way, does anyone know if there's a talkaction to check your current tasks?

Like: !tasks = Your current tasks are: Trolls: 100/300 Rotworms: 20/300

Thanks again
 
By the way, does anyone know if there's a talkaction to check your current tasks?

Like: !tasks = Your current tasks are: Trolls: 100/300 Rotworms: 20/300

Thanks again
Took a little while.. and I have no idea if there are bugs.. or if this is how the quest even works.. but I tried. xD
Also, it took like 2 hours to do in notepad.. I hope you all enjoy this. T.T
Code:
local t = {
    [1] =  {start = 1510, kills = 100,  storages = {15000, 15001, 15002, 15003, 15004, 15005, 15006}, race = "Trolls" },
    [2] =  {start = 1511, kills = 150,  storages = {15007, 15008, 15009, 15010}, race = "Goblins" },
    [3] =  {start = 1512, kills = 300,  storages = {15011, 15012}, race = "Rotworms" },
    [4] =  {start = 1513, kills = 500,  storages = {15013, 15014, 15015}, race = "Cyclops" },
    [5] =  {start = 1514, kills = 300,  storages = {15016}, race = "Crocodiles" },
    [6] =  {start = 1515, kills = 300,  storages = {15017}, race = "Tarantulas" },
    [7] =  {start = 1516, kills = 150,  storages = {15018}, race = "Carniphilas" },
    [8] =  {start = 1517, kills = 200,  storages = {15019}, race = "Stone Golems" },
    [9] =  {start = 1518, kills = 300,  storages = {15020}, race = "Mammoths" },
    [10] = {start = 1519, kills = 300,  storages = {15021}, race = "Ice Golems" },
    [11] = {start = 1520, kills = 300,  storages = {15022, 15023, 15024, 15025, 15026}, race = "Quaras Scouts" },
    [12] = {start = 1521, kills = 300,  storages = {15027, 15028, 15029, 15030, 15031}, race = "Quaras" },
    [13] = {start = 1522, kills = 70,   storages = {15032, 15033, 15034, 15035}, race = "Water Elementals" },
    [14] = {start = 1523, kills = 70,   storages = {15036, 15037, 15038, 15039}, race = "Earth Elementals" },
    [15] = {start = 1524, kills = 70,   storages = {15040, 15041, 15042, 15043}, race = "Energy Elementals" },
    [16] = {start = 1525, kills = 70,   storages = {15044, 15045, 15046, 15047}, race = "Fire Elementals" },
    [17] = {start = 1526, kills = 200,  storages = {15048}, race = "Mutated Rats" },
    [18] = {start = 1527, kills = 500,  storages = {15049}, race = "Giant Spiders" },
    [19] = {start = 1528, kills = 2000, storages = {15050}, race = "Hydras" },
    [20] = {start = 1529, kills = 2000, storages = {15051}, race = "Sea Serpents" },
    [21] = {start = 1530, kills = 2000, storages = {15052}, race = "Behemoths" },
    [22] = {start = 1531, kills = 1500, storages = {15053}, race = "Serpent Spawns" },
    [23] = {start = 1532, kills = 500,  storages = {15054, 15055}, race = "Green Djinns" },
    [24] = {start = 1533, kills = 500,  storages = {15056, 15057}, race = "Blue Djinns" },
    [25] = {start = 1534, kills = 3000, storages = {15058, 15059, 15060, 15061, 15062, 15063}, race = "Pirates" },
    [26] = {start = 1535, kills = 3000, storages = {15064, 15065, 15067, 15068, 15069}, race = "Pirates - Repeatable" },
    [27] = {start = 1536, kills = 5000, storages = {15070}, race = "Minotaurs" },
    [28] = {start = 1537, kills = 4000, storages = {15071, 15072}, race = "Magicians" },
    [29] = {start = 1538, kills = 1000, storages = {15073, 15074}, race = "Magicians - Repeatable" },
    [30] = {start = 1539, kills = 6666, storages = {15075}, race = "Demons" },
}

function onSay(cid, words, param)

    local str = ""

    for i = 1, #t do
        if getPlayerStorageValue(cid, t[i].start) < 1 then
            str = str .. "" .. t[i].race .. " not started.\n"
        elseif getPlayerStorageValue(cid, t[i].start) == 1 then
            local count = 0
            for n = 1, #t[i].storages do
                count = count + getPlayerStorageValue(cid, t[i].storages[n])
            end
            str = str .. "" .. t[i].race .. " " .. count .. "/" .. t[i].kills .. " killed.\n"
        else
            str = str .. "" .. t[i].race .. " completed.\n"
        end
    end

    doShowTextDialog(cid, 1987, str)

    return true
end
 
@Xikini arent all task monsters defined in the original script already? couldve saved time and just made that table global instead of creating another table that looks the same :(
 
@Xikini arent all task monsters defined in the original script already? couldve saved time and just made that table global instead of creating another table that looks the same :(
Right, you could do that.
But what's the real difference if it's here or there?
Sure, if you wanted to redo the script on page 1 and put everything into 1 table in global, then yeah it'd make sense.
But seeing as the people using the script will be copy pasting the code and testing it out.. and almost no-one is going to look on Page 8 for an 'update' to the script, I'd say it's a giant waste of time.
But hey, that's just my opinion.
Mediocre scripter me.
 
no difference functionality wise, but you would have saved some of your time by telling people to make it global to use the talkaction :p
 
Hahaha thank you both. You're really amazing and kind gentlemen. Maybe an script update would be cool but, who am I to say that? xD
I'll try it now.
 
@Xikini I tested out the script, it looks awesome! but is not working :( it does not show if I started the task, it says "Crocodiles not started", also has an error in console " Cant find race 'crocodiles' " or the started task when I killed a monster.

BTW I really apreciate the time and work yo do. I don't need something that cool or difficult, maybe something more simple, like a text in deffault channel where it says "You haven't start any tasks yet" if the player has no tasks And if the player has started tasks it says "Tasks started: Crocodiles: 100/300, Trolls: 40/50" something like that that doesn't show all the tasks.

Thank you very much, and sorry if I'm being rude or something.

Excuse my english.
Regards!
 
@Xikini I tested out the script, it looks awesome! but is not working :( it does not show if I started the task, it says "Crocodiles not started", also has an error in console " Cant find race 'crocodiles' " or the started task when I killed a monster.

BTW I really apreciate the time and work yo do. I don't need something that cool or difficult, maybe something more simple, like a text in deffault channel where it says "You haven't start any tasks yet" if the player has no tasks And if the player has started tasks it says "Tasks started: Crocodiles: 100/300, Trolls: 40/50" something like that that doesn't show all the tasks.

Thank you very much, and sorry if I'm being rude or something.

Excuse my english.
Regards!
Your talkactions.xml should look something like this
Code:
<talkaction words="/testt" event="script" value="testt.lua"/>
In-game you simply say /testt
and the window should pop-up showing you all your tasks, complete, not started, or Crocodiles 10/30 killed.

I can't guarantee the original script in this thread works or if you've installed it correctly, however my talkaction appears to be working on my test server.

Can you post the error your receiving?
 
Here's the talkaction in file
Code:
<talkaction words="/task" event="script" value="task.lua"/>
and the file in data/talkactions/script has the same name as value.

I copied your script again, now is not giving errors in console but even when I already started the task, it says "Trolls not started" and I've started the task since I'm getting the counting in the default channel.

I'm using TFS 0.4 - 8.6
 
Here's the talkaction in file
Code:
<talkaction words="/task" event="script" value="task.lua"/>
and the file in data/talkactions/script has the same name as value.

I copied your script again, now is not giving errors in console but even when I already started the task, it says "Trolls not started" and I've started the task since I'm getting the counting in the default channel.

I'm using TFS 0.4 - 8.6
I've looked over the script multiple times, and read through the npc multiple times.. I can't see where I've gone wrong.
If you pm me, we can try to set-up a teamviewer session sometime tomorrow, if your available.
We'll be able to troubleshoot issues a lot easier and faster that way.
 
Code:
data/npc/scripts/killinginthenameof.lua:96: attempt to call global 'getCreatureStorage' (a nil value)
stack traceback:
        data/npc/scripts/killinginthenameof.lua:96: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
        data/npc/scripts/killinginthenameof.lua:77: in function <data/npc/scripts/killinginthenameof.lua:77>

0 changes in code, any ideas?
 
I have this error someone know what is what ?
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/killinginthenameof.lua:onCreatureSay
data/npc/scripts/killinginthenameof.lua:61: attempt to call global 'getCreatureStorage' (a nil value)

And my lines 60-62

Lua:
        for i = 1, table.maxn(tasks) do
            text = text .. "\n" .. i .. "  -  " .. tasks[i].raceName .. (getCreatureStorage(cid, tasks[i].questStarted) == 2 and " [Done]" or "")
        end

Thanks
Rasch
 
Change to:

Lua:
for i = 1, table.maxn(tasks) do
            text = text .. "\n" .. i .. "  -  " .. tasks[i].raceName .. (getPlayerStorageValue(cid, tasks[i].questStarted) == 2 and " [Done]" or "")
        end
 
Thanks I add just on the bottom this code:
Lua:
getCreatureStorage = getPlayerStorageValue

but now I have bigger issue:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/killinginthenameof.lua:onKill
data/creaturescripts/scripts/killinginthenameof.lua:127: attempt to call global 'doPlayerSetStorageValue' (a nil value)

I have this error when I Kill Task monster,
This is my Lua: Lines 122-129
Lua:
                if getCreatureStorage(cid, creature.questStorage) < 0 then
                    doCreatureSetStorage(cid, creature.questStorage, 0)
                end
                if getCreatureStorage(cid, creature.creatureStorage) < 0 then
                    doPlayerSetStorageValue(cid, creature.creatureStorage, 0)
                end
                doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)

also on the bottom this script i have:
Lua:
getCreatureStorage = getPlayerStorageValue
doCreatureSetStorage = setPlayerStorageValue

thanks for help
 
Back
Top