Advertisement
lavalevel

?:0: attempt to index a nil value

Feb 11th, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. function animateMonster()
  2.    
  3.     print "*******     ZAAAAAAPPP!!!!!!!!!!!!!     *******"
  4.         local function finishedAttackAnimation(self, event)
  5.             if event.phase == "end" then
  6.             group.gfx.elements.Npc8:removeEventListener('sprite', group.gfx.elements.Npc8)  -- This line causes error below.
  7.             group.gfx.elements.Npc8:play ((currentMap.monsterList[M].npcName .. " Stance 2")  )
  8.             currentMap.monsterList[M].npcTurnState = "moved"
  9.             -- print (M, currentMap.monsterList[M].npcTurnState)
  10.             npcActionTakingPlace = false
  11.             print("DMHM-dispatch from 'attack-animate'");Runtime:dispatchEvent{name='dungeonMasterHasMoved'}
  12.            
  13.             end
  14.         end
  15.         group.gfx.elements.Npc8.sprite = finishedAttackAnimation
  16.         group.gfx.elements.Npc8:addEventListener('sprite', group.gfx.elements.Npc8)
  17.         group.gfx.elements.Npc8:play ((currentMap.monsterList[M].npcName .. " Attack 2") )
  18.                
  19. end
  20.  
  21. --[[
  22. ** This error only occurs when the animation has been triggered at least once, the game is reset, and the player encounters it again.  If the level is completely reloaded from IN-Game or if I attack and force him to do a hit animation, it goes away.
  23.  
  24. Runtime error
  25.     ?:0: attempt to index a nil value
  26. stack traceback:
  27.     [C]: ?
  28.     ?: in function '?'
  29.     ?: in function <?:215>
  30. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement