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

Lua Daily npc mission bug

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
Hey, i'm adding this npc
https://otland.net/threads/fixed-npc-with-daily-quests-fully-configurable-by-andu.158833/
but i get these 2 bugs:
Unknown event name - Daily Quest Killing
and
[Error - Event::checkScript] Event onKill not found (data/creaturescripts/scripts/dailyQuestsKilling.lua)


The second one is because i changed onkill to onpreparedeath, that says in the thread, also before changing that the creatures, any monster, when i killed them, they don't die, now it's fixed but i get those 2 errors

i use otx 2.52, i believe is tfs 0.3, my server is 9.83

If you need me to post something plz tell me, altho i have mostly the same that in the thread i posted

Bump
 
Last edited by a moderator:
Update:
Also, if i change back the onPrepareDeath to OnKill, the error
Code:
[Error - Event::checkScript] Event onKill not found (data/creaturescripts/scripts/dailyQuestsKilling.lua)
stops, but the creatures when i kill them, they don't die and i get a constant error in console wich says:


Code:
31/5/2015 16:39:34] [Error - CreatureScript Interface]
[31/5/2015 16:39:35] data/creaturescripts/scripts/dailyQuestsKilling.lua:onKill
[31/5/2015 16:39:35] Description:
[31/5/2015 16:39:35] data/creaturescripts/scripts/dailyQuestsKilling.lua:11: attempt to index global 'mobs' (a nil value)
[31/5/2015 16:39:35] stack traceback:
[31/5/2015 16:39:35]     data/creaturescripts/scripts/dailyQuestsKilling.lua:11: in function <data/creaturescripts/scripts/dailyQuestsKilling.lua:9>
 
Update:
Also, if i change back the onPrepareDeath to OnKill, the error
Code:
[Error - Event::checkScript] Event onKill not found (data/creaturescripts/scripts/dailyQuestsKilling.lua)
stops, but the creatures when i kill them, they don't die and i get a constant error in console wich says:


Code:
31/5/2015 16:39:34] [Error - CreatureScript Interface]
[31/5/2015 16:39:35] data/creaturescripts/scripts/dailyQuestsKilling.lua:onKill
[31/5/2015 16:39:35] Description:
[31/5/2015 16:39:35] data/creaturescripts/scripts/dailyQuestsKilling.lua:11: attempt to index global 'mobs' (a nil value)
[31/5/2015 16:39:35] stack traceback:
[31/5/2015 16:39:35]     data/creaturescripts/scripts/dailyQuestsKilling.lua:11: in function <data/creaturescripts/scripts/dailyQuestsKilling.lua:9>
Post the current script you have now.
 
Post the current script you have now.
Code:
local mobsList = {
    ["Dragon"] = {storage = 44444, raceName = "Dragons"}, -- storage have to be exacly the same as in your npc file!
    ["demon"] = {storage = 45554, raceName = "Demons"},
    ["Goku"] = {storage = 44445, raceName = "Gokus"},
    ["Oozaru"] = {storage = 44446, raceName = "Oozarus"},
    ["demon"] = {storage = 45554, raceName = "Demons"},
}

function onKill(cid, target, lastHit)

local mob = mobs[getCreatureName(target):lower()]

if isPlayer(cid) == true then
    return true
else
    if mob == true then
        local check = getPlayerStorageValue(cid, mob.storage)
        if check >= 0 then
            doPlayerSetStorageValue(cid, storage, check + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mob.raceName .. " killed: " .. (check + 1) .. ".")
        end
    end
end
return true
end

that's the creaturescript
 
Code:
local mobsList = {
    ["Dragon"] = {storage = 44444, raceName = "Dragons"}, -- storage have to be exacly the same as in your npc file!
    ["demon"] = {storage = 45554, raceName = "Demons"},
    ["Goku"] = {storage = 44445, raceName = "Gokus"},
    ["Oozaru"] = {storage = 44446, raceName = "Oozarus"},
    ["demon"] = {storage = 45554, raceName = "Demons"},
}

function onKill(cid, target, lastHit)

local mob = mobs[getCreatureName(target):lower()]

if isPlayer(cid) == true then
    return true
