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

onStepIn error

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
Hello.. Im using printers svargrond arena from github and i have setup everything.
I got this error:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/svargrondArena/arena_pit.lua:onStepIn
data/movements/scripts/svargrondArena/arena_pit.lua:72: attempt to index a nil v
alue
stack traceback:
        [C]: in function '__index'
        data/movements/scripts/svargrondArena/arena_pit.lua:72: in function <dat
a/movements/scripts/svargrondArena/arena_pit.lua:16>

arena_pit.lua
Code:
dofile('data/lib/SvargrondArenaQuest.lua')

local kick_time = 600

local function Kick(cid)
    if (isPlayer(cid)) then
        if (getPlayerStorageValue(cid, STORAGE_PIT) > 0) then
            doTeleportThing(cid, POSITION_KICK)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your time is out!")
            setPlayerStorageValue(cid, STORAGE_PIT, 0)  
        end
    end
    return true
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

    local oldPit = getPlayerStorageValue(cid, STORAGE_PIT) - 1
    local newPit = getPlayerStorageValue(cid, STORAGE_PIT)

    local arena = getPlayerStorageValue(cid, STORAGE_ARENA)
    if (newPit < 1) then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Something is wrong, please contact a gamemaster.") and doTeleportThing(cid, lastPosition) end
    if (newPit > 10) then
        doTeleportThing(cid, POSITION_REWARD)
        doSendMagicEffect(getCreaturePosition(cid), (arena == 1 and CONST_ME_FIREWORK_BLUE or arena == 2 and CONST_ME_FIREWORK_YELLOW or CONST_ME_FIREWORK_RED))
        setPlayerStorageValue(cid, STORAGE_PIT, 0)
        setPlayerStorageValue(cid, (arena == 1 and ACTION_GREENHORNDOOR or arena == 2 and ACTION_SCRAPPERDOOR or ACTION_WARLORDDOOR), 1)
        setPlayerStorageValue(cid, STORAGE_ARENA, getPlayerStorageValue(cid, STORAGE_ARENA) + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You completed " .. ARENA[arena].name .. " arena, you should take your reward now.")
        doCreatureSay(cid, (arena == 1 and "Welcome back, little hero!" or arena == 2 and "Congratulations, brave warrior!" or "Respect and honour to you, champion!"), TALKTYPE_ORANGE_1)
        stopEvent(e10)
    return true
    end
    local thing = getCreaturesOnPit(oldPit)
    for _, uid in ipairs(thing) do
        if (getCreatureName(uid):lower() == ARENA[arena].creatures[pit]) then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Defeat the monster first.")
            doTeleportThing(cid, lastPosition)
            return true
        end
    end
    thing = getCreaturesOnPit(newPit)
    local busy = false
    for _, uid in ipairs(thing) do
        if isPlayer(uid) and uid ~= cid then
            busy = true
            break
        end
    end
    if (isPlayer(getTopCreature(PITS[newPit].pillar).uid)) then
        busy = true
    end
    if (busy) then
        for _, uid in ipairs(thing) do
            if (isPlayer(uid) and uid ~= cid) then
                if (getPlayerSex(cid) == 0) then
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ""..getCreatureName(uid).." is currently in the next arena pit. You will have to wait until he leaves.")
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ""..getCreatureName(uid).." is currently in the next arena pit. You will have to wait until she leaves.")
                end
                doTeleportThing(cid, lastPosition)
            end
        end
        return true
    end
    resetPit(newPit)
    doTeleportThing(cid, PITS[newPit].center)
    doForceSummonCreature(ARENA[arena].creatures[newPit], PITS[newPit].summon)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
    doCreatureSay(cid, "Fight!", TALKTYPE_ORANGE_1)
    setPlayerStorageValue(cid, 10030, 0) 
    if (getTopItem(PITS[oldPit].tp).itemid == ITEM_TELEPORT) then
        doRemoveItem(getTopItem(PITS[oldPit].tp).uid)
    end
    if (getTopItem(PITS[newPit].tp).itemid == ITEM_TELEPORT) then
        doRemoveItem(getTopItem(PITS[newPit].tp).uid)
    end
    if(getTopItem(PITS[newPit].pillar).itemid ~= ITEM_STONEPILLAR) then
        doCreateItem(ITEM_STONEPILLAR, 1, PITS[newPit].pillar)
    end
    if newPit == 2 then
        e2 = addEvent(Kick, kick_time*1000, cid)
    elseif newPit == 3 then
        e3 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e2)
    elseif newPit == 4 then
        e4 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e3)
    elseif newPit == 5 then
        e5 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e4)
    elseif newPit == 6 then
        e6 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e5)
    elseif newPit == 7 then
        e7 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e6)
    elseif newPit == 8 then
        e8 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e7)
    elseif newPit == 9 then
        e9 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e8)
    elseif newPit == 10 then
        e10 = addEvent(Kick, kick_time*1000, cid)
        stopEvent(e9)
    end
    startTimer(newPit)
    if isInArray(ITEM_FIREFIELD_TIMER, getTopItem(PITS[oldPit].fromPos).itemid) then
        doRemoveItem(getTopItem(PITS[oldPit].fromPos).uid)
    end
    if (item.actionid == 25300) then
        setPlayerStorageValue(cid, STORAGE_PIT, 0)
        doSetMonsterOutfit(cid, "Chicken", 120 * 1000)
        doTeleportThing(cid, POSITION_KICK)
        doCreatureSay(cid, "Coward!", TALKTYPE_ORANGE_1)
        stopEvent(e2)
        stopEvent(e3)
        stopEvent(e4)
        stopEvent(e5)
        stopEvent(e6)
        stopEvent(e7)
        stopEvent(e8)
        stopEvent(e9)
        stopEvent(e10)
    end
    return true
