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

attempt to index a nil value stack traceback:

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,755
Solutions
80
Reaction score
1,890
Location
Germany
What im doing wrong?
I think im dumb

Lua Script Error: [Action Interface]
data/actions/scripts/summonsystem.lua:eek:nUse
attempt to index a nil value
stack traceback:
[C]: at 0x7ff790325e20
[C]: in function 'createMonster'
data/actions/scripts/summonsystem.lua:32: in function <data/actions/scripts/summonsystem.lua:10>

Lua:
local config = {
    [46501] = { monster = "wendigo gazer", reborn = 50, summons = 2 },
    [46502] = { monster = "Wendigo Panda", reborn = 50, summons = 2 },
    [46503] = { monster = "wendigo pumpkin", reborn = 50, summons = 2 }
}

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 45000) -- Change the time here ( 1000 means = 1 sec )

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   
    local ta = config[item.actionid]
   
    if player:getStorageValue(85987) < ta.reborn then
        player:sendTextMessage(MESSAGE_STATUS_WARNING, "You must be atleast reborn "..ta.reborn.." to use this summon.")
        return true
    end
 
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
       return player:sendTextMessage(MESSAGE_STATUS_WARNING, "You must wait around 45 seconds to use the summon again.")
    end
       
    local monsterr = player:getSummons()
    local maxSummons = ta.summons
    if #monsterr >= maxSummons then
            for i=1, #monsterr do
                monsterr[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
                doRemoveCreature(monsterr[i]:getId())
                player:addCondition(exhaust)
            end
        else
        local monster = Game.createMonster(ta.monster, position)
        player:addSummon(monster)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
    return true
end
 
Solution
What im doing wrong?
I think im dumb

Lua Script Error: [Action Interface]
data/actions/scripts/summonsystem.lua:eek:nUse
attempt to index a nil value
stack traceback:
[C]: at 0x7ff790325e20
[C]: in function 'createMonster'
data/actions/scripts/summonsystem.lua:32: in function <data/actions/scripts/summonsystem.lua:10>

Lua:
local config = {
    [46501] = { monster = "wendigo gazer", reborn = 50, summons = 2 },
    [46502] = { monster = "Wendigo Panda", reborn = 50, summons = 2 },
    [46503] = { monster = "wendigo pumpkin", reborn = 50, summons = 2 }
}

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 45000) -- Change the time here ( 1000 means = 1 sec )

function onUse(player...
What im doing wrong?
I think im dumb

Lua Script Error: [Action Interface]
data/actions/scripts/summonsystem.lua:eek:nUse
attempt to index a nil value
stack traceback:
[C]: at 0x7ff790325e20
[C]: in function 'createMonster'
data/actions/scripts/summonsystem.lua:32: in function <data/actions/scripts/summonsystem.lua:10>

Lua:
local config = {
    [46501] = { monster = "wendigo gazer", reborn = 50, summons = 2 },
    [46502] = { monster = "Wendigo Panda", reborn = 50, summons = 2 },
    [46503] = { monster = "wendigo pumpkin", reborn = 50, summons = 2 }
}

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, 45000) -- Change the time here ( 1000 means = 1 sec )

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  
    local ta = config[item.actionid]
  
    if player:getStorageValue(85987) < ta.reborn then
        player:sendTextMessage(MESSAGE_STATUS_WARNING, "You must be atleast reborn "..ta.reborn.." to use this summon.")
        return true
    end

    if player:getCondition(CONDITION_EXHAUST_HEAL) then
       return player:sendTextMessage(MESSAGE_STATUS_WARNING, "You must wait around 45 seconds to use the summon again.")
    end
      
    local monsterr = player:getSummons()
    local maxSummons = ta.summons
    if #monsterr >= maxSummons then
            for i=1, #monsterr do
                monsterr[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
                doRemoveCreature(monsterr[i]:getId())
                player:addCondition(exhaust)
            end
        else
        local monster = Game.createMonster(ta.monster, position)
        player:addSummon(monster)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
    return true
end
position doesn't exist, hence the nil value.
 
Solution
Back
Top