Created
December 30, 2021 01:36
-
-
Save travis-g/86d4f7433c28c9425cab472121c600a6 to your computer and use it in GitHub Desktop.
Fallout 4 Challenge Run Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@this = "Fallout 4 Challenge Run Generator" | |
@me = "/u/travis-g" | |
@license = "WTFPL2, but I'd love a mention" | |
@about = """ | |
#{@this} | |
Made by #{@me} | |
Started as just the trash() function, but it got bigger when I thought of a | |
use for it. I've put hundreds of hours into Skyrim and Fallout games just by | |
running character/challenge builds. I've never finished the main questlines. | |
The perks you pick and their order are up to you. Don't extensively plan your | |
build unless you know how difficult it'll be to play. FYI, the only accurate | |
perk planner I've found is https://www.gameplorer.de/fo4/. Levelbased's won't | |
accurately calc minimum required level for required number of perk points. | |
I *highly* recommend using an alternate start mod, mostly to help get any | |
build-relevant gear and skip tedium. There's also no harm in role-play. I use | |
https://www.nexusmods.com/fallout4/mods/18946/ by TinyManticore. | |
If I'm excited for a build and I want to perk out a character quickly, I use | |
https://www.nexusmods.com/fallout4/mods/6285/ by Mindful Droid. Idk if it's | |
safe to put in after starting a playthrough, but it's a great alternative to | |
save-scumming quest XP rewards with Idiot Savant. *You'll level way too fast | |
if you use both.* | |
""" # -------------------------------------------------------------------------- | |
#require "console.table" # node is dum | |
c = console # life changer | |
# Attribution | |
c.info @this | |
c.info "Made by #{@me}\n" | |
# Non-biased [].shuffle(), if there isn't already a built-in | |
Array::shuffle ?= -> | |
if @length > 1 then for i in [@length-1..1] | |
j = Math.floor Math.random() * (i + 1) | |
[@[i], @[j]] = [@[j], @[i]] | |
this | |
# "make an array of `n` random integers which sum to `t`" | |
# trash() is so inefficient that it scares repls into | |
# thinking it's an infinite loop, if given a high `max` | |
trash = (n, t, max=t-n, min=1) -> | |
while sum != t # real dang gross | |
arr = [] | |
for x in [1..n] | |
stat = min + Math.floor Math.random()*max | |
arr.push stat | |
sum = arr.reduce (j, l) -> j + l | |
arr | |
Special = (-> | |
# - 7 stats, | |
# - 28 points total during character creation, | |
# - Max of 9 initially (go get bobbleheads) | |
# - Min of 1 for each stat. | |
out = {} | |
categories = "SPECIAL".split "" | |
for n, i in (trash 7, 28, 9, 1) | |
out[categories[i]] = n | |
out)() # do it | |
# Creates a Scenario using shuffle()[0] as we define the possible options. | |
# If there's an option I missed, tell me, and I'll gladly add it. | |
Scenario = | |
weapon: [ | |
"Unarmed, bare fists" | |
"Unarmed, knuckles/power fists" | |
"Melee, bladed" | |
"Melee, blunt" | |
"Guns, rifles" | |
"Guns, automatic" | |
"Guns, pistols" | |
"Guns, shotguns" | |
"Guns, heavy" | |
"Energy, rifles" | |
"Energy, pistols" | |
"Energy, heavy" | |
"Explosives" | |
"Traps, bear traps/caltrops" # Far Harbor DLC | |
"\"Pacifist\"" # 0-kill would be rediculous: https://redd.it/3xnyjw | |
].shuffle()[0] | |
armor: [ | |
"Leather" | |
"Metal/Raider" | |
"Combat" | |
"Synth" | |
"Robot" | |
"Power armor" | |
"Clothing, any outfit" | |
"Clothing, non-protective" | |
[ # weird/rare/DLC armors | |
"DC guard" | |
"Trapper" | |
"Marine" | |
"Operators" | |
"Disciples" | |
"Pack" | |
].shuffle()[0] | |
].shuffle()[0] | |
faction: [ | |
"None" # play the field or kill them all | |
"Brotherhood of Steel" | |
"The Institute" | |
"Commonwealth Minutemen" | |
"The Railroad" | |
].shuffle()[0] | |
# TODO: minor factions like Atom Cats? There aren't many. | |
romance: [ # http://fallout.wikia.com/wiki/Affinity | |
"None" | |
"Cait" | |
"Curie" | |
"Danse" | |
"Hancock" | |
"MacCready" | |
"Piper" | |
"Preston" | |
].shuffle()[0] | |
companion: [ | |
"None" | |
# can be romanced: | |
"Cait" | |
"Danse" | |
"Hancock" | |
"MacCready" | |
"Piper" | |
"Preston" | |
# can't be romanced: | |
"Ada, automatron" | |
"Codsworth" | |
"Curie" | |
"Deacon" | |
"Dogmeat" | |
"Gage" | |
"Longfellow" | |
"Nick" | |
"Strong" | |
"X6-88" | |
].shuffle()[0] | |
theft: [ | |
"No freelance theft" | |
"If it's too tempting to resist" | |
"Habitual" | |
"If it's not nailed down, it's yours" | |
].shuffle()[0] | |
murder: [ | |
"No unprovoked murder" | |
"Occasional" | |
"Frequent" | |
"Constant rampage" | |
].shuffle()[0] | |
extra: [ # maybe add some flavor to our monster | |
"None" | |
[ | |
"Drink everything you see" # hope you've got Party Boy | |
"Eat everything you see" # forces a lot of rads when scavenging | |
"Chemhead" # heavily use chems as part of gameplay, not as a fallback | |
"Iatrophobia, no doctors" # "fear of doctors", eat food/drink to recover | |
"No fast travel" # try a mod to disable, or only travel to settlements | |
"No VATS" # use a mod or disable the hotkey | |
"No Stimpaks/RadAway; use doctors" | |
"No Gun-Nut/Armorer/Blacksmith" # buy/salvage all mods | |
"Trypanophobia, no needles" # "fear of needles", no injected chems/drugs | |
"Favor aggressive dialog" # stir the pot whenever possible | |
"Reduce base carry weight to 75" # use a mod or `player.modav` | |
].shuffle()[0] | |
].shuffle()[0] | |
# TODO: output scenario notes for potential conflicts, ex. "for faction:Railroad | |
# and romance:Danse, see https://www.nexusmods.com/fallout4/mods/13072/" | |
# ------------------------------------------------------------------------------ | |
Export = { # TODO: base64 encode Export to "save" the scenario | |
special: Special | |
scenario: Scenario | |
} | |
# ship it | |
c.table [Export.special] | |
c.table ["aspect", "suggestion"], Object.entries Export.scenario | |
#JSON.stringify Export |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment