What im doing wrong?
I think im dumb
Lua Script Error: [Action Interface]
data/actions/scripts/summonsystem.luanUse
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>
I think im dumb
Lua Script Error: [Action Interface]
data/actions/scripts/summonsystem.luanUse
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