• Vote in October Mapping Competition to select a winner!
  • 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!

Tasks on Nostalrius 7.7 TFS 1.2 Problem

froy

Active Member
Joined
Sep 30, 2009
Messages
134
Solutions
1
Reaction score
25
Hey!

I've been trying to setup a task system/task npc in the files ezzz released 2 months ago.
Now I'm having some problems due to the NPC files does not look like the rest of TFS files.

I'm using this creaturescript CreatureEvent - [CreatureEvent/Npc] Killing in the name of... [Now player can choose the task] (https://otland.net/threads/creatureevent-npc-killing-in-the-name-of-now-player-can-choose-the-task.107936/)

And reduced it down to this for testing purposes:

Code:
local questCreatures =
{
    ["troll"] = {questStarted = (15000,1) questStorage = 15100, creatureStorage = (15000,5) killsRequired = 100, raceName = "Trolls"},
    
    
}
 
local msgType = MESSAGE_STATUS_CONSOLE_RED
 
function onKill(cid, target, lastHit)
 
local creature = questCreatures[getCreatureName(target):lower()]
 
    if creature then
        if isPlayer(target) or isSummon(target) then return true end
 
        if getCreatureStorage(cid, creature.questStarted) > 0 then
            if getCreatureStorage(cid, creature.questStorange) < creature.killsRequired then
                if getCreatureStorage(cid, creature.questStorage) < 0 then
                    doCreatureSetStorage(cid, creature.questStorage, 0)
                end
 
                if getCreatureStorage(cid, creature.creatureStorage) < 0 then
                    doCreatureSetStorage(cid, creature.creatureStorage, 0)
                end
                doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)
                doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1)
                doPlayerSendTextMessage(cid, msgType, getCreatureStorage(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getCreatureStorage(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
            end
        end
    end
    return true
end

My login.lua text line looks like this:
Code:
registerCreatureEvent("task")
And finally my Creaturescript.xml looks like this
Code:
<event type="kill" name="task" value="task.lua"/>


It could also be my usage of storage that might be wrong?

Here's how the npc looks like:

Code:
# GIMUD - Graphical Interface Multi User Dungeon
# tasknpc.npc: Test task NPC

Name = "TASK NPC"
Outfit = (64,0-0-0-0)
Home = [32337,32206,6] 
Radius = 2

Behaviour = {
ADDRESS,"hello$",male,!   -> "Salute, Sir %N."
ADDRESS,"hi$",male,!      -> *
ADDRESS,"hello$",female,! -> "Salute Madam %N."
ADDRESS,"hi$",female,!    -> *
ADDRESS,!                 -> Idle
BUSY,"hello$",!           -> "Please have some patience %N!", Queue
BUSY,"hi$",!              -> *
BUSY,!                    -> "No!"
VANISH,!                  -> "Farewell. Be careful out there!"

"bye"          -> "Good bye. Dont walk in the dark alone, the evil is just around the corner!", Idle
"farewell"     -> *


# TEST TASK
"task",     ->  "I have a task for you, if you are prepared to face and slay 100 trolls that is?", Topic=1
Topic=1           -> "I guess not.."


Topic=1,"yes"       ->  "Return to me when you've slained the 100 trolls!", SetQuestValue(15000,1)

"task",QuestValue(15000)>0,QuestValue(15000)<2   ->  "You've not succeded with your task yet, return when you are done!"
}

I've reached a wall it feels like.. Anyone can see something that I cannot? ..
 
Solution
goto data/creaturescripts/ and create a file tasks.lua
Lua:
local config = {
    ["crocodile"] = {count = 200, storage = 1001, start = 1, plural = "crocodiles"},

    ["dwarf"] = {count = 200, storage = 1002, start = 1...
OP
froy

froy

Active Member
Joined
Sep 30, 2009
Messages
134
Solutions
1
Reaction score
25
For example

"trolls", -> ", setQuestValue(15000,1)


U need use setQuestValue first... this add the storage valur on player...

Are you sure? I want the quest value only to be set when the player actually accepts the task ...
What you are intending on what set a questvalue on the player as soon as player would say troll.
Without even accepting a task as a mission..

Maybe it would be possible to use
Code:
SetStorage(15000,1)
In the NPC files?
Instead of questvalue?
 
Last edited:

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,732
Solutions
22
Reaction score
447
Location
Sweden
What happens if you put

Topic=1 -> "I guess not.."

Below

Topic=1,"yes" -> "Return to me when you've slained the 100 trolls!", SetQuestValue(15000,1)
 
OP
froy

froy

Active Member
Joined
Sep 30, 2009
Messages
134
Solutions
1
Reaction score
25
The placement of (below) doesn't matter.
Topic=1 -> "I guess not.."

Is only used if the player says something else than actually "yes" on that specific topic.
 

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,732
Solutions
22
Reaction score
447
Location
Sweden
The placement of (below) doesn't matter.
Topic=1 -> "I guess not.."

Is only used if the player says something else than actually "yes" on that specific topic.
I see, so it will read the lines from the bottom and up? Or else it should react to any word, including "yes" since the only condition is if Topic = 1.
Unless it reads all files at start and then prioritize the lines with most conditions I guess...!

Edit: you also have a comma-sign "," after the first "task" keyword. Should be without IIRC
 
Last edited:
OP
froy

froy

Active Member
Joined
Sep 30, 2009
Messages
134
Solutions
1
Reaction score
25
Actually I passed this away due to not having any use for it anymore.
But if anyone else wonders and they might use nostalrius files.

After a player answers anything there has to be a comma-sign after their words wich leads to what the npc should respond.

"Sell red rose", -> "Do you want to sell me a red rose for x amount of gold?",Topic=2
Topic=2,"yes" ->"Here you are"

And ofc something to check if player has x amount of red roses and what to pay for it.

If play doesn't answer to procced the current conversation it will look like:

Topic=2 -> "I suppose not"
 

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,732
Solutions
22
Reaction score
447
Location
Sweden
After a player answers anything there has to be a comma-sign after their words wich leads to what the npc should respond.
Sure but in your case you aren't answering anything when first asking for the "task". Maybe it doesn't matter or the system is expecting a condition. Where exactly is the error, does the NPC answer you at all or does it simply not set quest value?
 

Zodia

New Member
Joined
Feb 21, 2020
Messages
72
Reaction score
3
Sure but in your case you aren't answering anything when first asking for the "task". Maybe it doesn't matter or the system is expecting a condition. Where exactly is the error, does the NPC answer you at all or does it simply not set quest value?

When it comes to ".npc", I don't understand anything. Sorry. In my case the npc gives me a mission, except that even if I kill "x" amount of monsters, when I come back and say Task he tells me that I am not finished yet ... "Come back when I finish"
 

Olddies

Advanced OT User
Joined
Nov 21, 2009
Messages
1,085
Solutions
10
Reaction score
234
Location
Rep.Dom
goto data/creaturescripts/ and create a file tasks.lua
Lua:
local config = {
    ["crocodile"] = {count = 200, storage = 1001, start = 1, plural = "crocodiles"},

    ["dwarf"] = {count = 200, storage = 1002, start = 1, plural = "dwarves"},
    ["dwarf soldier"] = {count = 200, storage = 1002, start = 1, plural = "dwarves"},

    ["ghoul"] = {count = 150, storage = 1003, start = 1, plural = "ghouls"},
    ["goblin"] = {count = 75, storage = 1004, start = 1, plural = "goblins"},
    ["larva"] = {count = 100, storage = 1005, start = 1, plural = "larva"},

    ["minotaur"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur guard"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur mage"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur archer"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},

    ["rotworm"] = {count = 80, storage = 1007, start = 1, plural = "rotworms"},

    ["orc"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc shaman"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc rider"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc warlord"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc leader"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc berserker"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc warrior"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},

    --["panda"] = {count = 150, storage = 1009, start = 1, plural = "pandas"},

    ["scarab"] = {count = 100, storage = 1010, start = 1, plural = "scarabs"},


    ["tarantula"] = {count = 150, storage = 1011, start = 1, plural = "tarantulas"},

    ["troll"] = {count = 50, storage = 1012, start = 1, plural = "trolls"},

    ["ancient scarab"] = {count = 200, storage = 1013, start = 1, plural = "ancient scarabs"},

    ["kongra"] = {count = 120, storage = 1014, start = 1, plural = "apes"},
    ["merlkin"] = {count = 120, storage = 1014, start = 1, plural = "apes"},
    ["sibang"] = {count = 120, storage = 1014, start = 1, plural = "apes"},

    ["black knight"] = {count = 75, storage = 1015, start = 1, plural = "black knight"},

    ["cyclops"] = {count = 120, storage = 1016, start = 1, plural = "cyclopses"},

    ["demon skeleton"] = {count = 100, storage = 1017, start = 1, plural = "demon skeleton"},

    ["dragon"] = {count = 350, storage = 1018, start = 1, plural = "dragons"},

    ["dwarf guard"] = {count = 200, storage = 1019, start = 1, plural = "dwarf guards"},

    ["fire elemental"] = {count = 70, storage = 1020, start = 1, plural = "fire elementals"},

    ["giant spider"] = {count = 300, storage = 1021, start = 1, plural = "giant spiders"},

    ["hero"] = {count = 300, storage = 1022, start = 1, plural = "heroes"},

    ["lizard sentinel"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},
    ["lizard snakecharmer"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},
    ["lizard templar"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},

    ["necromancer"] = {count = 350, storage = 1024, start = 1, plural = "necromancers"},

    --["terror bird"] = {count = 150, storage = 1025, start = 1, plural = "terror birds"},

    ["vampire"] = {count = 500, storage = 1026, start = 1, plural = "vampires"},

    ["behemoth"] = {count = 500, storage = 1027, start = 1, plural = "behemoth"},

    ["dragon lord"] = {count = 500, storage = 1028, start = 1, plural = "dragon lords"},

    ["demon"] = {count = 3000, storage = 1029, start = 1, plural = "demons"},

    ["hydra"] = {count = 600, storage = 1030, start = 1, plural = "hydras"},

    ["serpent spawn"] = {count = 300, storage = 1031, start = 1, plural = "serpent spawns"},

    ["warlock"] = {count = 450, storage = 1032, start = 1, plural = "warlocks"},

    ["swamp troll"] = {count = 100, storage = 1033, start = 1, plural = "swamp trolls"},
    ["bug"] = {count = 100, storage = 1034, start = 1, plural = "bugs"},
    ["hyaena"] = {count = 100, storage = 1035, start = 1, plural = "hyaenas"},
    ["frost troll"] = {count = 250, storage = 1036, start = 1, plural = "frost troll"},
    ["wasp"] = {count = 150, storage = 1037, start = 1, plural = "wasps"},
    ["stone golem"] = {count = 100, storage = 1038, start = 1, plural = "stone golem"},
    ["poison spider"] = {count = 75, storage = 1039, start = 1, plural = "poison spider"},
    ["witch"] = {count = 50, storage = 1040, start = 1, plural = "witch"},
    ["skeleton"] = {count = 100, storage = 1041, start = 1, plural = "skeleton"},
    ["elf scout"] = {count = 200, storage = 1042, start = 1, plural = "elven scouts"},
    ["ghost"] = {count = 150, storage = 1043, start = 1, plural = "ghost"},
    ["scorpion"] = {count = 100, storage = 1044, start = 1, plural = "scorpion"},
    ["cave rat"] = {count = 50, storage = 1045, start = 1, plural = "cave rats"},
    ["snake"] = {count = 100, storage = 1046, start = 1, plural = "snakes"},
    ["lion"] = {count = 50, storage = 1047, start = 1, plural = "lions"},
    ["amazon"] = {count = 100, storage = 1048, start = 1, plural = "amazon"},
    ["valkyrie"] = {count = 100, storage = 1049, start = 1, plural = "valkyrie"},
    ["orc spearman"] = {count = 400, storage = 1050, start = 1, plural = "orc spearman"},
    ["beholder"] = {count = 100, storage = 1051, start = 1, plural = "beholders"},
    ["crypt shambler"] = {count = 150, storage = 1052, start = 1, plural = "crypt shamblers"},
    ["mummy"] = {count = 150, storage = 1053, start = 1, plural = "mummies"},
    ["rat"] = {count = 50, storage = 1054, start = 1, plural = "rats"},
}

function onKill(player, target)
    local monster = config[target:getName():lower()]
    if not monster or target:getMaster() then
        return true
    end

    local storageValue = player:getStorageValue(monster.storage)
    if storageValue >= monster.start then
        if storageValue >= monster.count then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
        end
            player:setStorageValue(monster.storage, storageValue + 1)
    end
    return true
end
add this
Code:
<event type="kill" name="Tasks" script="tasks.lua"/>
to creaturescripts.lua
goto data/npc/ and create npc called tusker.npc

CODE]# GIMUD - Graphical Interface Multi User Dungeon

Name = "Tusker"
Outfit = (75,78-79-113-95-3)
Home = [32359,32233,7]
Radius = 1

Behaviour = {
ADDRESS,"hello$",! -> "Welcome %N! The royal Tibians army is looking for brave adventurers to complete tasks for our legion.", SetQuestValue(49999, 1)
ADDRESS,"hi$",! -> *
ADDRESS,"hiho$",! -> *
ADDRESS,! -> Idle

BUSY,"hello$",! -> "Show some patience please.", Queue
BUSY,"hi$",! -> *
BUSY,"hiho$",! -> *
BUSY,! -> NOP
VANISH,! -> "Farewell."

"bye" -> "Farewell.", Idle
"farewell" -> *

@"gen-tasks.ndb"
}[/CODE]

download and extract the attached file and put it in data/npc
 

Attachments

Last edited:
Solution

Zodia

New Member
Joined
Feb 21, 2020
Messages
72
Reaction score
3
goto data/creaturescripts/ and create a file tasks.lua
Lua:
local config = {
    ["crocodile"] = {count = 200, storage = 1001, start = 1, plural = "crocodiles"},

    ["dwarf"] = {count = 200, storage = 1002, start = 1, plural = "dwarves"},
    ["dwarf soldier"] = {count = 200, storage = 1002, start = 1, plural = "dwarves"},

    ["ghoul"] = {count = 150, storage = 1003, start = 1, plural = "ghouls"},
    ["goblin"] = {count = 75, storage = 1004, start = 1, plural = "goblins"},
    ["larva"] = {count = 100, storage = 1005, start = 1, plural = "larva"},

    ["minotaur"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur guard"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur mage"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},
    ["minotaur archer"] = {count = 100, storage = 1006, start = 1, plural = "minotaurs all kind"},

    ["rotworm"] = {count = 80, storage = 1007, start = 1, plural = "rotworms"},

    ["orc"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc shaman"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc rider"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc warlord"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc leader"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc berserker"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},
    ["orc warrior"] = {count = 250, storage = 1008, start = 1, plural = "orcs all kind"},

    --["panda"] = {count = 150, storage = 1009, start = 1, plural = "pandas"},

    ["scarab"] = {count = 100, storage = 1010, start = 1, plural = "scarabs"},


    ["tarantula"] = {count = 150, storage = 1011, start = 1, plural = "tarantulas"},

    ["troll"] = {count = 50, storage = 1012, start = 1, plural = "trolls"},

    ["ancient scarab"] = {count = 200, storage = 1013, start = 1, plural = "ancient scarabs"},

    ["kongra"] = {count = 120, storage = 1014, start = 1, plural = "apes"},
    ["merlkin"] = {count = 120, storage = 1014, start = 1, plural = "apes"},
    ["sibang"] = {count = 120, storage = 1014, start = 1, plural = "apes"},

    ["black knight"] = {count = 75, storage = 1015, start = 1, plural = "black knight"},

    ["cyclops"] = {count = 120, storage = 1016, start = 1, plural = "cyclopses"},

    ["demon skeleton"] = {count = 100, storage = 1017, start = 1, plural = "demon skeleton"},

    ["dragon"] = {count = 350, storage = 1018, start = 1, plural = "dragons"},

    ["dwarf guard"] = {count = 200, storage = 1019, start = 1, plural = "dwarf guards"},

    ["fire elemental"] = {count = 70, storage = 1020, start = 1, plural = "fire elementals"},

    ["giant spider"] = {count = 300, storage = 1021, start = 1, plural = "giant spiders"},

    ["hero"] = {count = 300, storage = 1022, start = 1, plural = "heroes"},

    ["lizard sentinel"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},
    ["lizard snakecharmer"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},
    ["lizard templar"] = {count = 500, storage = 1023, start = 1, plural = "lizards"},

    ["necromancer"] = {count = 350, storage = 1024, start = 1, plural = "necromancers"},

    --["terror bird"] = {count = 150, storage = 1025, start = 1, plural = "terror birds"},

    ["vampire"] = {count = 500, storage = 1026, start = 1, plural = "vampires"},

    ["behemoth"] = {count = 500, storage = 1027, start = 1, plural = "behemoth"},

    ["dragon lord"] = {count = 500, storage = 1028, start = 1, plural = "dragon lords"},

    ["demon"] = {count = 3000, storage = 1029, start = 1, plural = "demons"},

    ["hydra"] = {count = 600, storage = 1030, start = 1, plural = "hydras"},

    ["serpent spawn"] = {count = 300, storage = 1031, start = 1, plural = "serpent spawns"},

    ["warlock"] = {count = 450, storage = 1032, start = 1, plural = "warlocks"},

    ["swamp troll"] = {count = 100, storage = 1033, start = 1, plural = "swamp trolls"},
    ["bug"] = {count = 100, storage = 1034, start = 1, plural = "bugs"},
    ["hyaena"] = {count = 100, storage = 1035, start = 1, plural = "hyaenas"},
    ["frost troll"] = {count = 250, storage = 1036, start = 1, plural = "frost troll"},
    ["wasp"] = {count = 150, storage = 1037, start = 1, plural = "wasps"},
    ["stone golem"] = {count = 100, storage = 1038, start = 1, plural = "stone golem"},
    ["poison spider"] = {count = 75, storage = 1039, start = 1, plural = "poison spider"},
    ["witch"] = {count = 50, storage = 1040, start = 1, plural = "witch"},
    ["skeleton"] = {count = 100, storage = 1041, start = 1, plural = "skeleton"},
    ["elf scout"] = {count = 200, storage = 1042, start = 1, plural = "elven scouts"},
    ["ghost"] = {count = 150, storage = 1043, start = 1, plural = "ghost"},
    ["scorpion"] = {count = 100, storage = 1044, start = 1, plural = "scorpion"},
    ["cave rat"] = {count = 50, storage = 1045, start = 1, plural = "cave rats"},
    ["snake"] = {count = 100, storage = 1046, start = 1, plural = "snakes"},
    ["lion"] = {count = 50, storage = 1047, start = 1, plural = "lions"},
    ["amazon"] = {count = 100, storage = 1048, start = 1, plural = "amazon"},
    ["valkyrie"] = {count = 100, storage = 1049, start = 1, plural = "valkyrie"},
    ["orc spearman"] = {count = 400, storage = 1050, start = 1, plural = "orc spearman"},
    ["beholder"] = {count = 100, storage = 1051, start = 1, plural = "beholders"},
    ["crypt shambler"] = {count = 150, storage = 1052, start = 1, plural = "crypt shamblers"},
    ["mummy"] = {count = 150, storage = 1053, start = 1, plural = "mummies"},
    ["rat"] = {count = 50, storage = 1054, start = 1, plural = "rats"},
}

function onKill(player, target)
    local monster = config[target:getName():lower()]
    if not monster or target:getMaster() then
        return true
    end

    local storageValue = player:getStorageValue(monster.storage)
    if storageValue >= monster.start then
        if storageValue >= monster.count then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
        end
            player:setStorageValue(monster.storage, storageValue + 1)
    end
    return true
end
add this
Code:
<event type="kill" name="Tasks" script="tasks.lua"/>
to creaturescripts.lua
goto data/npc/ and create npc called tusker.npc

CODE]# GIMUD - Graphical Interface Multi User Dungeon

Name = "Tusker"
Outfit = (75,78-79-113-95-3)
Home = [32359,32233,7]
Radius = 1

Behaviour = {
ADDRESS,"hello$",! -> "Welcome %N! The royal Tibians army is looking for brave adventurers to complete tasks for our legion.", SetQuestValue(49999, 1)
ADDRESS,"hi$",! -> *
ADDRESS,"hiho$",! -> *
ADDRESS,! -> Idle

BUSY,"hello$",! -> "Show some patience please.", Queue
BUSY,"hi$",! -> *
BUSY,"hiho$",! -> *
BUSY,! -> NOP
VANISH,! -> "Farewell."

"bye" -> "Farewell.", Idle
"farewell" -> *

@"gen-tasks.ndb"
}[/CODE]

download and extract the attached file and put it in data/npc



First of all thank you for that! I didn't even have an error on the console and I believe I made the right steps. However, after accepting a mission of 50 trolls, even defeating 50 trolls he tells me: "Tusker: You have to kill 50 trolls. Come back later."

After that message, when I ask him about the task, he returns to me: Tusker: You have already received a task.
Post automatically merged:

in tasks.lua I noticed that he should notify me how many to each monster killed. But he doesn't start counting ...

if storageValue >= monster.count then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
Post automatically merged:

 
Last edited:

Olddies

Advanced OT User
Joined
Nov 21, 2009
Messages
1,085
Solutions
10
Reaction score
234
Location
Rep.Dom
First of all thank you for that! I didn't even have an error on the console and I believe I made the right steps. However, after accepting a mission of 50 trolls, even defeating 50 trolls he tells me: "Tusker: You have to kill 50 trolls. Come back later."

After that message, when I ask him about the task, he returns to me: Tusker: You have already received a task.
Post automatically merged:

in tasks.lua I noticed that he should notify me how many to each monster killed. But he doesn't start counting ...

if storageValue >= monster.count then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
Post automatically merged:
are you doing it with gm or player? i think it only works with normal players.
 

Zodia

New Member
Joined
Feb 21, 2020
Messages
72
Reaction score
3
No error on console. Neither during the dialogue, nor by killing the monster.


My Creaturescripts.xml

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" script="login.lua"/>
    <event type="login" name="FirstItems" script="firstitems.lua"/>
    <event type="death" name="PlayerDeath" script="playerdeath.lua"/>
    <event type="kill" name="Tasks" script="tasks.lua"/>
</creaturescripts>

My login.lua:

Code:
function onLogin(player)
    local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. " Please choose your outfit."
        player:sendOutfitWindow()
    else
        if loginStr ~= "" then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format("Your last visit on Aibit: %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    -- Promotion
    if player:isPremium() then
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() < 5 and player:getStorageValue(30018) == 1 then
            player:setVocation(player:getVocation():getId() + 4)
        end
    else
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() > 4 then
            player:setVocation(player:getVocation():getId() - 4)
        end
    end
   
    -- Outfits
    if not player:isPremium() then
        if player:getSex() == PLAYERSEX_FEMALE then
            local outfit = player:getOutfit()
            if outfit.lookType > 139 then
                player:setOutfit({lookType = 136, lookHead = 78, lookBody = 106, lookLegs = 58, lookFeet = 95})
            end
        else
            local outfit = player:getOutfit()
            if outfit.lookType > 131 then
                player:setOutfit({lookType = 128, lookHead = 78, lookBody = 106, lookLegs = 58, lookFeet = 95})
            end
        end
    end

    -- Premium system
    if player:isPremium() then
        player:setStorageValue(43434, 1)
    elseif player:getStorageValue(43434) == 1 then
        player:setStorageValue(43434, 0)
        player:teleportTo({x = 32369, y = 32241, z = 7})
        player:setTown(Town("Thais"))
    end
   
    -- Events
    player:registerEvent("PlayerDeath")
    player:registerEvent("kills")
    registerCreatureEvent("task")
    return true
end




Something wrong?



The gen-tasks.ndb I extracted with ".npc". Inside the server's npcs folder as stated
 
Top