adding "luck" to a game
-
How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?
-
@the_true_odst said in adding "luck" to a game:
How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?
A very simple system is to create a list with all the variables that you want it to pick. If you want something to be very common, put a high amount of the same variable in the list. If you want it to be rarer, put very little (at minimum one mention somewhere on the list) of that variable on the list. The more mentions of one variable, the more common it is, and vice versa. If you want to have multiple luck systems for multiple different scenarios, you need a list for each individual system or scenario.
-
@sirbots said in adding "luck" to a game:
multiple luck systems for multiple different scenarios…
So if you have greater luck for rarer things, you would need create a different table with rarer things appearing more?
-
@the_true_odst You could have a custom reporter block that will take an input and return either “true” or “false”, which is if the user is lucky enough for something to happen or not. That block’s logic would just be making a random number from 1-100, and checking if it is greater than or equal to 50, and if it is, then return true, if not, return false. You could then use that to kind of like guard features (“Sorry, you aren’t lucky enough to do this action. ACCESS DENIED”) or to provide little easter eggs like only showing a different title art or something if a random number is like 38 or whatever. You don’t wanna make it too impossible though, then there’d be no point in putting the feature unless enough people are playing your game (over 1000) that at least one person will find the easter egg.
You could also provide a more varied output for things that aren’t just “true” and “false”, like say, determining how much XP to give a player after a mission. You might wanna take into account if the user did everything right on that mission, or just make it random (or a bit of both!).
This block (returns true/false) could just be
(lucky enough?)
Psuedo-code:if random number from 1-100 is greater than or equal to 50: return true else: return false
And for a more complex luck system (like the one I described farther up above) would perhaps need inputs in its custom block, and/or using lists (tables may be a bit much unless you need to store like items/different treasures). Inputs could be like the user’s luck, so if you wrote 0, the block would return a trash item, or if you wrote 100, they’d get a super mythical admin weapon, and of course, there’s the in-between (like common,uncommon,rare, epic, legendary, etc.).
I don’t have sample code to provide for a more complicated luck system, but I hope what I said can help you! -
@jeffreyrb03-gmail No, I meant like how some RNG games, depending on the luck you have determines how high of a roll you get. I want to implement this style into my game
-
@the_true_odst well then the last part of my answer applies to your RNG game, and you will need a table to store stuff like the item name, description, and rarity. It shouldn’t be too hard to just use random numbers, I think you should try it out the way I said first
-
@the_true_odst Creating a list for when you would have “Higher luck”, yes. You would make the rarer things have more entries in the list.
-
@sirbots I created 50 of something (let’s called it “thing1” bc the game I’m making is a secret), 25 of thing2, 12 of thing3, 6 of thing4, 3 of thing5, 1 of thing6, reshuffled the table a few times and pulled the first item out of that table. If that’s what you mean, would you make another table if you have a higher rarity with more rarer things added?