Enjl

spawnzones

May 6th, 2019 (edited)
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. local sz = {}
  2.  
  3. function sz.onInitAPI()
  4.     registerEvent(sz, "onStart")
  5.     registerEvent(sz, "onTick")
  6. end
  7.  
  8. sz.block = 27
  9.  
  10. function sz.onTick()
  11.     for k,v in ipairs(Block.getIntersecting(player.x, player.y, player.x + player.width, player.y + player.height)) do
  12.         if v.id == sz.block then
  13.             for k,n in ipairs(NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)) do
  14.                 if not n.isHidden then
  15.                     if n:mem(0x124,FIELD_BOOL) then
  16.                         n:mem(0x12A, FIELD_WORD, 180)
  17.                     elseif n:mem(0x12A, FIELD_WORD) == -1 then
  18.                         if n.x + n.width < camera.x or n.x > camera.x + camera.width or n.y > camera.y + camera.height or n.y + n.height < camera.y then
  19.                             n:mem(0x124,FIELD_BOOL, true)
  20.                             n:mem(0x12A, FIELD_WORD, 180)
  21.                         end
  22.                     end
  23.                     n:mem(0x74, FIELD_BOOL, true)
  24.                 end
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. function sz.onStart()
  31.     for k,v in ipairs(Block.get(sz.block)) do
  32.         v.isHidden = true
  33.     end
  34. end
  35.  
  36. return sz
Add Comment
Please, Sign In to add comment