#help having trouble
1 messages · Page 1 of 1 (latest)
i fixed it but bugged it again ehh mind helping with that
i cant help you if you dont tell me what issue(s) you have
oh wait 2 sec
my mistake
Mind helping me with this script ;-;
loop all players:
set {bubbles::%loop-player's uuid%} to 60
every tick:
loop all players:
if player is touching water:
add 1 to {bubbles::%loop-player's uuid%}
every 20 ticks: # This runs every 1 second
loop all players:
if player is touching water:
if {bubbles::%loop-player's uuid%} > 0:
remove 1 from {bubbles::%loop-player's uuid%}
if {bubbles::%loop-player's uuid%} <= 0:
# Execute actions when bubbles run out (instant death example)
kill loop-player # Kills the player instantly
send "&cYou drowned!" to loop-player
every 20 ticks:
loop all players:
send action bar "〘&aOxygen %{bubbles::%loop-player's uuid%}.s:bubbles:&8〙" to loop-player
got my friend to fix this
but it mesed up once i implemented touching water
and the action bar at the bottom
If im struggling with this cant wait to try the mining
Also forgot to say but thank you for your time
- Stay away from looping players in periodicals, they're needlessly inefficient. In this case, its probably best to use on join and a while loop.
- there's an
on swim toggle:event, but that requires a player to be sprint-swimming, not just standing/walking in water
- no need to set the
bubblesvariable on load. Skript will treat non-set variables as0, so you can still add and subtract. - These variables don't need to be saved when the player is not on the server, so they should be a metadata tag (or memory variable)
- I think your logic is a little messed up here, you add 1 to the bubbles every tick, and then remove 1 every 20 ticks. Meaning they will always get +19, and will never drown.
- also, what's wrong with the normal bubble meter?
- for the action bar, you forgot a
%
thanks
Cant seem to fix it I've tried for the past 10 minutes could you rewrite the script for me if im asking for too much I'm sorry
I'm new to script so I'm having problems finding out whats what
like I'm not good at explaining but i cant figuere out what stuff is called like forexample idk how to register if a player is touching water is it on touch or if player is touching and so on
(type of block at player's head location) = water will check if their head is in a water block
thanks
i fixed the script it works now im now working on depth now the problem is it wont recognize the first line all others work
trigger:
set {_coord1} to arg-1 # First set of coordinates
set {_coord2} to arg-2 # Second set of coordinates
set {_depth} to arg-3 # Depth level
# Parse coordinates
set {_x1} to {_coord1::"%-10%" split " " as number}
set {_y1} to {_coord1::"%-10%" split " " as number}
set {_z1} to {_coord1::"%-10%" split " " as number}
set {_x2} to {_coord2::"%-10%" split " " as number}
set {_y2} to {_coord2::"%-10%" split " " as number}
set {_z2} to {_coord2::"%-10%" split " " as number}
loop blocks within {_x1}, {_y1}, {_z1}, {_x2}, {_y2}, {_z2}:
set {_depthRegion} to loop-block
set {_depthRegion} to "depth" with loop-block
send "cordinate```
i dont think you can use location as an argument type
i guess you'll have to input each coord separately
ah
also i have a pretty simple problem but i dont know how to fix it
my vanilla opxygen bar is going down too so i die from that before my other one is done how do i just make my normal oxygen bar not go down at all
if {bubbles.%uuid of event-player%} is not set:
set {bubbles.%uuid of event-player%} to 60 # Initialize bubbles to 60 for new players (representing 60 seconds)
set {depth.%uuid of event-player%} to 0 # Initialize depth to 0 for new players
on quit:
delete {bubbles.%uuid of event-player%} # Clean up bubbles data when player quits
delete {depth.%uuid of event-player%} # Clean up depth data when player quits
every 20 ticks: # Run every second
loop all players:
set {_headLocation} to location of loop-player's head
set {_headBlock} to type of block at {_headLocation}
if {_headBlock} is water:
remove 1 from {bubbles.%uuid of loop-player%} # Remove 1 bubble per second when head is in water
if {bubbles.%uuid of loop-player%} < 0:
set {bubbles.%uuid of loop-player%} to 0 # Ensure bubbles don't go below 0
add 1 to {depth.%uuid of loop-player%} # Increase depth by 1 when head is in water
else:
add 5 to {bubbles.%uuid of loop-player%} # Add 5 bubbles per second when head is not in water
if {bubbles.%uuid of loop-player%} > 60:
set {bubbles.%uuid of loop-player%} to 60 # Cap bubbles at 60
every 20 ticks:
loop all players:
if {bubbles.%uuid of loop-player%} <= 0:
kill loop-player # Kills the player instantly when out of bubbles
every 20 ticks:
loop all players:
send action bar "&8〘&aOxygen %{bubbles.%uuid of loop-player%}%.s:bubbles:&8〙 | Depth: %{depth.%uuid of loop-player%}%.2f m &8〙" to loop-player
use https://skripthub.net/docs/?id=954
As i said earlier, you can just use this expression to set the vanilla one, there's no need for custom variables and stuff