Skill GUI

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

WiebeHero

Active Member
Aug 23, 2017
135
5
0
23
So i am making a skill GUI that is featuring in contact of the GUI itself the code is pasted down below ^^
Now what do i do? make it a click then run string or does anyone know anything else? (The main thing im trying to do is make it so the iron sword named 0 / 100 goes to 1 / 100)
Code:
command /skills1:
    trigger:
        open virtual chest inventory with size 3 named "&6Skills" to player
        format gui slot 0 of player with book named "&6Skill Points: 0" with lore "&7These are you're &6SKILL &7points that you||&7Can invest in custom abilities!" 
        format gui slot 10 of player with iron sword named "&6Attack Damage: 0 / 100" with lore "&7This will increase you're &6ATTACK DAMAGE &7that||&7You do to you're enemy!||||&6Attack Damage: &60%% >>> 5%%"

on inventory click:
    name of player's cursor slot is "&7Attack Damage: "
    set {_I::*} to lore of player's cursor slot split at "||"
    loop {_I::*}:
        if "%loop-value%" contains "&7Attack Damage: ":
            set {_t} to loop-index parsed as integer
            stop loop
    set {_I} to "%uncolored {_I::%{_t}%}%"
    replace every "Attack Damage: " with "" in {_I}
    replace every " " with "" in {_I}
    set {_A::*} to {_I} split at "/"
    set {_O} to {_A::1} parsed as number
    set {_P} to {_A::2} parsed as number
    add 1 to {_o}
 
So yes i did it thank you! But the problem im stumbling up upon is this. It doesnt change anything what do i have to do?
Code:
command /skills:
    trigger:
        create a gui with virtual chest with 3 rows named "&6Skills":
            make next gui with book named "&6Skill Points: 0" with lore "&7These are you're &6SKILL &7points that you||&7Can invest in custom abilities!"
            make next gui with iron sword named "&6Attack Damage" with lore "&7This will increase you're &6ATTACK DAMAGE &7that||&7You do to you're enemy!||&6Attack Damage Level: 0 / 100||||&6Attack Damage: &60%% >>> 5%%":
                if gui-click-action is left mouse or right mouse button:
                    lore of clicked item contains "&6Attack Damage Level: "
                    set {_I::*} to lore of clicked item split at "||"
                    loop {_I::*}:
                        if "%loop-value%" contains "&6Attack Damage Level: ":
                            set {_t} to loop-index parsed as integer
                            stop loop
                    set {_I} to "%uncolored {_I::%{_t}%}%"
                    replace every "Attack Damage Level: " with "" in {_I}
                    replace every " " with "" in {_I}
                    set {_A::*} to {_I} split at "/"
                    set {_O} to {_A::1} parsed as number
                    set {_P} to {_A::2} parsed as number
                    add 1 to {_o}
        open last gui to player
 
So yes i did it thank you! But the problem im stumbling up upon is this. It doesnt change anything what do i have to do?
Code:
command /skills:
    trigger:
        create a gui with virtual chest with 3 rows named "&6Skills":
            make next gui with book named "&6Skill Points: 0" with lore "&7These are you're &6SKILL &7points that you||&7Can invest in custom abilities!"
            make next gui with iron sword named "&6Attack Damage" with lore "&7This will increase you're &6ATTACK DAMAGE &7that||&7You do to you're enemy!||&6Attack Damage Level: 0 / 100||||&6Attack Damage: &60%% >>> 5%%":
                if gui-click-action is left mouse or right mouse button:
                    lore of clicked item contains "&6Attack Damage Level: "
                    set {_I::*} to lore of clicked item split at "||"
                    loop {_I::*}:
                        if "%loop-value%" contains "&6Attack Damage Level: ":
                            set {_t} to loop-index parsed as integer
                            stop loop
                    set {_I} to "%uncolored {_I::%{_t}%}%"
                    replace every "Attack Damage Level: " with "" in {_I}
                    replace every " " with "" in {_I}
                    set {_A::*} to {_I} split at "/"
                    set {_O} to {_A::1} parsed as number
                    set {_P} to {_A::2} parsed as number
                    add 1 to {_o}
        open last gui to player
