Page 1 of 1

Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Tue Jul 01, 2014 7:54 pm
by Vincent(PDP)
Ok so this is the case, I need to calculate the approximate chance of being killed by a weapon with one shot. The maximum amount of damage done when you're hit is around 350HP. The player can have far over that in health. Since I want to calculate the approximate chance (in percent) that the player would die from one shot, health above 350 will return 0% and the higher amount of health the player has, will return a lower amount of percent. (For example: > 350HP = 0%, 350HP = 23%, 240 = 89%, < 70 = 100% or something like that.)

In the DECORATE, the bullet is fired with A_FireBullets. It fires one bullet with damage set to 125.

Sorry if this question is hard to understand...

I am only able to use built-in functions and pow, min and max.


Thanks!

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Tue Jul 01, 2014 8:25 pm
by Ijon Tichy
yeah uh I don't think anyone here is going to teach you half of statistics 101 to answer this

because that's what answering this question requires

edit: actually, since it's only one bullet, it's a 33% chance to oneshot at 350 hp (out of the possibilities [125, 250, 375], all are equally likely, and only 1/3 are above 350)

never mind this doesn't require stats 101
more complex examples *will* though

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Tue Jul 01, 2014 8:45 pm
by Vincent(PDP)
Ijon Tichy wrote: yeah uh I don't think anyone here is going to teach you half of statistics 101 to answer this

because that's what answering this question requires

edit: actually, since it's only one bullet, it's a 33% chance to oneshot at 350 hp (out of the possibilities [125, 250, 375], all are equally likely, and only 1/3 are above 350)

never mind this doesn't require stats 101
more complex examples *will* though
Oh okay. Thanks. But can you look at if I'm going in the right direction here, please? :)

Code: Select all

Int Health = GetActorProperty(0, APROP_Health);
        Int SniperMax = 375;
        Int FirstSection;
        Int Output;
        
        If(Health > 375)
        {
            Output = 0;
        }
        Else
        {
            FirstSection = SniperMax - Health;
            Output = FirstSection / (SniperMax / Health);
        }
        
        SniperDeathChance = Output;
It seems to return over 100 when it's lower than 270 or something.
Because if I use a calculator I will get this:

375 - 270 = 105
375 / 270 = 1,388888888888889
105 / 1,388888888888889 = ~75,6

But in Doom it doesn't seem to calculate using the decimals too. It only divides 105 with 1.

EDIT:
Aha ok, so the maximum damage is calculated by taking the damage times 3? (Damage * 3)

And the hitscan can NEVER hurt less than 125?

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Tue Jul 01, 2014 9:15 pm
by Ijon Tichy
the bullet only has three possible damage values - 125, 250, or 375
bullet damage is, unless FBF_NORANDOM is specified, (damage * random(1, 3))
the only allowable probabilities for it killing you in one shot are 0%, 33%, 67%, and 100% (0/3, 1/3, 2/3, 3/3).

that's like doom bullets 101

you are going very definitely in the wrong direction

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Tue Jul 01, 2014 10:29 pm
by Vincent(PDP)
So of I understand this right, this is what it should be like:
1-125 = 100%
126-250 = 67%
251-375 = 33%
> 375 = 0%.


About calculating for multiple bullets, is this what you were talking about? http://www.statistics101.net/

Or is it another Website?

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Wed Jul 02, 2014 2:13 am
by Ijon Tichy
Vincent(PDP) wrote: So of I understand this right, this is what it should be like:
1-125 = 100%
126-250 = 67%
251-375 = 33%
> 375 = 0%.
yes

About calculating for multiple bullets, is this what you were talking about? http://www.statistics101.net/

Or is it another Website?
er, it's a class that serves as an introduction to statistics
khan academy /might/ have some stuff for it, I dunno

RE: Calculating approximate chance of being killed by a weapon. (ACS)

Posted: Wed Jul 02, 2014 10:25 am
by Vincent(PDP)
Okay, thank you so much for you help! :smile: