Modding Help Request, RNG Dice.

Discussion in 'Starbound Modding' started by Tini_weni, Jan 17, 2017.

Tags:
?

Would RnG Dice be worth adding if it were possible

Poll closed Jan 24, 2017.
  1. Yes

    3 vote(s)
    75.0%
  2. No

    1 vote(s)
    25.0%
  1. Tini_weni

    Tini_weni Scruffy Nerf-Herder

    Hi to any who may View this post.

    My question: is RnG Dice even possible?
    Could it become a Chat CMD /roll
    or maybe a hand held item you can activate, eat, throw. bring up a speech bubble,
    or the use of wiring logic gates to act as random 1 to 6.

    After of long look at the forums i could not find any thread on this topic or a mod that includes such a feature.
    i'm by no means a modder wouldn't know where to begin,
    just help me play snakes n ladders with composite Rail.

    Thanks
     
  2. midramble

    midramble Space Hobo

    Should actually be kinda easy. I'd have to go back and look, but I remember seeing a lua somewhere in there for simple random number generation. I believe in one of the files in the root of unpacked asset files. I'll double check.

    Correction: Looks like scripts directory and it's in the util scripts. A few util.random functions there. Even weighted options. I should definitely scan this file more....
     
    Tini_weni likes this.
  3. The | Suit

    The | Suit Agent S. Forum Moderator

    Tini_weni and midramble like this.
  4. Tini_weni

    Tini_weni Scruffy Nerf-Herder

    Thank you Midramble & The | Suit for your Replys, Now iv'e gotta find A wonderful Modder to take this on :)
     
  5. bk3k

    bk3k Oxygen Tank

    You know the best way to handle dice would be a thrown projectile. math.random(min, max) is all you need for dice. You wouldn't need weight options unless you're making cheater's dice :p
    math.random(1, 6) for six sided dice, etc

    Then you just have different image frames for the dice to choose from.
    You COULD go the extra mile and add a radio message(like what SAIL does and others in missions) to add the dice results to the messaging window if you found that desirable.

    And you know, I sort of like the idea of someone adding gambling machines to SB so long as they're realistic. Statistically the house comes out on top.

    edit: yeah you could even simulate the physics of the dice roll to respond to bouncing off walls, rolling, etc in the determination of what number comes up top - but there isn't a lot of point to doing so, and implementation gets more complicated pretty fast.
     
    Inf_Wolf14 likes this.
  6. Tini_weni

    Tini_weni Scruffy Nerf-Herder

    Thank you for the input bk3k.
    For the sake of the modder who is willing to make this a reality for my i would suggest the simplistic form where you need no pixel art/animation/physics, just a message with a random number would do.
     
  7. DraikNova

    DraikNova Spaceman Spiff

    If pixelart is required, I'm quite willing to provide some. Given starbound's feel, I'd imagine the dice would display the number via hologram, which would basically just be recoloring the preexisting number signs and pasting them into the same image as a die.
     
  8. Errors4l

    Errors4l Spaceman Spiff

    Here's a command mod I quickly threw together with nothing fancy added to it. Feel free to reuse code or add to it.
    http://www.mediafire.com/file/phj2fuc5o6qzdv5/ServerDice.zip

    The mod only has to be installed on the server, though may require asset mismatching to be allowed for other players to join. It will work fine in singleplayer as well.

    Usage
    /roll [amount] [faces] [broadcast]
    Amount: Value between 1 and 100, determining how many dice to roll.
    Faces: Value between 1 and 1000, determining the amount of faces per die.
    Broadcast: If any value is entered, the results will be broadcast to everyone.

    Examples
    /roll
    Rolls 1 die with 6 faces.
    /roll 5
    Rolls 5 dice with 6 faces each.
    /roll 5 20
    Rolls 5 dice with 20 faces each.
    /roll 5 20 t
    Rolls 5 dice with 20 faces each, and broadcasts the results to everyone online.
     
    Inf_Wolf14, Tini_weni and The | Suit like this.
  9. Tini_weni

    Tini_weni Scruffy Nerf-Herder

    Thank you for your help /bows
     

Share This Page