I'm not 100% sure what you mean by "what do I do next?". I mean it looks like you need to add a condition that checks a variable that stores their skill points. and if they have points to spend (ie: {point-variable} > 0) then remake the slot with the updated name and lore. But that variable can't be local or you will always end up with 1/100 because it doesn't save the value as a local variable. to remake a slot you just set the clot number again like this
code_language.skript:
                    add 1 to {_o}
                    make gui slot 2 with iron sword named "&6Attack Damage" with lore "&7This will increase you're &6ATTACK DAMAGE &7that||&7You do to you're enemy!||&6Attack Damage Level: %{_o}% / 100||||&6Attack Damage: &60%% >>> 5%%":
the %{_o}% / 100|| portion will make it go up when clicked, but again, the value of %{_o}% will be 0 + 1 everytime it runs right now because it's local.
Does that help a bit?
 
Yes it did thank you!
But the good thing is i fugered it out on my own! But there are still 2 problems left il post them here now!
1. This has to individual to each player how would i make it like that?
2. How do i track it with every opening for example it is 1 / 100 and if i close and reopen it it will still say 0 / 100 how do i change it to be 0 / 100?
3. Now about skill points i want to make it when you level up it adds 2 to {_a} but it doesnt really do that. Do you know how?
And thanks for lots of replies ^^
Code i have right now:
Code:
command /skills:
    trigger:
        create a gui with virtual chest with 3 rows named "&6Skills":
            make gui 0 with book named "&6Skill Points" with lore "&7These are you're &6SKILL &7points that you||&7Can invest in custom abilities!||&6Skill Points: 0":
                lore of gui-clicked-item contains "&6Skill Points: "
                set {_K::*} to lore of gui-clicked-item split at "||"
                loop {_K::*}:
                    if "%loop-value%" contains "&6Skill Points: ":
                        set {_t} to loop-index parsed as integer
                        stop loop
                set {_K} to "%uncolored {_k::%{_e}%}%"
                replace every "Skill Points: " with "" in {_K}
                replace every " " with "" in {_K}
                set {_A} to {_C::1} parsed as number
                set the {_k}th line of lore of gui-clicked-item to "&6Skill Points: %{_a}%"
            make gui 1 with iron sword named "&6Attack Damage" with lore "&7This will increase you're &6ATTACK DAMAGE &7that||&7You do to you're enemy!||&6Attack Damage Level: 0 / 100||||&6Attack Damage: &60%% / 500%%":
                if gui-click-action is left mouse or right mouse button:
                    lore of gui-clicked-item contains "&6Attack Damage Level: "
                    set {_I::*} to lore of gui-clicked-item split at "||"
                    loop {_I::*}:
                        if "%loop-value%" contains "&6Attack Damage Level: ":
                            set {_t} to loop-index parsed as integer
                            stop loop
                    set {_I} to "%uncolored {_I::%{_t}%}%"
                    replace every "Attack Damage Level: " with "" in {_I}
                    replace every " " with "" in {_I}
                    set {_A::*} to {_I} split at "/"
                    set {_O} to {_A::1} parsed as number
                    add 1 to {_o}
                    set the {_t}th line of lore of gui-clicked-item to "&6Attack Damage Level: %{_o}% / 100"
                    lore of gui-clicked-item contains "&6Attack Damage: "
                    set {_J::*} to lore of gui-clicked-item split at "||"
                    loop {_J::*}:
                        if "%loop-value%" contains "&6Attack Damage: ":
                            set {_l} to loop-index parsed as integer
                            stop loop
                    set {_J} to "%uncolored {_J::%{_l}%}%"
                    replace every "Attack Damage: " with "" in {_J}
                    replace every " " with "" in {_J}
                    set {_B::*} to {_J} split at "/"
                    set {_M} to {_B::1} parsed as number
                    add 5 to {_m}
                    set the {_l}th line of lore of gui-clicked-item to "&6Attack Damage: %{_m}% / 500 %%"
        open last gui to player
on level change:
    add 2 to {_a}
 
to make it save the progress you need the variable to be not-local(no underscore). Local variables delete themselves when the code is not running, and reinvent themselves when you run the code.
To make it player specific, add a the player name to the variable that stores your skills. You can do that when the on level change event happens.
code_language.skript:
on level change:
    add 2 to {%player%.SkillVariable::*}
 
Status
Not open for further replies.