a mana system with a subtitle

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

Grandfish

Member
Feb 8, 2021
13
0
1
22
hello

so im creating an rpg/dungeons server and was wondering how to make a mana system. wut i did at first was use a scoreboard, with commands, but there were no good places to display it. So i started looking on the forums for mana systems, but there were none.

so basically what i want is like a mana subtitle, and when u right click with certain items is lowers the thing. The mana subtitle would also slowly regenerate. Certain armor pieces would buff the mana thing.

um i hope for u to be done by like idk the end of march 2021?!?!??

im on a 1.16 minehut server
[doublepost=1615058390,1614361738][/doublepost]bump
 
I made kind of what you were looking for along with an aspect of the end to try it with! The player defaults with 250 mana but I'll keep working on it and updating you. IDK what addons it needs just search up 'Skript actionbar addon'. Anyway here is the code (Its pretty simple)

Code:
on join:
    set {mana.%player%} to 250

every 10 ticks:
    loop all players:
        send action bar "&b%{mana.%loop-player%}%&b/250" to loop-player

every 50 ticks:
    loop all players:
        if {mana.%loop-player%} is greater than 250:
            stop
        else:
            add 25 to {mana.%loop-player%}

on rightclick with diamond sword:
    name of player's tool is "&9Aspect of the End":
        if {mana.%player%} is greater than 49:
            add -50 to {mana.%player%}
            send "&aUsed &6Instant Transmission&a! &b(-50 Mana)" to player
            set {_aote.use.teleport.block} to block 8 in front of player
            teleport player above {_aote.use.teleport.block}
        else:
            send "&cYou don't have enough mana to do that!" to player
[doublepost=1616051904,1616051864][/doublepost]There are also a couple of bugs which is where sometimes your mana will go 25 mana above the limit.
 
Thank you!!! i will try this when i can!!!!
[doublepost=1616350484,1616079410][/doublepost]so ive tweaked the skript a little, so it is now a system that is like this:
Code:
every 10 ticks:
    loop all players:
        send action bar "&b%{mana.%loop-player%}%&b/%{maxmana.%loop-player%}% Mana" to loop-player
 
every 40 ticks:
    loop all players:
        if {mana.%loop-player%} is greater than or equal to {maxmana.%loop-player%}:
            stop
        else:
            add 25 to {mana.%loop-player%}
 
on rightclick with diamond sword:
    name of player's tool is "&9Aspect of the End":
        if {mana.%player%} is greater than 49:
            add -50 to {mana.%player%}
            send "&aUsed &6Instant Transmission&a! &b(-50 Mana)" to player
            set {_aote.use.teleport.block} to block 8 in front of player
            teleport player above {_aote.use.teleport.block}
        else:
            send "&cYou don't have enough mana to do that!" to player

on join:
    set {maxmana.%player%} to 100

command /reset:
    trigger:
        set {mana.%player%} to 100
        set {maxmana.%player%} to 100
, can you think of a method of fixing the bug where it goes above the limit?
 
Code:
every 10 ticks:
    loop all players:
        send action bar "&b%{mana.%loop-player%}%&b/%{maxmana.%loop-player%}% Mana" to loop-player
 
every 20 ticks:
    loop all players:
        if {mana.%loop-player%} equal to {maxmana.%loop-player%}:
            stop
        else:
            add 10 to {mana.%loop-player%}
 
on rightclick with diamond sword:
    name of player's tool is "&9Aspect of the End":
        if {mana.%player%} is greater than 49:
            add -50 to {mana.%player%}
            send "&aUsed &6Instant Transmission&a! &b(-50 Mana)" to player
            set {_aote.use.teleport.block} to block 8 in front of player
            teleport player above {_aote.use.teleport.block}
        else:
            send "&cYou don't have enough mana to do that!" to player
 
on join:
    set {maxmana.%player%} to 100
 
command /manareset:
    trigger:
        set {mana.%player%} to 100
        set {maxmana.%player%} to 100





^ This might work
 
Code:
every 2 ticks:
    loop all players:
        send action bar "&b%{mana.%loop-player%}%&b/%{maxmana.%loop-player%}% Mana" to loop-player
 
every 20 ticks:
    loop all players:
        if {mana.%loop-player%} is greater than {maxmana.%loop-player%}:
            set {mana.%loop-player%} to {maxmana.%loop-player%}
            stop
        else if {mana.%loop-player%} is smaller than {maxmana.%loop-player%}:
            
            add 5 to {mana.%loop-player%}
 
on rightclick with diamond sword:
    if {mana.%player%} is greater than 49:
        add -50 to {mana.%player%}
        send "&aUsed &6Instant Transmission&a! &b(-50 Mana)" to player
        set {_aote.use.teleport.block} to block 8 in front of player
        teleport player above {_aote.use.teleport.block}
    else:
        send "&cYou don't have enough mana to do that!" to player
 
on join:
    set {maxmana.%player%} to 100
 
command /manareset:
    trigger:
        set {mana.%player%} to 100
        set {maxmana.%player%} to 100
*Slightly modified.

The above code did not restore the Mana of other players when their Mana was at Max.
This may have worked fine in past versions, but it did not work correctly in the current version (minecraft 1.18.x skript 2.6.2), so I'm replying to a thread that is over a year old.
There may be a better way to write this, but I'm a newbie, so please forgive me.
Also, I'm using DeepL.