So, this may not be possible or may be way more difficult than I’m willing to go… but I’m working on a basketball game and was wondering if there is a way to “simulate” games like this in Choicescript:
Each “encounter” or time you click “play game” you’ll get a random roll which will determine if you win or lose, which seems easy enough, but I’d like to add some “modifiers” on top of it.
So, say for instance you signed the best player in the offseason. I’d like that to give you a +5% success rate. If you have good team chemistry +5%. If you have the backing of management, +5%. And the reverse would be true too. Like if you weren’t able to snag the best free agent, you’d get -5% and so forth.
Is this possible and how would this look in Choicescript? I’d like for it to simply simulate like 41 games at once and spit out a record (10-31, 21-20, 30-11, etc) based on these modifiers. Since a basketball season is 82 games, just hit this button once when the player is ready, take them to the midway point of the season, give them some more options/narrative to improve their team, then let them simulate the remaining 41 games to bring them to the end of the season and see if they made the playoffs.
Bonus points: Would there be a way to spit out a “box score” for these games too? I would think it would be something similar to the first game I developed all by myself as a kid. I had a die and a piece of paper, and better players would have a x6 modifier (or stat ranking in offense) and worse players would be x5, x4, etc.I’d roll the die and multiply, then divide by the defense modifier (stat) of the player assigned to defend them. This would yield their points for the game.
Any assistance here would be swell. It isn’t necessary, but if I could figure it out I think this could add a new dimension to my game.
Thanks for reading/all your suggestions! If you want to check out my game, you can do so at this post: Chicago Slaughter: Basketball + SciFi Elements! (WIP) DEMO AVAILABLE! UPDATED 10/7
Maybe you could *rand insertveriablehere 0 100 and if it is less than 50 you lose and greater than 50 you win. I think you might also be able to *set things after the variable is randomized, so you could increase the number, which increases the chances that it is over 50, which increases the chance that you win the game. This might not work though, I’m just speculating.
As I sit and think about this more and more, would something like this work?
*rand die_roll 1 10
*if freeagent = 4
*if chemistry = 1
*set die_roll +1
*if die_roll = 1
*set record_text “0-41”
*if die_roll = 2
*set record_text “4-37”
and so on. I’m sure my spacing and whatnot here is wrong, but i have to mess with this stuff like 100 times before i can get it to work usually… haha.
I just did this in the online CSIDE visualization tool. I’m not sure if this is what you’re looking for, but this works for me:
*create comeonandslam 0
*create advantage1 false
*create advantage2 false
*create advantage3 false
You have just finished playing the big game! Do you have any special skills that could improve your team's chances of winning?
*disable_reuse #I am taller than the other players.
*set advantage1 true
*disable_reuse #I am Shaq's second cousin.
*set advantage2 true
*disable_reuse #I have memorized every second of [i]Space Jam[/i].
*set advantage3 true
*rand comeonandslam 0 100
*set comeonandslam +5
*set comeonandslam +5
*set comeonandslam +5
*if (comeonandslam < 50)
*elseif (comeonandslam > 50)
Oh, no! You lost the big game!
Yay! You won the big game!
Hope this helps!
I’m gonna try this when the moment is right and report back, but it looks rock solid. Thank you @Writing_Fever! 100,000,000 bonus points for using Space Jam lyrics too, it is 100% a formative text in my game! I’m keeping it a bit wacky and not so serious. Thanks again!
Haha no problem! Glad I could help! (:
Okay, so I’m working on this and it’s going wonderfully. But a quick question: I want to display FG% but I want it to cut off at the tenths, the first digit after the decimal point. Is this possible? I can round and that seems kind of like cheating… but I’d love to have like a 50.5% FG percentage…
Not cheating… more like limited is what i mean b/c i keep ending up with multiples of 10 which is not realistic.
Scratch that, I adjusted my maths and now I can get it to do whole numbers at least, which is okay, but I’d still love to do one decimal place.
After much head scratching, I’m abandoning the FG% lol. No worries, I couldn’t quite get it to work haha.
Success by the way @Writing_Fever! Thanks again for the help! I went a slightly different way with it, but you got me started in the right direction!
No problem! I’m glad I could help.