ForgeEssentials

ForgeEssentials

339k Downloads

Random voting

macman73 opened this issue ยท 4 comments

commented

Hello,

I have a requirement on my server for voters to receive items randomly from currently approx 1000 voting reward scripts each having a 1% chance of being successful. I plan to add more.

Example:

random 1
$/give @player sus:MarvelLogo

This currently gives the players far to many items and players tend to receive anything from 7 to 15 items from a single vote across 4 votes this can get a little too much.

I was wondering if it was possible as a feature addition to be able to use non integers in that argument. Basically less than 1% .

Also what would be the impact of handling 1000's of scripts in a vote I heard reports of players crashing during a vote reward event but I cant confirm this.

Am I going about this all wrong and can you suggest any better ways for me to achieve my goal.

Thankyou for reading.

commented

From a programmer's standpoint, you're better off doing a random int where int is the amount of possible outcomes. Then use an array to call the specific outcome.

Your current setup would give every outcome a chance whether or not a different one was performed

commented

There is no flow control or even a @random argument, so using an array of outcomes is not currently possible

commented

This would be possible if we add simple variables which I discussed with @spacebuilder2020 just now:

{
  "name": "gift",
  "usage": "/gift <player>",
  "extraPermissions": {},
  "permissionLevel": "TRUE",
  "patterns": {
    "": [
      "echo Usage: /gift <player>"
    ],
    "@p": [
      "set index round(@rnd * 3)",
      "$/gift gift $index"
    ],
    "gift 1": [ "$/give @player sus:MarvelLogo" ],
    "gift 2": [ "$/give @player sus:MarvelLogo" ],
    "gift 3": [ "$/give @player sus:MarvelLogo" ]
  },
  "aliases": []
}

I started a simple draft for this: https://docs.google.com/document/d/13M08_ojzjghvkZRRSsE--eyyYnulJtUbIvvyagetw7o

commented

This is now possible with expression support and basic flow control.