Advertisement
Guest User

snifit.lua

a guest
Jul 7th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. local snifit = {};
  2. local snifitType = 1;
  3. local shotCount = -1;
  4. local projectile = 133 --Snifit bullet
  5. local npcconfig = API.load("npcconfig");
  6.  
  7. function snifit.updateSnifits()
  8.     bullets = NPC.get(133, -1);
  9.     for k,v in pairs(NPC.get(130 + (snifitType - 1),player.section)) do
  10.         if v.layerName.str == "Jump" then
  11.             if v:mem(0xF0, FIELD_DFLOAT) == 120 and v.collidesBlockBottom then
  12.                 v.speedY = -6;
  13.             end
  14.         end
  15.         if v.layerName.str == "Jump3" then
  16.             if v:mem(0xF0, FIELD_DFLOAT) >= 100 and v.collidesBlockBottom and shotCount == -1 then
  17.                 v.speedY = -9;
  18.             end
  19.             if v:mem(0xF0, FIELD_DFLOAT) >= 120 and shotCount == -1 then
  20.                 shotCount = 0;
  21.             end
  22.             if v:mem(0xF0, FIELD_DFLOAT) <= 139 and v:mem(0xF0, FIELD_DFLOAT) >= 15 and shotCount > -1 and shotCount < 3 then
  23.                 v:mem(0xF0, FIELD_DFLOAT, 149);
  24.                 shotCount = shotCount + 1;
  25.             end
  26.             if shotCount >= 3 and v.collidesBlockBottom then
  27.                 shotCount = -1;
  28.                 v:mem(0xF0, FIELD_DFLOAT, 19);
  29.             end
  30.         end
  31.         if bullets ~= nil and projectile ~= 133 then
  32.             if (table.getn(bullets) > 0) then
  33.                 local fire = bullets[table.getn(bullets)];
  34.                 fire.id = projectile;
  35.                 fire.width = npcconfig[projectile].width;
  36.                 fire.height = npcconfig[projectile].height;
  37.                 fire.y = fire.y - npcconfig[projectile].height/7.5;
  38.             end
  39.         end
  40.     end
  41. end
  42.  
  43. function snifit.configureSnifits(namedArgs)
  44.     if namedArgs.snifitType ~= nil then
  45.         snifitType = namedArgs.snifitType;
  46.     end
  47.     if namedArgs.projectile ~= nil then
  48.         projectile = namedArgs.projectile;
  49.     end
  50. end
  51.  
  52. function snifit.onInitAPI()
  53.     registerEvent(snifit, "onTick", "updateSnifits");
  54. end
  55.  
  56. return snifit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement