Advertisement
llLazy

Untitled

Feb 12th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. -- This function is called everytime a damage number should be created, instead of the original function
  2. function onDamageNumberCreate(dam_nums, number, loc, is_shield)
  3. -- Create a new instance of DamageNumber. The default time that it takes before a damage number fades out is 1.70
  4. local num = DamageNumber(number, 1.70, loc, is_shield)
  5. -- Set the original color
  6. num.color = rgb(255, 255, 255)
  7. -- Add the new damage number to the original array
  8. dam_nums:add(num)
  9. end
  10.  
  11. -- This function is called once per frame to update the attributes of the damage numbers and draw them
  12. function onDamageNumberUpdate(dam_nums, hud, delta)
  13. local i = 0
  14. local total = 0
  15. -- Loop over every damage numbers
  16. while i < dam_nums:size() do
  17. local curr = dam_nums:get(i)
  18. curr.time = curr.time - delta
  19. if curr.time <= 0 then
  20. dam_nums:remove(i)
  21. i = i - 1
  22. else
  23. total = total + curr.number
  24. end
  25. if i == dam_nums:size() then
  26. local loc = Vector(curr.location.x, curr.location.y, curr.location.z)
  27. drawDamageNumber(hud, tostring(curr.number), curr.color, loc, 1, 1)
  28. end
  29. i = i + 1
  30. end
  31.  
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement