OpenXcom Forum
OpenXcom Forks => OpenXcom Extended (OXCE) => OXCE Suggestions DONE => Topic started by: Ethereal on July 27, 2018, 06:43:53 pm
-
Somewhere I briefly saw something about the damage Range. After playing "damageRange: 75" I realized that the ideal spread of damage would be = 50% -200%. Is it possible?
-
Somewhere I briefly saw something about the damage Range. After playing "damageRange: 75" I realized that the ideal spread of damage would be = 50% -200%. Is it possible?
It might be possible with scripts, I don't know.
But several people asked for this kind of spread already, I'll put it on my todolist.
-
It might be possible with scripts, I don't know.
But several people asked for this kind of spread already, I'll put it on my todolist.
Yes this indeed possible using script, first you need remove any randomes in attack (have flat atack).
Then use `hitUnit` script in item you use (or add global script that will affect all items):
extended:
scripts:
hitUnit:
- offset: -90 #probably first script to run
code: |
var int upper power;
var int lower power;
mul upper 2;
div lower 2;
battle_game.randomRange power lower upper; #change current power to 50% - 200%
return;
This will set for all weapons this behavior, you can expand this script to add this only for selected weapons.
-
I have added the option via the ruleset too, so that all the in-game damage indicators and pedia articles/stats work correctly.
items:
- type: STR_LASER_RIFLE
damageAlter:
RandomType: 7 # DRT_EASY, 50-200% spread
Default translation for "stats for nerds":
DRT_EASY: "50-200% spread"
Enjoy your easy mode...
-
Thank you very much.
-
If you do it completely random, 50-200% yields a median and average damage of 125%. To get 100% as a median, you could do something more like this:
Roll floating point from 1. to 2. = A
Random bit 0 or 1 = B
Weapon power = C
Weapon damage = D
If B = 1 then:
CA = D
If B = 0 then:
C/A = D
- - - - -
You can adjust the range by changing the top value of A.
For example, if A were 1.6824431, and we have a weapon power of 60:
- If B=1 then the damage is 60*~1.68 = 101.
- If B=0 then the damage is 60/~1.68 = 36.
This equation will prevent the low value from ever going beneath 0% no matter how high the high value goes. The average won't stay at 100% but the median will, and the average will be closer to 100% than with a linear equation. In the above case, the average damage would be 112.5%.
Linear median/average: 125/125
Suggestion median/average: 100/112.5
To add another more extreme example, I'll use the same 60 power as before but a range of 10-1000% damage.
A is a random floating point from 1. to 10.. Say we roll 8.7296503
- If B=1 then the damage is 60*~8.73 = 524.
- If B=0 then the damage is 60/~8.73 = 7.
Linear median/average: 505/505
Suggestion median/average: 100/302.5
-
If you do it completely random, 50-200% yields a median and average damage of 125%. To get 100% as a median, you could do something more like this:
I am not aware of anyone requesting a 100 median.
As far as I can say, people wanted completely random damage, with 125 median.
-
It was just a suggestion, feel free to ignore it.
-
write it yourself, scripts have all needed data to do this, even I posted example of this.