Solved Changing fullness of exp bar

  • 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!

Fladsaw

Member
Jul 18, 2022
31
0
6
21
Is there a way to increase or decrease the fullness of the exp bar? I want only the bar to change and move, not the player's level."
 
Is there a way to increase or decrease the fullness of the exp bar? I want only the bar to change and move, not the player's level."
Code:
on level change:
    set player's level to {%loop-player%.rpg.level}
there
 
Code:
on level change:
    set player's level to {%loop-player%.rpg.level}
there

No, I didn't mean that. I want an effect that goes like:

Code:
command /test:
    trigger:
        give 2 experience points to player #to fill the bar slightly
 
No, I didn't mean that. I want an effect that goes like:

Code:
command /test:
    trigger:
        give 2 experience points to player #to fill the bar slightly
Instead of experience points, just use exp. For example:

Code:
trigger:
    give [number] exp to player

Here is a more complicated example:

Code:
function exp(p: player):
    set {_xp} to arg-1
    give {_xp} exp to {_p}

command /give-exp <number>:
    trigger:
        exp(player)

Hope this helps!

This code is not tested.
 
Last edited:
Instead of experience points, just use exp. For example:

Code:
trigger:
    give [number] exp to player

Here is a more complicated example:

Code:
function exp():
    set {_xp} to %arg-1% parsed as number
    give {_xp} exp to player

command /give-exp <number>:
    trigger:
        exp()

Hope this helps!

This code is not tested.

Wow, I didn't know I was this close. But now I have another question. When I give player 1 exp, it fills the bar more than I want. I tried to use 0.5 instead of 1 but it didn't work. Do you have any ideas?
 
Wow, I didn't know I was this close. But now I have another question. When I give player 1 exp, it fills the bar more than I want. I tried to use 0.5 instead of 1 but it didn't work. Do you have any ideas?
How about using the word integer to describe arg-1 instead of number ?

Oh shoot, my complex example was wrong. Lmao. Let me edit my post rq.
 
Last edited:
How about using the word integer to describe arg-1 instead of number ?

Oh shoot, my complex example was wrong. Lmao. Let me edit my post rq.
So sorry to answer this late. I couldn't have a chance to write back. And no, unfortunately it doesn't work as well.
 
So sorry to answer this late. I couldn't have a chance to write back. And no, unfortunately it doesn't work as well.
Oof. Then try (1/2) . I'm pretty sure this should work. If not, then I might have another solution.
 
Oof. Then try (1/2) . I'm pretty sure this should work. If not, then I might have another solution.

It doesn't work either. So far our code is:
Code:
command /give-exp:
    trigger:
        set {_xp} to 1/2
        give {_xp} of exp to player

And our error is:
Code:
{_xp} of 1-experience orb can't be added to a player because the former is neither an item type, an inventory nor an experience point
 
It doesn't work either. So far our code is:
Code:
command /give-exp:
    trigger:
        set {_xp} to 1/2
        give {_xp} of exp to player

And our error is:
Code:
{_xp} of 1-experience orb can't be added to a player because the former is neither an item type, an inventory nor an experience point
I mean to put it in parenthesis-

Try give {_xp} exp to player

And the 3rd line would look like this:

set {_xp} to (1/2)
 
I mean to put it in parenthesis-

Try give {_xp} exp to player

And the 3rd line would look like this:

set {_xp} to (1/2)
Oh I'm sorry. But no this doesn't work. And I don't think the problem here is "(1/2)" because it also doesn't work when I put "1" instead of "(1/2)". And the error is:

Code:
'{_xp} exp' can't be added to a player because the former is neither an item type, an inventory nor an experience point
 
Oh I'm sorry. But no this doesn't work. And I don't think the problem here is "(1/2)" because it also doesn't work when I put "1" instead of "(1/2)". And the error is:

Code:
'{_xp} exp' can't be added to a player because the former is neither an item type, an inventory nor an experience point
Hmm......

try this:

Code:
function exp(n1: number, n2: number = 1) :: number:
    return ({_n1} / {_n2})

give exp(1, 2) exp to player
 
Oh I'm sorry. But no this doesn't work. And I don't think the problem here is "(1/2)" because it also doesn't work when I put "1" instead of "(1/2)". And the error is:

Code:
'{_xp} exp' can't be added to a player because the former is neither an item type, an inventory nor an experience point
I don't think it knows that it is a number. with the function, it's already parsed as a number so it should recognize it. Also, this code works with regular numbers too. For example:

Code:
give exp(5) exp to player

I don't have to fill out the second number because on default it's set to 1.
 
I don't think it knows that it is a number. with the function, it's already parsed as a number so it should recognize it. Also, this code works with regular numbers too. For example:

Code:
give exp(5) exp to player

I don't have to fill out the second number because on default it's set to 1.
You are trying to give a player half an experience point, you can’t. What you can do is:
Code:
set level progress of player to 0.5