Advertisement
llLazy

Untitled

Feb 12th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 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. local curr
  16. -- Loop over every damage numbers
  17. while i < dam_nums:size() do
  18. curr = dam_nums:get(i)
  19. curr.time = curr.time - delta
  20. if curr.time <= 0 then
  21. dam_nums:remove(i)
  22. i = i - 1
  23. else
  24. total = total + curr.number
  25. end
  26. i = i + 1
  27. end
  28. local loc = Vector(curr.location.x, curr.location.y, curr.location.z)
  29. drawDamageNumber(hud, tostring(curr.number), curr.color, loc, 1, 1)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement