• 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 Problem with NPC

Maxington

New Member
Joined
Apr 15, 2014
Messages
3
Reaction score
0
Hello! I just tested http://otland.net/threads/creatureevent-npc-killing-in-the-name-of.122701/
But I am getting an error now with Grizzly Adams, the task window doesn't pop up and im getting this error in the console.

PHP:
[Error - Npc interface]
data/npc/script/KillingInTheNameOf.lua:onCreatureSay
Description:
data/npc/scripts/KillingInTheNameOf.lua:124: attempt to concatenate field 'raceName' (a nil value)
stack traceback:
data/npc/scripts/KillingInTheNameOf.lua:124: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:345: in function 'onCreatureSay'
data/npc/scripts/KillingInTheNameOf.lua:92: in function <data/npc/scripts/KillingInTheNameOf.lua:92>

Here is a link of my npc/script. It was to much text to post it here so. http://pastebin.com/93nWSbxk

And here is a link of my npchandler.
http://pastebin.com/UXkMFDtY

Hope you guys can help me with this! :)
 
Under line 123
Code:
for i = 1, table.maxn(tasks) do

Add
Code:
[i]
After tasks, so it will be.

Code:
tasks[i].raceName
tasks[i].questStarted
 
Got a second problem now tho :( I tried http://otland.net/threads/killing-in-the-name-of-boss-room.187527/
I got the storage id etc correctly but I dunno what's wrong, when I try to enter the portal it just says
Code:
'You are not allowed to enter here!'

No error in console or nothing.

Here is my demodras.lua
PHP:
local spawnboss = {x=32747,y=32296,z=10}
local spawnplayer = {x=32748,y=32288,z=10}
local NWcorner = {x=32743,y=32288,z=10, stackpos = 255} -- north west corner of arena
local SEcorner = {x=32751,y=32296,z=10, stackpos = 255} -- south east corner of arena
local deny = {x=32771, y=32290, z=10}

local storage = {35030,2} -- storage required to enter
local keyafter = -1 -- key that will be set to storage above when player enters arena
local boss = "demodras" -- monster name
local fighttime = 10 * 60 * 1000 -- ten minutes
local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
-- function taken from demon oak quest made by Darkhaos
local types =
{
[TYPE_PLAYER] = isPlayer,
[TYPE_MONSTER] = isMonster,
[TYPE_NPC] = isNpc,
[TYPE_ALL] = isCreature
}

local tmp = {}
local t = types[type]
if not t then
return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
end

local thing
local pos
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
for z = fromPos.z, toPos.z do
pos = {x = x, y = y, z = z}
thing = getTopCreature(pos)
if t(thing.uid) then
table.insert(tmp, thing.uid)
if not countSummon and isSummon(thing.uid) then
for i = 1, #tmp do
if tmp == thing.uid then
table.remove(tmp, i)
break
end
end
end
end
end
end
end
return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
end

function kickEvent(cid, item, position, fromPosition)
if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
doTeleportThing(cid, deny)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1)
end
end

function onStepIn(cid, item, pos)
if getPlayerStorageValue (cid, storage[1]) == storage[2] then
if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
doTeleportThing(cid,deny)
doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
else
doTeleportThing(cid,spawnplayer)
doSendMagicEffect(getCreaturePosition(cid),10)
doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
setPlayerStorageValue(cid,storage[1],keyafter)
doSummonCreature(boss, spawnboss)
demodras = addEvent(kickEvent, fighttime, cid)
end
else
doTeleportThing(cid,deny)
doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
end
doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
return true
end
 
Well dno really.. this is my lib. http://pastebin.com/fUh00y9W

Tried with 12600 with value 1 aswell from this text and the same thing happened. I don't even know which value to use, haha.. And when I tried 35030 with value 1 nothing at all happened.

PHP:
[47] = {killsRequired = 1000, raceName = "Pirates", level = {1, 9999}, storage = {12600, 1}, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = { --Requires an storage (Gained on The Shattered Isles Quest)
{type = "exp", value = {10000}},
{type = "money", value = {5000}},
{type = "storage", value = {35030, 1}}
}},
 
Back
Top Bottom