Advertisement
Guest User

HealthPoint

a guest
Dec 23rd, 2015
3
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.27 KB | None | 0 0
  1. local HealthPoint = {}
  2. local pNPC = loadSharedAPI("pnpc")
  3. local graphX = loadSharedAPI("graphX")
  4. local colliders = loadSharedAPI("colliders")
  5.  
  6. function HealthPoint.onInitAPI() --Is called when the api is loaded by loadAPI.
  7.         registerEvent(HealthPoint, "onLoop", "assign", true) --Register the loop event
  8.         registerEvent(HealthPoint, "onNPCKill", "onNPCKill", true) --Register the damage event      
  9. end
  10.  
  11.  
  12.  -- Health --
  13.  -- Change these values corresponding to the id inside the [] to change the enemy's health --
  14.   HealthPoint.npcHealth = {}
  15.   HealthPoint.npcHealth[1] = 5
  16.   HealthPoint.npcHealth[2] = 3
  17.   HealthPoint.npcHealth[3] = 3
  18.   HealthPoint.npcHealth[8] = 3
  19.   HealthPoint.npcHealth[17] = 3
  20.   HealthPoint.npcHealth[18] = 3
  21.   HealthPoint.npcHealth[27] = 3
  22.   HealthPoint.npcHealth[28] = 3
  23.   HealthPoint.npcHealth[29] = 3
  24.   HealthPoint.npcHealth[47] = 3
  25.   HealthPoint.npcHealth[50] = 3
  26.   HealthPoint.npcHealth[51] = 3
  27.   HealthPoint.npcHealth[52] = 3
  28.   HealthPoint.npcHealth[55] = 3
  29.   HealthPoint.npcHealth[71] = 3
  30.   HealthPoint.npcHealth[77] = 3
  31.   HealthPoint.npcHealth[89] = 3
  32.   HealthPoint.npcHealth[93] = 3
  33.   HealthPoint.npcHealth[117] = 3
  34.   HealthPoint.npcHealth[118] = 3
  35.   HealthPoint.npcHealth[119] = 3
  36.   HealthPoint.npcHealth[120] = 3
  37.   HealthPoint.npcHealth[125] = 3
  38.   HealthPoint.npcHealth[126] = 3
  39.   HealthPoint.npcHealth[127] = 3
  40.   HealthPoint.npcHealth[128] = 3
  41.   HealthPoint.npcHealth[162] = 3
  42.   HealthPoint.npcHealth[163] = 3
  43.   HealthPoint.npcHealth[203] = 3
  44.   HealthPoint.npcHealth[204] = 3
  45.   HealthPoint.npcHealth[205] = 3
  46.   HealthPoint.npcHealth[232] = 3
  47.   HealthPoint.npcHealth[233] = 3
  48.   HealthPoint.npcHealth[234] = 3
  49.   HealthPoint.npcHealth[235] = 3
  50.   HealthPoint.npcHealth[236] = 3
  51.   HealthPoint.npcHealth[242] = 3
  52.   HealthPoint.npcHealth[243] = 3
  53.   HealthPoint.npcHealth[245] = 3
  54.   HealthPoint.npcHealth[270] = 3
  55.   HealthPoint.npcHealth[271] = 3
  56.   HealthPoint.npcHealth[275] = 3
  57.  
  58.  -- Jump Damage --
  59.   HealthPoint.jumpDamage = {}
  60.   HealthPoint.jumpDamage[1] = 1
  61.   HealthPoint.jumpDamage[2] = 1
  62.   HealthPoint.jumpDamage[3] = 1
  63.   HealthPoint.jumpDamage[8] = 1
  64.   HealthPoint.jumpDamage[17] = 1
  65.   HealthPoint.jumpDamage[18] = 1
  66.   HealthPoint.jumpDamage[27] = 1
  67.   HealthPoint.jumpDamage[28] = 1
  68.   HealthPoint.jumpDamage[29] = 1
  69.   HealthPoint.jumpDamage[47] = 1
  70.   HealthPoint.jumpDamage[50] = 1
  71.   HealthPoint.jumpDamage[51] = 1
  72.   HealthPoint.jumpDamage[52] = 1
  73.   HealthPoint.jumpDamage[55] = 1
  74.   HealthPoint.jumpDamage[71] = 1
  75.   HealthPoint.jumpDamage[77] = 1
  76.   HealthPoint.jumpDamage[89] = 1
  77.   HealthPoint.jumpDamage[93] = 1
  78.   HealthPoint.jumpDamage[117] = 1
  79.   HealthPoint.jumpDamage[118] = 1
  80.   HealthPoint.jumpDamage[119] = 1
  81.   HealthPoint.jumpDamage[120] = 1
  82.   HealthPoint.jumpDamage[125] = 1
  83.   HealthPoint.jumpDamage[126] = 1
  84.   HealthPoint.jumpDamage[127] = 1
  85.   HealthPoint.jumpDamage[128] = 1
  86.   HealthPoint.jumpDamage[162] = 1
  87.   HealthPoint.jumpDamage[163] = 1
  88.   HealthPoint.jumpDamage[203] = 1
  89.   HealthPoint.jumpDamage[204] = 1
  90.   HealthPoint.jumpDamage[205] = 1
  91.   HealthPoint.jumpDamage[232] = 1
  92.   HealthPoint.jumpDamage[233] = 1
  93.   HealthPoint.jumpDamage[234] = 1
  94.   HealthPoint.jumpDamage[235] = 1
  95.   HealthPoint.jumpDamage[236] = 1
  96.   HealthPoint.jumpDamage[242] = 1
  97.   HealthPoint.jumpDamage[243] = 1
  98.   HealthPoint.jumpDamage[245] = 1
  99.   HealthPoint.jumpDamage[270] = 1
  100.   HealthPoint.jumpDamage[271] = 1
  101.   HealthPoint.jumpDamage[275] = 1
  102.  
  103.  -- Spinjump Damage --
  104.   HealthPoint.spinjumpDamage = {}
  105.   HealthPoint.spinjumpDamage[1] = 1
  106.   HealthPoint.spinjumpDamage[2] = 1
  107.   HealthPoint.spinjumpDamage[3] = 1
  108.   HealthPoint.spinjumpDamage[8] = 1
  109.   HealthPoint.spinjumpDamage[17] = 1
  110.   HealthPoint.spinjumpDamage[18] = 1
  111.   HealthPoint.spinjumpDamage[27] = 1
  112.   HealthPoint.spinjumpDamage[28] = 1
  113.   HealthPoint.spinjumpDamage[29] = 1
  114.   HealthPoint.spinjumpDamage[47] = 1
  115.   HealthPoint.spinjumpDamage[50] = 1
  116.   HealthPoint.spinjumpDamage[51] = 1
  117.   HealthPoint.spinjumpDamage[52] = 1
  118.   HealthPoint.spinjumpDamage[55] = 1
  119.   HealthPoint.spinjumpDamage[71] = 1
  120.   HealthPoint.spinjumpDamage[77] = 1
  121.   HealthPoint.spinjumpDamage[89] = 1
  122.   HealthPoint.spinjumpDamage[93] = 1
  123.   HealthPoint.spinjumpDamage[117] = 1
  124.   HealthPoint.spinjumpDamage[118] = 1
  125.   HealthPoint.spinjumpDamage[119] = 1
  126.   HealthPoint.spinjumpDamage[120] = 1
  127.   HealthPoint.spinjumpDamage[125] = 1
  128.   HealthPoint.spinjumpDamage[126] = 1
  129.   HealthPoint.spinjumpDamage[127] = 1
  130.   HealthPoint.spinjumpDamage[128] = 1
  131.   HealthPoint.spinjumpDamage[162] = 1
  132.   HealthPoint.spinjumpDamage[163] = 1
  133.   HealthPoint.spinjumpDamage[203] = 1
  134.   HealthPoint.spinjumpDamage[204] = 1
  135.   HealthPoint.spinjumpDamage[205] = 1
  136.   HealthPoint.spinjumpDamage[232] = 1
  137.   HealthPoint.spinjumpDamage[233] = 1
  138.   HealthPoint.spinjumpDamage[234] = 1
  139.   HealthPoint.spinjumpDamage[235] = 1
  140.   HealthPoint.spinjumpDamage[236] = 1
  141.   HealthPoint.spinjumpDamage[242] = 1
  142.   HealthPoint.spinjumpDamage[243] = 1
  143.   HealthPoint.spinjumpDamage[245] = 1
  144.   HealthPoint.spinjumpDamage[270] = 1
  145.   HealthPoint.spinjumpDamage[271] = 1
  146.   HealthPoint.spinjumpDamage[275] = 1
  147.  
  148.   -- Fireball Damage --
  149.   HealthPoint.fireballDamage = {}
  150.   HealthPoint.fireballDamage[1] = -1
  151.   HealthPoint.fireballDamage[2] = 1
  152.   HealthPoint.fireballDamage[3] = 1
  153.   HealthPoint.fireballDamage[8] = 1
  154.   HealthPoint.fireballDamage[17] = 1
  155.   HealthPoint.fireballDamage[18] = 1
  156.   HealthPoint.fireballDamage[27] = 1
  157.   HealthPoint.fireballDamage[28] = 1
  158.   HealthPoint.fireballDamage[29] = 1
  159.   HealthPoint.fireballDamage[47] = 1
  160.   HealthPoint.fireballDamage[50] = 1
  161.   HealthPoint.fireballDamage[51] = 1
  162.   HealthPoint.fireballDamage[52] = 1
  163.   HealthPoint.fireballDamage[55] = 1
  164.   HealthPoint.fireballDamage[71] = 1
  165.   HealthPoint.fireballDamage[77] = 1
  166.   HealthPoint.fireballDamage[89] = 1
  167.   HealthPoint.fireballDamage[93] = 1
  168.   HealthPoint.fireballDamage[117] = 1
  169.   HealthPoint.fireballDamage[118] = 1
  170.   HealthPoint.fireballDamage[119] = 1
  171.   HealthPoint.fireballDamage[120] = 1
  172.   HealthPoint.fireballDamage[125] = 1
  173.   HealthPoint.fireballDamage[126] = 1
  174.   HealthPoint.fireballDamage[127] = 1
  175.   HealthPoint.fireballDamage[128] = 1
  176.   HealthPoint.fireballDamage[162] = 1
  177.   HealthPoint.fireballDamage[163] = 1
  178.   HealthPoint.fireballDamage[203] = 1
  179.   HealthPoint.fireballDamage[204] = 1
  180.   HealthPoint.fireballDamage[205] = 1
  181.   HealthPoint.fireballDamage[232] = 1
  182.   HealthPoint.fireballDamage[233] = 1
  183.   HealthPoint.fireballDamage[234] = 1
  184.   HealthPoint.fireballDamage[235] = 1
  185.   HealthPoint.fireballDamage[236] = 1
  186.   HealthPoint.fireballDamage[242] = 1
  187.   HealthPoint.fireballDamage[243] = 1
  188.   HealthPoint.fireballDamage[245] = 1
  189.   HealthPoint.fireballDamage[270] = 1
  190.   HealthPoint.fireballDamage[271] = 1
  191.   HealthPoint.fireballDamage[275] = 1
  192.  
  193.  -- Hammer Damage --
  194.   HealthPoint.hammerDamage = {}
  195.   HealthPoint.hammerDamage[1] = 2
  196.   HealthPoint.hammerDamage[2] = 1
  197.   HealthPoint.hammerDamage[3] = 1
  198.   HealthPoint.hammerDamage[8] = 1
  199.   HealthPoint.hammerDamage[17] = 1
  200.   HealthPoint.hammerDamage[18] = 1
  201.   HealthPoint.hammerDamage[27] = 1
  202.   HealthPoint.hammerDamage[28] = 1
  203.   HealthPoint.hammerDamage[29] = 1
  204.   HealthPoint.hammerDamage[47] = 1
  205.   HealthPoint.hammerDamage[50] = 1
  206.   HealthPoint.hammerDamage[51] = 1
  207.   HealthPoint.hammerDamage[52] = 1
  208.   HealthPoint.hammerDamage[55] = 1
  209.   HealthPoint.hammerDamage[71] = 1
  210.   HealthPoint.hammerDamage[77] = 1
  211.   HealthPoint.hammerDamage[89] = 1
  212.   HealthPoint.hammerDamage[93] = 1
  213.   HealthPoint.hammerDamage[117] = 1
  214.   HealthPoint.hammerDamage[118] = 1
  215.   HealthPoint.hammerDamage[119] = 1
  216.   HealthPoint.hammerDamage[120] = 1
  217.   HealthPoint.hammerDamage[125] = 1
  218.   HealthPoint.hammerDamage[126] = 1
  219.   HealthPoint.hammerDamage[127] = 1
  220.   HealthPoint.hammerDamage[128] = 1
  221.   HealthPoint.hammerDamage[162] = 1
  222.   HealthPoint.hammerDamage[163] = 1
  223.   HealthPoint.hammerDamage[203] = 1
  224.   HealthPoint.hammerDamage[204] = 1
  225.   HealthPoint.hammerDamage[205] = 1
  226.   HealthPoint.hammerDamage[232] = 1
  227.   HealthPoint.hammerDamage[233] = 1
  228.   HealthPoint.hammerDamage[234] = 1
  229.   HealthPoint.hammerDamage[235] = 1
  230.   HealthPoint.hammerDamage[236] = 1
  231.   HealthPoint.hammerDamage[242] = 1
  232.   HealthPoint.hammerDamage[243] = 1
  233.   HealthPoint.hammerDamage[245] = 1
  234.   HealthPoint.hammerDamage[270] = 1
  235.   HealthPoint.hammerDamage[271] = 1
  236.   HealthPoint.hammerDamage[275] = 1
  237.  
  238.  -- Projectile Damage --
  239.   HealthPoint.projectileDamage = {}
  240.   HealthPoint.projectileDamage[1] = 1
  241.   HealthPoint.projectileDamage[2] = 1
  242.   HealthPoint.projectileDamage[3] = 1
  243.   HealthPoint.projectileDamage[8] = 1
  244.   HealthPoint.projectileDamage[17] = 1
  245.   HealthPoint.projectileDamage[18] = 1
  246.   HealthPoint.projectileDamage[27] = 1
  247.   HealthPoint.projectileDamage[28] = 1
  248.   HealthPoint.projectileDamage[29] = 1
  249.   HealthPoint.projectileDamage[47] = 1
  250.   HealthPoint.projectileDamage[50] = 1
  251.   HealthPoint.projectileDamage[51] = 1
  252.   HealthPoint.projectileDamage[52] = 1
  253.   HealthPoint.projectileDamage[55] = 1
  254.   HealthPoint.projectileDamage[71] = 1
  255.   HealthPoint.projectileDamage[77] = 1
  256.   HealthPoint.projectileDamage[89] = 1
  257.   HealthPoint.projectileDamage[93] = 1
  258.   HealthPoint.projectileDamage[117] = 1
  259.   HealthPoint.projectileDamage[118] = 1
  260.   HealthPoint.projectileDamage[119] = 1
  261.   HealthPoint.projectileDamage[120] = 1
  262.   HealthPoint.projectileDamage[125] = 1
  263.   HealthPoint.projectileDamage[126] = 1
  264.   HealthPoint.projectileDamage[127] = 1
  265.   HealthPoint.projectileDamage[128] = 1
  266.   HealthPoint.projectileDamage[162] = 1
  267.   HealthPoint.projectileDamage[163] = 1
  268.   HealthPoint.projectileDamage[203] = 1
  269.   HealthPoint.projectileDamage[204] = 1
  270.   HealthPoint.projectileDamage[205] = 1
  271.   HealthPoint.projectileDamage[232] = 1
  272.   HealthPoint.projectileDamage[233] = 1
  273.   HealthPoint.projectileDamage[234] = 1
  274.   HealthPoint.projectileDamage[235] = 1
  275.   HealthPoint.projectileDamage[236] = 1
  276.   HealthPoint.projectileDamage[242] = 1
  277.   HealthPoint.projectileDamage[243] = 1
  278.   HealthPoint.projectileDamage[245] = 1
  279.   HealthPoint.projectileDamage[270] = 1
  280.   HealthPoint.projectileDamage[271] = 1
  281.   HealthPoint.projectileDamage[275] = 1
  282.  
  283.  -- Tail Damage --
  284.   HealthPoint.tailDamage = {}
  285.   HealthPoint.tailDamage[1] = 1
  286.   HealthPoint.tailDamage[2] = 1
  287.   HealthPoint.tailDamage[3] = 1
  288.   HealthPoint.tailDamage[8] = 1
  289.   HealthPoint.tailDamage[17] = 1
  290.   HealthPoint.tailDamage[18] = 1
  291.   HealthPoint.tailDamage[27] = 1
  292.   HealthPoint.tailDamage[28] = 1
  293.   HealthPoint.tailDamage[29] = 1
  294.   HealthPoint.tailDamage[47] = 1
  295.   HealthPoint.tailDamage[50] = 1
  296.   HealthPoint.tailDamage[51] = 1
  297.   HealthPoint.tailDamage[52] = 1
  298.   HealthPoint.tailDamage[55] = 1
  299.   HealthPoint.tailDamage[71] = 1
  300.   HealthPoint.tailDamage[77] = 1
  301.   HealthPoint.tailDamage[89] = 1
  302.   HealthPoint.tailDamage[93] = 1
  303.   HealthPoint.tailDamage[117] = 1
  304.   HealthPoint.tailDamage[118] = 1
  305.   HealthPoint.tailDamage[119] = 1
  306.   HealthPoint.tailDamage[120] = 1
  307.   HealthPoint.tailDamage[125] = 1
  308.   HealthPoint.tailDamage[126] = 1
  309.   HealthPoint.tailDamage[127] = 1
  310.   HealthPoint.tailDamage[128] = 1
  311.   HealthPoint.tailDamage[162] = 1
  312.   HealthPoint.tailDamage[163] = 1
  313.   HealthPoint.tailDamage[203] = 1
  314.   HealthPoint.tailDamage[204] = 1
  315.   HealthPoint.tailDamage[205] = 1
  316.   HealthPoint.tailDamage[232] = 1
  317.   HealthPoint.tailDamage[233] = 1
  318.   HealthPoint.tailDamage[234] = 1
  319.   HealthPoint.tailDamage[235] = 1
  320.   HealthPoint.tailDamage[236] = 1
  321.   HealthPoint.tailDamage[242] = 1
  322.   HealthPoint.tailDamage[243] = 1
  323.   HealthPoint.tailDamage[245] = 1
  324.   HealthPoint.tailDamage[270] = 1
  325.   HealthPoint.tailDamage[271] = 1
  326.   HealthPoint.tailDamage[275] = 1
  327.  
  328.  -- Link Attack Damage --
  329.   HealthPoint.linkDamage = {}
  330.   HealthPoint.linkDamage[1] = 1
  331.   HealthPoint.linkDamage[2] = 1
  332.   HealthPoint.linkDamage[3] = 1
  333.   HealthPoint.linkDamage[8] = 1
  334.   HealthPoint.linkDamage[17] = 1
  335.   HealthPoint.linkDamage[18] = 1
  336.   HealthPoint.linkDamage[27] = 1
  337.   HealthPoint.linkDamage[28] = 1
  338.   HealthPoint.linkDamage[29] = 1
  339.   HealthPoint.linkDamage[47] = 1
  340.   HealthPoint.linkDamage[50] = 1
  341.   HealthPoint.linkDamage[51] = 1
  342.   HealthPoint.linkDamage[52] = 1
  343.   HealthPoint.linkDamage[55] = 1
  344.   HealthPoint.linkDamage[71] = 1
  345.   HealthPoint.linkDamage[77] = 1
  346.   HealthPoint.linkDamage[89] = 1
  347.   HealthPoint.linkDamage[93] = 1
  348.   HealthPoint.linkDamage[117] = 1
  349.   HealthPoint.linkDamage[118] = 1
  350.   HealthPoint.linkDamage[119] = 1
  351.   HealthPoint.linkDamage[120] = 1
  352.   HealthPoint.linkDamage[125] = 1
  353.   HealthPoint.linkDamage[126] = 1
  354.   HealthPoint.linkDamage[127] = 1
  355.   HealthPoint.linkDamage[128] = 1
  356.   HealthPoint.linkDamage[162] = 1
  357.   HealthPoint.linkDamage[163] = 1
  358.   HealthPoint.linkDamage[203] = 1
  359.   HealthPoint.linkDamage[204] = 1
  360.   HealthPoint.linkDamage[205] = 1
  361.   HealthPoint.linkDamage[232] = 1
  362.   HealthPoint.linkDamage[233] = 1
  363.   HealthPoint.linkDamage[234] = 1
  364.   HealthPoint.linkDamage[235] = 1
  365.   HealthPoint.linkDamage[236] = 1
  366.   HealthPoint.linkDamage[242] = 1
  367.   HealthPoint.linkDamage[243] = 1
  368.   HealthPoint.linkDamage[245] = 1
  369.   HealthPoint.linkDamage[270] = 1
  370.   HealthPoint.linkDamage[271] = 1
  371.   HealthPoint.linkDamage[275] = 1
  372.  
  373.   -- Thrown Damage --
  374.   HealthPoint.thrownDamage = {}
  375.   HealthPoint.thrownDamage[1] = 1
  376.   HealthPoint.thrownDamage[2] = 1
  377.   HealthPoint.thrownDamage[3] = 1
  378.   HealthPoint.thrownDamage[8] = 1
  379.   HealthPoint.thrownDamage[17] = 1
  380.   HealthPoint.thrownDamage[18] = 1
  381.   HealthPoint.thrownDamage[27] = 1
  382.   HealthPoint.thrownDamage[28] = 1
  383.   HealthPoint.thrownDamage[29] = 1
  384.   HealthPoint.thrownDamage[47] = 1
  385.   HealthPoint.thrownDamage[50] = 1
  386.   HealthPoint.thrownDamage[51] = 1
  387.   HealthPoint.thrownDamage[52] = 1
  388.   HealthPoint.thrownDamage[55] = 1
  389.   HealthPoint.thrownDamage[71] = 1
  390.   HealthPoint.thrownDamage[77] = 1
  391.   HealthPoint.thrownDamage[89] = 1
  392.   HealthPoint.thrownDamage[93] = 1
  393.   HealthPoint.thrownDamage[117] = 1
  394.   HealthPoint.thrownDamage[118] = 1
  395.   HealthPoint.thrownDamage[119] = 1
  396.   HealthPoint.thrownDamage[120] = 1
  397.   HealthPoint.thrownDamage[125] = 1
  398.   HealthPoint.thrownDamage[126] = 1
  399.   HealthPoint.thrownDamage[127] = 1
  400.   HealthPoint.thrownDamage[128] = 1
  401.   HealthPoint.thrownDamage[162] = 1
  402.   HealthPoint.thrownDamage[163] = 1
  403.   HealthPoint.thrownDamage[203] = 1
  404.   HealthPoint.thrownDamage[204] = 1
  405.   HealthPoint.thrownDamage[205] = 1
  406.   HealthPoint.thrownDamage[232] = 1
  407.   HealthPoint.thrownDamage[233] = 1
  408.   HealthPoint.thrownDamage[234] = 1
  409.   HealthPoint.thrownDamage[235] = 1
  410.   HealthPoint.thrownDamage[236] = 1
  411.   HealthPoint.thrownDamage[242] = 1
  412.   HealthPoint.thrownDamage[243] = 1
  413.   HealthPoint.thrownDamage[245] = 1
  414.   HealthPoint.thrownDamage[270] = 1
  415.   HealthPoint.thrownDamage[271] = 1
  416.   HealthPoint.thrownDamage[275] = 1
  417.  
  418.  
  419.  ----------------------------------------------------------------------------------------------
  420.  ---                            THE ACTUAL CODE STUFF                                       ---
  421.  ----------------------------------------------------------------------------------------------
  422.  
  423.  
  424.  
  425.  
  426.  ----------------------------------------------------------------------------------------------
  427.  ---                                 DAMAGE INPUT                                           ---
  428.  ----------------------------------------------------------------------------------------------
  429.  
  430.  function HealthPoint.onNPCKill(eventObj, killedNPC, killReason)
  431.  
  432.     if HealthPoint.npcHealth[killedNPC.id] ~= nil  then
  433.         local wrappedNPC = pNPC.wrap(killedNPC)
  434.            
  435.             if wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.jumpDamage[wrappedNPC.id] and killReason == 1 then
  436.                 eventObj.cancelled = true
  437.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  438.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.jumpDamage[wrappedNPC.id]
  439.                 playSFX(2)
  440.          
  441.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.fireballDamage[wrappedNPC.id] and killReason == 3 and fire then
  442.                 eventObj.cancelled = true
  443.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  444.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.fireballDamage[wrappedNPC.id]
  445.                 playSFX(3)
  446.                
  447.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.hammerDamage[wrappedNPC.id] and killReason == 3 and hammer then
  448.                 eventObj.cancelled = true
  449.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  450.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.hammerDamage[wrappedNPC.id]
  451.                 playSFX(3)
  452.                
  453.                 elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.projectileDamage[wrappedNPC.id] and killReason == 3 then
  454.                 eventObj.cancelled = true
  455.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  456.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.projectileDamage[wrappedNPC.id]
  457.                 playSFX(3)
  458.                
  459.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.thrownDamage[wrappedNPC.id] and   (killReason == 4 or killReason == 5) then
  460.                 eventObj.cancelled = true
  461.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  462.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.thrownDamage[wrappedNPC.id]
  463.          
  464.          
  465.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.tailDamage[wrappedNPC.id] and killReason == 7 then
  466.                 eventObj.cancelled = true
  467.                 wrappedNPC:mem(0x156, FIELD_WORD, 20)
  468.                 wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.tailDamage[wrappedNPC.id]
  469.                 playSFX(3)
  470.          
  471.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.spinjumpDamage[wrappedNPC.id] and killReason == 8 then
  472.                  eventObj.cancelled = true
  473.                  wrappedNPC:mem(0x156, FIELD_WORD, 20)
  474.                  wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.spinjumpDamage[wrappedNPC.id]
  475.                  playSFX(36)
  476.  
  477.             elseif wrappedNPC.data.hit > 1 and wrappedNPC.data.hit > HealthPoint.linkDamage[wrappedNPC.id] and killReason == 10 then
  478.                  eventObj.cancelled = true
  479.                  wrappedNPC:mem(0x156, FIELD_WORD, 20)
  480.                  wrappedNPC.data.hit = wrappedNPC.data.hit - HealthPoint.linkDamage[wrappedNPC.id]
  481.                  playSFX(89)   
  482.          
  483.             end
  484.     end
  485.  end
  486.  
  487.  
  488.  
  489.  ----------------------------------------------------------------------------------------------
  490.  ---                              HEALTH ASSIGNMENT                                         ---
  491.  ----------------------------------------------------------------------------------------------
  492.  
  493.  function HealthPoint.assign()
  494.     for k,v in pairs(NPC.get()) do
  495.    
  496.     local n = pNPC.wrap(v);
  497.    
  498.         if n.data.hit == nil then
  499.             if HealthPoint.npcHealth[n.id] ~= nil  then
  500.                 n.data.hit = HealthPoint.npcHealth[n.id]
  501.  
  502.             end
  503.         end
  504.        
  505.         if n.data.hp == nil then
  506.             if HealthPoint.npcHealth[n.id] ~= nil then
  507.                 n.data.hp = HealthPoint.npcHealth[n.id]
  508.  
  509.             end
  510.         end
  511.        
  512.         if n.data.hpmax == nil then
  513.             if HealthPoint.npcHealth[n.id] ~= nil then
  514.                 n.data.hpmax = HealthPoint.npcHealth[n.id]
  515.             end
  516.         end
  517.        
  518.         if n ~= nil and HealthPoint.healthbar then
  519.             if n:mem(0x12A, FIELD_WORD) ~= 0 and n.data.hp ~= nil then
  520.                 graphX.boxLevel (n.x-8,n.y-6, 32, 8,  0xFFFFFFF55)
  521.                 graphX.boxLevel (n.x-7,n.y-5, 30, 6,  0x00000055)
  522.                 graphX.boxLevel (n.x-7,n.y-5, n.data.hp/n.data.hpmax*30, 6,  0xFFF05BFF)
  523.                 graphX.boxLevel (n.x-7,n.y-5, n.data.hit/n.data.hpmax*30, 6,  0xF61818FF)
  524.  
  525.             end
  526.         end
  527.  
  528. if colliders.collideNPC(n.id, 13) then
  529. fire = true
  530. hammer = false
  531. end
  532. if colliders.collideNPC(n.id, 171) then
  533. hammer = true
  534. fire = false
  535. end
  536.  
  537.  
  538.         if n.data.hp ~= nil then
  539.             if n.data.hp > n.data.hit then
  540.                 n.data.hp = n.data.hp -0.02
  541.             end
  542.             if n.data.hit > n.data.hpmax then
  543.                 n.data.hit = n.data.hpmax
  544.             end
  545.         end
  546.     end
  547.  end
  548.  return HealthPoint
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement