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

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#1

Post by Vincent(PDP) » Tue Jul 01, 2014 7:54 pm

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!
Last edited by Vincent(PDP) on Tue Jul 01, 2014 8:07 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

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

#2

Post by Ijon Tichy » Tue Jul 01, 2014 8:25 pm

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
Last edited by Ijon Tichy on Tue Jul 01, 2014 8:27 pm, edited 1 time in total.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#3

Post by Vincent(PDP) » Tue Jul 01, 2014 8:45 pm

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?
Last edited by Vincent(PDP) on Tue Jul 01, 2014 8:56 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

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

#4

Post by Ijon Tichy » Tue Jul 01, 2014 9:15 pm

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

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#5

Post by Vincent(PDP) » Tue Jul 01, 2014 10:29 pm

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?
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

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

#6

Post by Ijon Tichy » Wed Jul 02, 2014 2:13 am

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

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#7

Post by Vincent(PDP) » Wed Jul 02, 2014 10:25 am

Okay, thank you so much for you help! :smile:
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Post Reply