Advertisement
epitaque_

Untitled

Sep 22nd, 2015
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. -- The function that gives the error (line that gives error is commented)
  2. function GameMode:HandleCollision(collider, collided)
  3. print("Testing bullet..")
  4. local collider_1, collider_2
  5. if collided.isBullet == true then
  6. collider_1 = collided
  7. collider_2 = collider
  8. end
  9. if collider.isBullet == true then
  10. collider_1 = collider
  11. collider_2 = collided
  12. end
  13. if not collider_1 then
  14. print("there is no bullet, returning")
  15. return
  16. end
  17. if collider_1.owningEntity.isBot == true and collider_2:IsRealHero() == true then
  18. print("collider_1 owning entity is a bot and collider_2 is a hero")
  19. collider_1:SuperhotDelete(collider_1)
  20. collider_2:SuperhotDelete(collider_2) -- !!! This is the line that gives the error
  21. end
  22. if collider_1.owningEntity:IsRealHero() == true and collider_2.owningEntity.isBot == true then
  23. print("collider_1 owning entity is a hero and collider_2 is a bot")
  24. collider_1:SuperhotDelete(collider_1)
  25. collider_2:SuperhotDelete(collider_2)
  26. end
  27. return false
  28. end
  29.  
  30. -- Adding the function to the collider_2 in question
  31. hero.SuperHotDelete = function(hero)
  32. hero:ForceKill(false)
  33. hero:RespawnUnit()
  34. hero.item:RemoveSelf()
  35. GameMode:EndLevel(GameMode.CurrentLevel)
  36. GameMode:StartLevelForPlayer(GameMode.CurrentLevel, hero, true)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement