1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Give a random amount of experience points to the player

Discussion in 'Skript' started by daknus, Jan 20, 2018.

Thread Status:
Not open for further replies.
  1. daknus

    daknus Member

    Joined:
    Jan 17, 2018
    Messages:
    3
    Likes Received:
    0
    Hello,

    I am trying to give a random amount of experience points to the player using this:

    Code (Skript):
    1.  
    2. give a random number between {_emin} and {_emax} exp to the player
    3.  
    but it just returns this:

    Code (Skript):
    1.  
    2. ('a random number between {_emin}' and '{_emax} exp') can't be added to a player because the former is neither an item type, an inventory nor an experience point
    3.  
    How do I do this properly?
     
  2. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    Try this, this is using the tuske expression
    Code (Skript):
    1. command /exp:
    2.     trigger:
    3.         set {_n} to a random number between 1000 and 2000
    4.         add {_n} to xp of player
     
  3. YoshYz

    YoshYz Well-Known Member

    Joined:
    Jan 28, 2017
    Messages:
    694
    Likes Received:
    82
    Maybe use this way if you don't want to use or add tuske on your server:
    Code (Skript):
    1. command /orb:
    2.     trigger:
    3.         make console execute command "/xp %random integer between 1 and 1000% %player%"
     
    • Like Like x 1
  4. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    This is vanilla skript
     
  5. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,236
    Likes Received:
    176
    Medals:
    I don't really get why people avoid using addons, it doesn't hurt anyone and TuSKe is a pretty useful addon, oh well.

    The problem was that you can't use expressions in type values, you'll have to parse it as experience for it to work.

    Skript doesn't have a xp expression, it only has level and level progress.
     
  6. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    the docs had this example marked as Tuske
     
Thread Status:
Not open for further replies.

Share This Page

Loading...