PixelTrainerYT Posted July 12, 2021 Share Posted July 12, 2021 so i decided to make this: command sethealth <text> <num> <text>: trigger: set {%arg 3% %arg 1%} to arg 2 loop {healthlist::*}: if loop-value is arg 1: remove loop-value from {healthlist::*} add arg 1 to {healthlist::*} every tick: Loop all players: set loop-player's max health to 10 loop {healthlist::*}: add {%uuid of loop-player% %loop-value-2%} to loop-player's max health This allows me to have multiple skripts that will change the players health without any of them conflicting eachother theres probably a better way to achieve this and this might have a few issues but this is all I have for now if you can see this, you have vision Link to comment Share on other sites More sharing options...
StarBunnie Posted July 12, 2021 Share Posted July 12, 2021 3 minutes ago, PixelTrainerYT said: so i decided to make this: command sethealth <text> <num> <text>: trigger: set {%arg 3% %arg 1%} to arg 2 loop {healthlist::*}: if loop-value is arg 1: remove loop-value from {healthlist::*} add arg 1 to {healthlist::*} every tick: Loop all players: set loop-player's max health to 10 loop {healthlist::*}: add {%uuid of loop-player% %loop-value-2%} to loop-player's max health This allows me to have multiple skripts that will change the players health without any of them conflicting eachother theres probably a better way to achieve this and this might have a few issues but this is all I have for now Personally I'd be careful with "every tick:" because it can lag the server a lot. 1 Tick is 1/20th of a second which means you're looping every player on your server about 20 times a second if you have 10 players on that would already be 200 per one second just fyi. Feel free to add me on discord if you: need help with plugins need help with skripts need to vent about something >[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]< Link to comment Share on other sites More sharing options...
PixelTrainerYT Posted July 12, 2021 Author Share Posted July 12, 2021 14 hours ago, StarBunnie said: Personally I'd be careful with "every tick:" because it can lag the server a lot. 1 Tick is 1/20th of a second which means you're looping every player on your server about 20 times a second if you have 10 players on that would already be 200 per one second just fyi. so would it be better every second? if you can see this, you have vision Link to comment Share on other sites More sharing options...
StarBunnie Posted July 12, 2021 Share Posted July 12, 2021 (edited) 6 minutes ago, PixelTrainerYT said: so would it be better every second? It would definitely take less performance you could also use something called a while loop on join: while player is online: set player's max health to 10 add {health::%player's uuid%} to player's max health wait 1 second command /health [<offlineplayer>] [<integer>]: trigger: player has permission "health.set": if arg 1 is set: if arg 2 is set: set {health::%arg 1's uuid%} to arg 2 With a while loop it's very important to add a wait otherwise it will crash your server. Edited July 12, 2021 by StarBunnie Feel free to add me on discord if you: need help with plugins need help with skripts need to vent about something >[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]< Link to comment Share on other sites More sharing options...
NotToxic___ Posted July 15, 2021 Share Posted July 15, 2021 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now