Uszi
New Member
- Reaction score
- 5
I'm working on a passive "Shot gun" spell.
Right now, the leveling the spell causes you to research an upgrade that Enables attack two (a splash missile) and then increases the spill radius of the damage.
But what I need help with is coming up with a distance based damage system.
Ideally, I would like the system to figure out if a target is within or outside of a 400 range. Inside 400, it applies some sort of +damage modifier based on how close it is. Outside of 400, I would use the same modifier to reduce the damage. At 400 normal damage.
I was thinking I could set some sort of temporary integer = 0+Distance, and add some sort of divisor to make it reasonable. So like, at 50 distance from the target, your 350 distance from the zero point, and if we divide it by like, 5 then you get a +70 damage modifier. Conversely, if your 750 distance away from the target, your distance is -350 now, and you get a -70 damage modifier.
My question is: How do I detect how far away a unit is? How do I use that value as an integer?
Right now, the leveling the spell causes you to research an upgrade that Enables attack two (a splash missile) and then increases the spill radius of the damage.
But what I need help with is coming up with a distance based damage system.
Ideally, I would like the system to figure out if a target is within or outside of a 400 range. Inside 400, it applies some sort of +damage modifier based on how close it is. Outside of 400, I would use the same modifier to reduce the damage. At 400 normal damage.
I was thinking I could set some sort of temporary integer = 0+Distance, and add some sort of divisor to make it reasonable. So like, at 50 distance from the target, your 350 distance from the zero point, and if we divide it by like, 5 then you get a +70 damage modifier. Conversely, if your 750 distance away from the target, your distance is -350 now, and you get a -70 damage modifier.
My question is: How do I detect how far away a unit is? How do I use that value as an integer?