Chaosforge Forum

  • March 28, 2024, 18:39
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: AnyDice ... dice probability scripting for fun and profit  (Read 2821 times)

C4Cypher

  • Corporal
  • *
  • Offline Offline
  • Posts: 46
  • Clear Chamber, Load, Charge, Safety, Fire.
    • View Profile

This is an amazing page, http://anydice.com/

It's a web based interpreter made for scripting dice probabilities, the output is processed by plotting the chance that each result will occur, and then graphing the results.

I used it to make a simple damage calculator for pistols per shot, factoring in damage, power mods and accuracy.

Paste this into the script field at the top, or come up with something of your own.

Code: [Select]
\-- Pistol/rapid fire weapons ToHit+Damage calculator --\
\ Calculates percentages on shots fired, coupling the damage rolls with the chance to hit at a certain range \


function: damage die D sides S bonus B { result: DdS + B }

function: pistol sog G sob B ee E pow P agil A range R
{
result: [damage die 2 sides (4+P) bonus G + B] * (10 + A + E*2 + 4 - (R / 3) > 3d6)
}

function: chaingun bullet sob B ee E pow P agil A range R
{
result: [damage die 1 sides (6+P) bonus B] * (10 + A + E*2 + 2 - (R / 3) > 3d6)
}

function: chaingun sob B ee E th T pow P agil A range R
{
X: [chaingun bullet sob B ee E pow P agil A range R]
result: X + X + X + X + X * ( T > 0 ) + X * ( T > 1 )
}

function: plasma bullet sob B ee E pow P agil A range R
{
result: [damage die 1 sides (7+P) bonus B] * (10 + A + E*2 + 2 - (R / 3) > 3d6)
}

function: plasma rifle sob B ee E th T pow P agil A range R
{
X: [plasma bullet sob B ee E pow P agil A range R]
result: X + X + X + X + X + X + X * ( T > 0 ) + X * ( T > 1 )
}


output [pistol sog 0 sob 0 ee 0 pow 0 agil 0 range 5] named "Pistol"
output [chaingun sob 0 ee 0 th 0 pow 0 agil 0 range 5] named "Chaingun"
output [plasma rifle sob 0 ee 0 th 0 pow 0 agil 0 range 5] named "Plasma Rifle"

PISTOL: [pistol sog 2 sob 0 ee 0 pow 0 agil 0 range 5]

output PISTOL + PISTOL named "Dualgunner"
output [chaingun sob 2 ee 0 th 1 pow 0 agil 0 range 5] named "Triggerhappy"

PISTOL: [pistol sog 3 sob 3 ee 1 pow 1 agil 0 range 5]

output PISTOL + PISTOL named "Damage Build Pistol"
output [plasma rifle sob 3 ee 0 th 2 pow 1 agil 1 range 5] named "Ammochain Plasma"


I'm finding it a fun toy to play with, and perhaps a valuable tool when determining my builds. I'm sure people can make scripts to work with the stats for other weapons.

The Minor page is very useful in this regard.

I've separated out the damage roll as a separate function, simply so make it easier to do the same calculations for other pistol type weapons.

EDIT: I've done a few tweaks, added number crunching for Chaingun and Plasma (virtually identical weapons as far as how they work) ... note that these calculations are made 'per trigger pull' ... weapon speed is not taken into account here.
« Last Edit: December 04, 2010, 00:31 by C4Cypher »
Logged
Cacodemon Warrant Officer
[12/6/1/0/0]

Captain Trek

  • Sergeant Major
  • *
  • Offline Offline
  • Posts: 137
    • View Profile
Re: AnyDice ... dice probability scripting for fun and profit
« Reply #1 on: December 05, 2010, 01:36 »

Thankyou very much, I've been looking for something like this... Specifically because whilst reading an old forum thread on TVTropes dedicated to the infamous pen and paper RPG FATAL, I noted that to determine a character's birthday, you roll 1d20 + 1d12 -1, which the forumer who mentioned this rightly noting that it would cause a minor bell-curve... With this, I can now see just what that bell-curve actually looks like. Again, thankyou very much... :D
Logged

rchandra

  • Elder
  • Major
  • *
  • *
  • Offline Offline
  • Posts: 359
    • View Profile
Re: AnyDice ... dice probability scripting for fun and profit
« Reply #2 on: December 05, 2010, 13:43 »

You've probably figured this out, but the easiest way to make a d31 from real dice is (d4 - 1) * 10 + d10, reroll if too high.  You can also use binary - roll 5 dice of any type, in order.  I use binary when I only have d6s around, since I don't have to think too hard to use it for any number range.

Cypher, thanks for the link to "Minor" - definitely a resource worth bookmarking.
Logged
0.9.9.1-4: Arch-Vile Br. General [25/25/17/5/1]
0.9.9.5-7: Hell Baron Major [ 21 16 12 4 1 0 ]
Pages: [1]