Linear Math... |
I am going to attempt to post two examples of the math I have used in my personal mod to do weapon damage with. If this posts successfully (it errored out last time) feel free to use this information however you want.
WARNING: What follows is math. If math angers/frustrates you, then this will probably piss you off.
This is the math for a weapon to reduce damage according to linear dropoff.
Definitions:
f(m) is damage modifier from levels.
f(p) is percentage of m which applies, as expressed by a number from 0.00 (for 0%) to 1.00 (for 100%).
f(r) is the percentage of the range of the weapon as it relates to its maximum possible range, as expressed by a number from 0.00 (for 0%)
to 1.00 (for 100%). Example: If the max range is 60, then 30 is 50% of 60 (or one half), so r = 0.5.
f(m) = damage by level * (p)
f(p) = 1 - (a * r)
f(r) = range formula
Notes:
a is the ammount of damage lost. a = 0.4 = 40% damage damage lost.
Script function definitions:
Power is the formula command for exponents. Power (A, B) means A to the power of B. Squareing something would be Power (A, 2).
Cubing would be Power (A, 3). Another text notation for this would be A^B.
iif is an if - then - else command. iif(A, B, C) = if A is true, do B, otherwise do C.
Min is take the minimum of two values. Min(A, B) = take the minimum of A or B, whichever is lower.
So, iif([%Range%] Min(90, (([%Level%] - 1) * 10) + 30), 10000, 0)
(23 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 1.67) - iif([%Range%] > Min(90, (([%Level%] - 1) * 10) + 30), 10000, 0)
Simplified formulas:
iif([%Range%] <= Min(90, (([%Level%] - 1) * 10) + 30), (20 + (([%Level%] - 1) * 15)) - (([%Range%] / 10) * 1.67), 0)
iif([%Range%] <= Min(90, (([%Level%] - 1) * 10) + 30), (23 + (([%Level%] - 1) * 15)) - (([%Range%] / 10) * 1.67), 0)
Work:
iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (20 + (m)) , 0)
f(m) = (([%Level%] - 1) * 15) * (p)
f(p) = 1 - (0.5 * (r))
f(r) = [%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)
Result:
iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (20 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)))))) , 0)
iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (23 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)))))) , 0)
This allows for a more organic and consistant damage dropoff accross all levels, but requires additional testing.

Problems
You may be having issues with the < and > signs. Either use "escape HTML" format under Input Format, or replace all such symbols with &l t; and &g t; (remove the spaces to make them format correctly into < and >)
_______________________
There are 10 types of people in the world:
Those that understand binary, and those that don't.
Perhaps this would be better
Perhaps this would be better illustrated with a few graphs. Mind explaining what this formula does in simpler terms? It's difficult to make out what the formula does, given all of the parenthesis.
breakdown
Math Error?
You meant -100 - 5 + 5 + 100, Right? If not, then that's probably your error. You start at 100, Subtract 5 for 95, plus 5 for 100 again, then add another 100 and it defenatly doesn't equal zero 





linear pt 1
deleted