Tasks on Nostalrius 7.7 TFS 1.2 Problem

froy

Premium User
Premium User
Joined
Sep 30, 2009
Messages
98
Reaction score
15
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? ..
 

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
94
Reaction score
5
For example

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


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

froy

Premium User
Premium User
Joined
Sep 30, 2009
Messages
98
Reaction score
15
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:
OP
froy

froy

Premium User
Premium User
Joined
Sep 30, 2009
Messages
98
Reaction score
15
Bump
 
Top