Fortera Global
Intermediate OT User
- Joined
- Nov 20, 2015
- Messages
- 1,180
- Solutions
- 2
- Reaction score
- 117
why?
script:
Lua:
Lua Script Error: [Main Interface]
in a timer event called from:
data/creaturescripts/scripts/Feyrist/Feyrist7.lua:onDeath
attempt to index a nil value
stack traceback:
[C]: at 0x00571f00
[C]: in function 'createMonster'
data/creaturescripts/scripts/Feyrist/Feyrist7.lua:38: in function <data/creaturescripts/scripts/Feyrist/Feyrist7.lua:37>
script:
Lua:
local function criarFeyrist(PositionBorn)
local monstro = Game.createMonster("Faun", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
local function criarFeyrist2(PositionBorn)
local monstro = Game.createMonster("Pooka", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
local function criarFeyrist3(PositionBorn)
local monstro = Game.createMonster("Nymph", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
local function criarFeyrist4(PositionBorn)
local monstro = Game.createMonster("Dark Faun", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
local function criarFeyrist5(PositionBorn)
local monstro = Game.createMonster("Twisted Pooka", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
local function criarFeyrist6(PositionBorn)
local monstro = Game.createMonster("Boogy", PositionBorn, false, true)
if monstro then
monstro:setSpawnPoint(PositionBorn)
monstro:registerEvent("Feyrist7")
monstro:registerEvent("FeyristThink")
end
end
function onDeath(creature)
local targetMonster = creature:getMonster()
if not targetMonster then
return true
end
--local PositionBorn = targetMonster:getSpawnPoint()
-- se for dia
if isTwilight() or isDay() then
if targetMonster:getName():lower() == 'faun' or targetMonster:getName():lower() == 'dark faun' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist, 100 * 1000, PositionBorn) -- addEvent
elseif targetMonster:getName():lower() == 'pooka' or targetMonster:getName():lower() == 'twisted pooka' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist2, 100 * 1000, PositionBorn) -- addEvent
elseif targetMonster:getName():lower() == 'nymph' or targetMonster:getName():lower() == 'boogy' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist3, 100 * 1000, PositionBorn) -- addEvent
end
else
-- se for noite
if targetMonster:getName():lower() == 'faun' or targetMonster:getName():lower() == 'dark faun' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist4, 100 * 1000, PositionBorn) -- addEvent
elseif targetMonster:getName():lower() == 'pooka' or targetMonster:getName():lower() == 'twisted pooka' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist5, 100 * 1000, PositionBorn) -- addEvent
elseif targetMonster:getName():lower() == 'nymph' or targetMonster:getName():lower() == 'boogy' then
local PositionBorn = targetMonster:getSpawnPoint()
addEvent(criarFeyrist6, 100 * 1000, PositionBorn) -- addEvent
end
end
return true
end