• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

bounty calculation formula?

Status
Not open for further replies.
Level 11
Joined
Jul 12, 2005
Messages
764
Does someone know how to calculate bounty from those three values that we have to give in the OE?

I mean:

Bounty Awarded - Base
-Number of dice
-Sides per die

Anyone knows a formula?

I'm making a custom bounty system, in which we can make units have a chance to give bounty, or we can manipulate bounty in-game.
But in this state, i can only set the min and max value of the bounty...
 
Level 15
Joined
Jan 31, 2007
Messages
502
Im not sure but i think this could be right :

JASS:
    local Integer Bounty = ´Bounty Awarded - Base´
    local Integer Dice  = 1
    local Integer DicesNumber = ´Number of dice´
    loop
        exitwhen Dice > DicesNumber
        set Bounty = ( Bounty + GetRandomInt(1, ´Sides per die´) )
        set Dice = Dice + 1
    endloop


Number of Dices*Random(Sides)
Jacek , i dont think that u are going to dice each time the same number
 
Last edited:
Level 5
Joined
May 5, 2007
Messages
120
1 Dice = a random value
# of sides = maximum random value

So, 2 dice with 6 sides, is the same thing as rolling for monopoly.
1 dice with 2 sides is the same thing as flipping a coin.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Well, pask.

Johnn'ys way loops through every die and adds a random number between 1 and its sides.

My way just takes that into account, and multiplies the min and the max random by the number of dice, so you don't need a loop. Why?

-If you have n dice, and you roll a 1 on each die (the lowest possible number), you will roll n in total, thus NumDie
-If you have n dice, and you roll the max amount on each die (the highest possible number), you will roll n * sides per die in total, thus NumDie * SidesDie
-Anywhere in the middle will be also taken into account in the GetRandomInt
-BountyBase being added on is obvious

Using that, we start off with

Bounty = BountyBase

then, we add a random amount

Bounty = BountyBase + GetRandomInt( min, max )

take into account the minimum roll

Bounty = BountyBase + GetRandomInt( NumDice, max )

take into account the maximum roll

Bounty = BountyBase + GetRandomInt( NumDice, NumDice*SidesDie )
 
Level 18
Joined
Jan 24, 2006
Messages
1,938
Bounty is calculated in the same way as damage, like so:
Mysterious Tutorial of Doom (Part One) said:
Code:
(Integer Value) Stats - Bounty Awarded - Base:
Sets the unit’s base bounty (gold given to the killing unit) (NOTE: Total bounty given is determined like so: The amount of dice set in “Stats - Bounty Awarded - Number of Dice” is rolled, each with the amount of sides set in “Stats - Bounty Awarded - Sides per Die”, the number produced is then added to the base bounty set in “Stats - Bounty Awarded - Base” to determine how much damage the unit’s attack deals)

-*meow*
 
Level 11
Joined
Jul 12, 2005
Messages
764
Yeah Doc, yours and Purple's are the same, but with some arrangements:
Bounty = GetRandomInt( BountyBase+NumDice, BountyBase+(NumDice*SidesDie))
Bounty = BountyBase + GetRandomInt( NumDice, NumDice*SidesDie )

And i said it's ok, i got it working, thanks to all of you ;)
Gonna upload the CreepSystems map soon.
 
Level 15
Joined
Jan 31, 2007
Messages
502
Bounty = GetRandomInt( BountyBase+NumDice, BountyBase+(NumDice*SidesDie))
Bounty = BountyBase + GetRandomInt( NumDice, NumDice*SidesDie )

Will work too but its not exacly the same as rolling dices because every number has the same chance .

The thing i mean is :
e.g.
BountyBase = 10
NumDice = 2
SidesDie = 2

-> Your formula : 33% for 12 , 33% for 13 and 33% for 14
-> My would be : 25% for 12 , 50% for 13 ( 10 + 1 +2 AND 10 +2 +1 ) , 25% for 14

I dont know how blizzard made it but i guess if they need 3 different values they wont make it your way because 2 numbers would be enought ( i this case 12 and 14 ) . Anyway , its not a big difference and not really important :grin:
 
Status
Not open for further replies.
Top