end

Please help me guys!
 
Try this arena_pit.lua
Code:
dofile('data/lib/SvargrondArenaQuest.lua')
local kick_time = 600
local function Kick(cid)
if (isPlayer(cid)) then
if (getPlayerStorageValue(cid, STORAGE_PIT) > 0) then
doTeleportThing(cid, POSITION_KICK)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your time is out!")
setPlayerStorageValue(cid, STORAGE_PIT, 0)
end
end
return true
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local oldPit = getPlayerStorageValue(cid, STORAGE_PIT) - 1
local newPit = getPlayerStorageValue(cid, STORAGE_PIT)

local arena = getPlayerStorageValue(cid, STORAGE_ARENA)
if (newPit < 1) then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Something is wrong, please contact a gamemaster.") and doTeleportThing(cid, lastPosition) end
if (newPit > 10) then
doTeleportThing(cid, POSITION_REWARD)
doSendMagicEffect(getCreaturePosition(cid), (arena == 1 and CONST_ME_FIREWORK_BLUE or arena == 2 and CONST_ME_FIREWORK_YELLOW or CONST_ME_FIREWORK_RED))
setPlayerStorageValue(cid, STORAGE_PIT, 0)
setPlayerStorageValue(cid, (arena == 1 and ACTION_GREENHORNDOOR or arena == 2 and ACTION_SCRAPPERDOOR or ACTION_WARLORDDOOR), 1)
setPlayerStorageValue(cid, STORAGE_ARENA, getPlayerStorageValue(cid, STORAGE_ARENA) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You completed " .. ARENA[arena].name .. " arena, you should take your reward now.")
doCreatureSay(cid, (arena == 1 and "Welcome back, little hero!" or arena == 2 and "Congratulations, brave warrior!" or "Respect and honour to you, champion!"), TALKTYPE_ORANGE_1)
stopEvent(e10)
return true
end
local thing = getCreaturesOnPit(oldPit)
for _, uid in ipairs(thing) do
if (getCreatureName(uid):lower() == ARENA[arena].creatures[pit]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Defeat the monster first.")
doTeleportThing(cid, lastPosition)
return true
end
end
thing = getCreaturesOnPit(newPit)
local busy = false
for _, uid in ipairs(thing) do
if isPlayer(uid) and uid ~= cid then
busy = true
break
end
end
if (isPlayer(getTopCreature(PITS[newPit].pillar).uid)) then
busy = true
end
if (busy) then
for _, uid in ipairs(thing) do
if (isPlayer(uid) and uid ~= cid) then
if (getPlayerSex(cid) == 0) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ""..getCreatureName(uid).." is currently in the next arena pit. You will have to wait until he leaves.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ""..getCreatureName(uid).." is currently in the next arena pit. You will have to wait until she leaves.")
end
doTeleportThing(cid, lastPosition)
end
end
return true
end
resetPit(newPit)
doTeleportThing(cid, PITS[newPit].center)
doForceSummonCreature(ARENA[arena].creatures[newPit], PITS[newPit].summon)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
doCreatureSay(cid, "Fight!", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 10030, 0)
if (getTopItem(PITS[oldPit].tp).itemid == ITEM_TELEPORT) then
doRemoveItem(getTopItem(PITS[oldPit].tp).uid)
end
if (getTopItem(PITS[newPit].tp).itemid == ITEM_TELEPORT) then
doRemoveItem(getTopItem(PITS[newPit].tp).uid)
end
if(getTopItem(PITS[newPit].pillar).itemid ~= ITEM_STONEPILLAR) then
doCreateItem(ITEM_STONEPILLAR, 1, PITS[newPit].pillar)
end
if newPit == 2 then
e2 = addEvent(Kick, kick_time*1000, cid)
elseif newPit == 3 then
e3 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e2)
elseif newPit == 4 then
e4 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e3)
elseif newPit == 5 then
e5 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e4)
elseif newPit == 6 then
e6 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e5)
elseif newPit == 7 then
e7 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e6)
elseif newPit == 8 then
e8 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e7)
elseif newPit == 9 then
e9 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e8)
elseif newPit == 10 then
e10 = addEvent(Kick, kick_time*1000, cid)
stopEvent(e9)
end
startTimer(newPit)
if isInArray(ITEM_FIREFIELD_TIMER, getTopItem(PITS[oldPit].fromPos).itemid) then
doRemoveItem(getTopItem(PITS[oldPit].fromPos).uid)
end
if (item.actionid == 25300) then
setPlayerStorageValue(cid, STORAGE_PIT, 0)
doSetMonsterOutfit(cid, "Chicken", 120 * 1000)
doTeleportThing(cid, POSITION_KICK)
doCreatureSay(cid, "Coward!", TALKTYPE_ORANGE_1)
stopEvent(e2)
stopEvent(e3)
stopEvent(e4)
stopEvent(e5)
stopEvent(e6)
stopEvent(e7)
stopEvent(e8)
stopEvent(e9)
stopEvent(e10)
end
return true
end
 
My arena don't have this bug o_O
well this is the error:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/svargrondArena/arena_pit.lua:onStepIn
data/movements/scripts/svargrondArena/arena_pit.lua:68: attempt to index a nil v
alue
stack traceback:
        [C]: in function '__index'
        data/movements/scripts/svargrondArena/arena_pit.lua:68: in function <dat
a/movements/scripts/svargrondArena/arena_pit.lua:13>

anyone knows what it means?
 
its mean : "data/movements/scripts/svargrondArena/arena_pit.lua:68: attempt to index a nil value"
~68:
doForceSummonCreature(ARENA[arena].creatures[newPit], PITS[newPit].summon)

that is wrong
 
Code:
doForceSummonCreature(name, pos)

Check if name and pos its correct declared.
 
Code:
doForceSummonCreature(name, pos)

Check if name and pos its correct declared.

Well it looks like this
Code:
    doForceSummonCreature(ARENA[arena].creatures[newPit], PITS[newPit].summon)
And i noticed, when i enter the FIRST monster, it say "Fight!" twice. And if i enter the first exit teleporter, i get teleported to the middle of the room again, and the monster "respawns".
But if i go thru the exit teleporter in the second or third room, it works normally.
 
Back
Top