OsmondDeschaine

Untitled

Mar 4th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. So here is an explanation. I am trying to make a visual limb damage tracker, what this script is supposed to do is alter the value of the osmosis.limbdamage.leftarm(or head) variable and add 1 to it. So it starts off at 0 (that is what I have the value initialized to in a seperate script) and when I do light bruising it adds 1, and repeats that for moderate and critical bruising. In turn, I have another script that checks the value of the script and calls the gauge to a certain colour based on the value of the corresponding variable. I know there will be issues with this, it is far from complete, I am just trying to get simple functionality right now and can't figure out why this script isn't working. I am trigger off of:
  2.  
  3. ^Your strikes cause (\w+) bruising on (\w+)'s (.+).$
  4.  
  5. that does: addDamage(matches[4], matches[2])
  6.  
  7. Now it is the addDamage function that is giving me the issues, it isn't increasing the value of its corresponding variable (I am checking it with lua osmosis.limbdamage.leftarm). I think the problem has to be in the script because everything else seems legit, I have osmosis.limbdamage called in my initialization script with: osmosis.limbdamage.leftarm = osmosis.limbdamage.leftarm or 0. So here is the function in question:
  8.  
  9. function addDamage(limb, severity)
  10. if severity == "light" then
  11. if limb == "head" then
  12. osmosis.limbdamage.head = osmosis.limbdamage.head + 1
  13. elseif limb == "torso" then
  14. osmosis.limbdamage.torso = osmosis.limbdamage.torso + 1
  15. elseif limb == "left arm" then
  16. osmosis.limbdamage.leftarm = osmosis.limbdamage.leftarm + 1
  17. elseif limb == "right arm" then
  18. osmosis.limbdamage.rightarm = osmosis.limbdamage.rightarm + 1
  19. elseif limb == "left leg" then
  20. osmosis.limbdamage.leftleg = osmosis.limbdamage.leftleg + 1
  21. elseif limb == "right leg" then
  22. osmosis.limbdamage.rightleg = osmosis.limbdamage.rightleg + 1
  23. end
  24. elseif severity == "moderate" then
  25. if limb == "head" then
  26. osmosis.limbdamage.head = osmosis.limbdamage.head + 2
  27. elseif limb == "torso" then
  28. osmosis.limbdamage.torso = osmosis.limbdamage.torso + 2
  29. elseif limb == "left arm" then
  30. osmosis.limbdamage.leftarm = osmosis.limbdamage.leftarm + 2
  31. elseif limb == "right arm" then
  32. osmosis.limbdamage.rightarm = osmosis.limbdamage.rightarm + 2
  33. elseif limb == "left leg" then
  34. osmosis.limbdamage.leftleg = osmosis.limbdamage.leftleg + 2
  35. elseif limb == "right leg" then
  36. osmosis.limbdamage.rightleg = osmosis.limbdamage.rightleg + 2
  37. end
  38. elseif severity == "critical" then
  39. if limb == "head" then
  40. osmosis.limbdamage.head = osmosis.limbdamage.head + 3
  41. elseif limb == "torso" then
  42. osmosis.limbdamage.torso = osmosis.limbdamage.torso + 3
  43. elseif limb == "left arm" then
  44. osmosis.limbdamage.leftarm = osmosis.limbdamage.leftarm + 3
  45. elseif limb == "right arm" then
  46. osmosis.limbdamage.rightarm = osmosis.limbdamage.rightarm + 3
  47. elseif limb == "left leg" then
  48. osmosis.limbdamage.leftleg = osmosis.limbdamage.leftleg + 3
  49. elseif limb == "right leg" then
  50. osmosis.limbdamage.rightleg = osmosis.limbdamage.rightleg + 3
  51. end
  52. end
  53. end
  54.  
  55.  
  56. Once again, I know the actual combat application of this is flawed at best, but I am just trying to get this thing actually changing my gauges, I will fine tune it after that.
Advertisement
Add Comment
Please, Sign In to add comment