else
    if mob == true then
        local check = getPlayerStorageValue(cid, mob.storage)
        if check >= 0 then
            doPlayerSetStorageValue(cid, storage, check + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mob.raceName .. " killed: " .. (check + 1) .. ".")
        end
    end
end
return true
end

that's the creaturescript
Code:
local mobsList = {
    ["dragon"] = {storage = 44444, raceName = "Dragons"}, -- storage have to be exacly the same as in your npc file!
    ["demon"] = {storage = 45554, raceName = "Demons"},
    ["goku"] = {storage = 44445, raceName = "Gokus"},
    ["oozaru"] = {storage = 44446, raceName = "Oozarus"},
    ["demon"] = {storage = 45554, raceName = "Demons"}
}

function onKill(cid, target, lastHit)

local mob = mobsList[getCreatureName(target):lower()]

if isPlayer(cid) then
    if mob then
    local check = getCreatureStorage(cid, mob.storage)
        if check >= 0 then
            doPlayerSetStorageValue(cid, mob.storage, check + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mob.raceName .. " killed: " .. (check + 1) .. ".")
        end
    end
end
return true
end
Side note for when you add monsters to your list, make sure their names are lower cased.
 
Code:
local mobsList = {
    ["dragon"] = {storage = 44444, raceName = "Dragons"}, -- storage have to be exacly the same as in your npc file!
    ["demon"] = {storage = 45554, raceName = "Demons"},
    ["goku"] = {storage = 44445, raceName = "Gokus"},
    ["oozaru"] = {storage = 44446, raceName = "Oozarus"},
    ["demon"] = {storage = 45554, raceName = "Demons"}
}

function onKill(cid, target, lastHit)

local mob = mobsList[getCreatureName(target):lower()]

if isPlayer(cid) then
    if mob then
    local check = getCreatureStorage(cid, mob.storage)
        if check >= 0 then
            doPlayerSetStorageValue(cid, mob.storage, check + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mob.raceName .. " killed: " .. (check + 1) .. ".")
        end
    end
end
return true
end
Side note for when you add monsters to your list, make sure their names are lower cased.
u.U i'm still getting this (i replace mine for the one you posted)
Code:
[31/5/2015 19:55:48] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
[31/5/2015 19:55:48] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
[31/5/2015 19:55:49] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
 
u.U i'm still getting this (i replace mine for the one you posted)
Code:
[31/5/2015 19:55:48] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
[31/5/2015 19:55:48] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
[31/5/2015 19:55:49] [Warning - Monster::Monster] Unknown event name - Daily Quest Killing
Did you add a script to one of your monsters.xml?
 
