Re: Modding SEV Thread Questions
The given formula is for a weapon without any range attenuation, so I will instead use this one:
Weapon Space Min Damage Modifier Formula := (55 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 5) - iif([%Range%] > Min(90, (([%Level%] - 1) * 4) + 50), 10000, 0)
=0=
iff(CONDITION, a, b) means:
If CONDITION is true, do a. Otherwise, do b. It is a messy way to put:
if (CONDITION) {
do a
}
else {
do b
}
Sadly, it is the only way to do that when your entire "formula" has to fit on a single line.
Min(x, y) is a function that returns whichever value is smaller, x or y.
=0=
Now to look at the formula:
(55 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 5) - iif([%Range%] > Min(90, (([%Level%] - 1) * 4) + 50), 10000, 0)
The first part is pretty straightforward:
(55 + (([%Level%] - 1) * 5))
This evaluates to 5 plus 2 times one less than component level. This part is the base damage value, the damage at range 0.
The next part is the damage attenuation rate (aka: damage reduction over range).
- (([%Range%] / 10) * 5)
For every 10 units of distance, subtract 5 damage.
The last part, the big iff, is the max range setting.
- iif([%Range%] > Min(90, (([%Level%] - 1) * 4) + 50), 10000, 0)
In this case, we have:
CONDITION = [%Range%] > Min(90, (([%Level%] - 1) * 4) + 50)
a = 10000
b = 0
When the range to the target gets larger than a certain value, 10000 will be subtracted from the damage value. This effectively cuts off damage at that range, due to negative value handling.
The CONDITION is the part that is determining the max range; it is the minimum of 90 or (([%Level%] - 1) * 4) + 50). Thus, every instance of the weapon will have at most a range of 90. The second value that we compare 90 to is the range increase via tech levels. It is 50 plus 4 times one less than the level of the component. Isn't that nice wording? hehe.
This breaks out to the following ranges at tech levels:
1: 50 + 0 = 50
2: 50 + 4 = 54
3: 50 + 8 = 58
4: 50 + 12 = 62
5: 50 + 16 = 66
...
10: 50 + 40 = 90
11: 50 + 44 = 94
Note that level 11 gets a value greater than 90, so the Min function call forces the max range down to 90.
|