Generating a random number and then using it

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JackyBoy

Member
Feb 4, 2017
104
1
18
21
Alright so, I am trying to make a skript where I can do a command like /armor and it will send the player a random number. However can it also send the same random code in /ac aswell
 
code_language.skript:
command /armor:
    trigger:
        set {randomNumber::%player%} to random number between 0 and 10

command /ac:
    trigger:
        send "%{randomNumber::%player%}%"
 
code_language.skript:
command /armor:
    trigger:
        set {randomNumber::%player%} to random number between 0 and 10

command /ac:
    trigger:
        send "%{randomNumber::%player%}%"
Thanks, how do I make the broadcast the same random number as well as send it to the player who did the command (at the same time) but then the next time they do the command its a different number
 
it will generate a new number and set it to the variable every time they do the command
 
Maybe something like this...?


code_language.skript:
command /armor:
    trigger:
        set {randomNumber::%player%} to random number between 0 and 10
        send "%{randomNumber::%player%}%" to player
 
command /ac:
    trigger:
        send "%{randomNumber::%player%}%" to player

As Donut said, everytime the player does /armor, it will change the number. If you want, it a little simpler, you can try this:

code_language.skript:
command /armor:
    trigger:
        set {armor.%player%} to random number between 0 and 10
        send "%{armor.%player%}%" to player

command /ac:
    trigger:
        send "%{armor.%player%}%" to player
 
Status
Not open for further replies.