Did you add a script to one of your monsters.xml?
yeah! look at goku script

Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="goku" nameDescription="a goku" race="blood" experience="30000" speed="390" manacost="0">
   <health now="20000" max="20000"/>
   <look type="840" corpse= "21283"/>
   <targetchange interval="2000" chance="5"/>
   <strategy attack="80" defense="10"/>
   <flags>
      <flag summonable="0"/>
      <flag attackable="1"/>
      <flag hostile="1"/>
      <flag illusionable="0"/>
      <flag convinceable="0"/>
      <flag pushable="0"/>
      <flag canpushitems="1"/>
      <flag canpushcreatures="1"/>
      <flag targetdistance="1"/>
      <flag runonhealth="0"/>
   </flags>
   <attacks>
      <attack name="melee" interval="2000" skill="100" attack="300"/>
      <attack name="death" interval="2000" chance="100" range="7" min="-500" max="-620">
         <attribute key="shootEffect" value="suddendeath"/>
      </attack>
      <attack name="fire" interval="5000" chance="80" range="7" radius="2" target="1" min="-500" max="-620">
         <attribute key="shootEffect" value="fire"/>
         <attribute key="areaEffect" value="firearea"/>
      </attack>
   </attacks>
   <defenses armor="45" defense="50">
      <defense name="healing" interval="8000" chance="100" min="100" max="400">
         <attribute key="areaEffect" value="blueshimmer"/>
      </defense>
      <defense name="speed" interval="5000" chance="30" speedchange="700" duration="20000">
         <attribute key="areaEffect" value="redshimmer"/>
      </defense>
   </defenses>
   <elements>
   <element energyPercent="0"/>
      <element earthPercent="0"/>
         <element firePercent="0"/>
            <element icePercent="0"/>
               <element deathPercent="0"/>
                  <element physicalPercent="0"/>
   </elements>
   <immunities>
      <immunity physical="0"/>
      <immunity energy="0"/>
      <immunity fire="0"/>
      <immunity poison="0"/>
      <immunity lifedrain="0"/>
      <immunity paralyze="1"/>
      <immunity outfit="0"/>
      <immunity drunk="0"/>
      <immunity invisible="1"/>
   </immunities>
   <summons maxSummons="3">
   </summons>
   <voices interval="5000" chance="100">
    <voice sentence="anda, la pelea apenas va a comenzar" yell="1"/>
   </voices>
   <loot capacity="800">
      <item id="2472" countmax="1" chance="2000"/>
      <item id="2522" countmax="1" chance="2000"/>
      <item id="2470" countmax="1" chance="2000"/>
      <item id="2466" countmax="1" chance="3000"/>
      <item id="2488" countmax="1" chance="500"/>
      <item id="2519" countmax="1" chance="400"/>
      <item id="2392" countmax="1" chance="500"/>
      <item id="2152" countmax="100" chance="60000"/>
      <item id="2681" countmax="1" chance="20000"/>
      <item id="2652" countmax="1" chance="8000"/>
      <item id="2071" countmax="1" chance="15000"/>
      <item id="2666" countmax="2" chance="18000"/>
      <item id="2164" countmax="1" chance="500"/>
      <item id="2744" countmax="1" chance="20000"/>
      <item id="2401" countmax="1" chance="2000"/>
      <item id="2139" countmax="1" chance="500"/>
      <item id="21422" countmax="1" chance="10"/>
      <item id="21423" countmax="1" chance="10"/>
      <item id="21424" countmax="1" chance="10"/>
      <item id="21425" countmax="1" chance="10"/>
      <item id="21426" countmax="1" chance="10"/>
      <item id="21427" countmax="1" chance="10"/>
      <item id="21428" countmax="1" chance="10"/>
   </loot>
<script>
    <event name="Daily Quest Killing"/>
</script>
</monster>
 
Alright remove the
<script>
<event name="Daily Quest Killing"/>
</script>
and if you added it anywhere else aswell
 
Alright remove the
<script>
<event name="Daily Quest Killing"/>
</script>
and if you added it anywhere else aswell
ok i removed those, now the error is gone, but the npc doesn't work properly, when the npc asks me if i killed the 100 dragon and i say yes, i get this :(

Code:
[31/5/2015 21:12:45] [Error - NpcScript Interface]
[31/5/2015 21:12:45] data/npc/scripts/daily.lua:onCreatureSay
[31/5/2015 21:12:45] Description:
[31/5/2015 21:12:45] data/npc/scripts/daily.lua:229: attempt to index a nil value
[31/5/2015 21:12:45] stack traceback:
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:229: in function 'check'
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:305: in function 'callback'
[31/5/2015 21:12:45]     data/npc/lib/npcsystem/npchandler.lua:427: in function 'onCreatureSay'
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:214: in function <data/npc/scripts/daily.lua:214>
 
ok i removed those, now the error is gone, but the npc doesn't work properly, when the npc asks me if i killed the 100 dragon and i say yes, i get this :(

Code:
[31/5/2015 21:12:45] [Error - NpcScript Interface]
[31/5/2015 21:12:45] data/npc/scripts/daily.lua:onCreatureSay
[31/5/2015 21:12:45] Description:
[31/5/2015 21:12:45] data/npc/scripts/daily.lua:229: attempt to index a nil value
[31/5/2015 21:12:45] stack traceback:
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:229: in function 'check'
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:305: in function 'callback'
[31/5/2015 21:12:45]     data/npc/lib/npcsystem/npchandler.lua:427: in function 'onCreatureSay'
[31/5/2015 21:12:45]     data/npc/scripts/daily.lua:214: in function <data/npc/scripts/daily.lua:214>
Post the npc script.
 
Back
Top