Stamina/Oxygen Helmet

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

    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.

RaikaS

Active Member
Apr 6, 2018
53
1
0
Hello! Im Raikas and i'll try make a space roleplay server.

I need a stamina/oxygen system. Like in one helmet can be 100% oxygen and other can have 63% oxygen. I want use NBT tags.

My code does't get any errors.

Code:
code_language.skript:
function puePuku(p: player):
  set helmet of {_p} to diamond helmet named "&3Avaruuspuvun &3&lHappikypärä"
  set chestplate of {_p} to chain chestplate named "&3Avaruuspuvun &3&lRakettireppu"
  set leggings of {_p} to iron leggings named "&3Avaruuspuvun &3&lHousut"
  set boots of {_p} to iron boots named "&3Avaruuspuvun &3&lKengät"
command /avaruuspuku:
  trigger:
    puePuku(player)

every 10 second in "world":
  loop all players:
    if {%loop-player%.number} is not set:
      set {%loop-player%.number} to 0
    if "%region at loop-player%" contains "Spawni":
      wait 1 tick
    else:
      loop-player's helmet is not diamond helmet named "&3Avaruuspuvun &3&lHappikypärä"
      damage loop-player by 1 heart
      send loop-player title "&c! VAARA !" with subtitle "&3Ei happea tai viallinen kypärä!"

I want use NBT But i dont know how.
Pls help :emoji_grinning:
 
Hello! Im Raikas and i'll try make a space roleplay server.

I need a stamina/oxygen system. Like in one helmet can be 100% oxygen and other can have 63% oxygen. I want use NBT tags.

My code does't get any errors.

Code:
code_language.skript:
function puePuku(p: player):
  set helmet of {_p} to diamond helmet named "&3Avaruuspuvun &3&lHappikypärä"
  set chestplate of {_p} to chain chestplate named "&3Avaruuspuvun &3&lRakettireppu"
  set leggings of {_p} to iron leggings named "&3Avaruuspuvun &3&lHousut"
  set boots of {_p} to iron boots named "&3Avaruuspuvun &3&lKengät"
command /avaruuspuku:
  trigger:
    puePuku(player)

every 10 second in "world":
  loop all players:
    if {%loop-player%.number} is not set:
      set {%loop-player%.number} to 0
    if "%region at loop-player%" contains "Spawni":
      wait 1 tick
    else:
      loop-player's helmet is not diamond helmet named "&3Avaruuspuvun &3&lHappikypärä"
      damage loop-player by 1 heart
      send loop-player title "&c! VAARA !" with subtitle "&3Ei happea tai viallinen kypärä!"

I want use NBT But i dont know how.
Pls help :emoji_grinning:
Why would you need NBT for this?
 
I said it on first message

"Like in one helmet can be 100% oxygen and other can have 63% oxygen. I want use NBT tags."
And those two helmets you were talking about, are they going to be the same exact item? Have the same name, the same lore and be both diamond helmets?
 
I think it's easier and more user friendly to put it in the lore, so that the player can see the percentage as well.
 
I will do it. But in not good at NBT tag's so i need help about it
If you put it in the lore, you don't have to manually change the NBT, Skript changes it for you.
 
I will do it. But in not good at NBT tag's so i need help about it
Yes, as TPGamesNL said,
If you put it in the lore, you don't have to manually change the NBT, Skript changes it for you.

Skript has the ability to work with items lores, and it sounds that you need help with them.

If you want to check an items lore in a condition, you do
code_language.skript:
if line 1 of lore of player's tool is "InsertLoreHere":
Of course, the line section changes depending on which line of the lore you're referring to.

If you want to give an item with a lore, to do it more efficientely, you'll need an addon called SkQuery. The code will look like this:
code_language.skript:
give a stick named "Name" with lore "Lore" to player

And if you don't feel like using SkQuery:
code_language.skript:
set {_item} to stick named "Lel"
set line 1 of lore of {_item} to "Wow"
give {_item} to player
 
Last edited:
Yes, as TPGamesNL said,


Skript has the ability to work with items lores, and it sounds that you need help with them.

If you want to check an items lore in a condition, you do
code_language.skript:
if line 1 of lore of player's tool is "InsertLoreHere":
Of course, the line section changes depending on which line you're referring to.

If you want to give an item with a lore, to do it more efficientely, you'll need an addon called SkQuery. The code will look like this:
code_language.skript:
give a stick named "Name" with lore "Lore" to player

And if you don't feel like using SkQuery:
code_language.skript:
set {_item} to stick named "Lel"
set line 1 of lore of {_item} to "Wow"
give {_item} to player
You can also use lore of {_item} instead of line %number% of lore of {_item}
 
Status
Not open for further replies.