Solved I Think It's Very Hard

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

Yaşarhan

Active Member
May 16, 2020
87
6
8
23
Turkey Istanbul
I trying to give health unless it moves.

This my code:
There is no error in this command but sometimes it gives heal, sometimes it does not give,
sometimes it is delayed.
Code:
on any move:
    wait 1 seconds
    set {_location} to location of player
    wait 3 seconds
    set {_check} to location of player
    if {_check} = {_location}:
        wait 5 seconds
        send "Healing" to player
        apply regeneration 5 to player for 1 seconds
 
Try that:
Code:
on any move:
    execute console command "effect clear %player% minecraft:regeneration"
    set {_loc} to location of player
    set {count::%player%} to 0
    loop 5 times:
        wait 1 second
        add 1 to {count::%player%}
        if {count::%player%} >= 5:
            if player's location = {_loc}:
                send "&cHealing..." to player
                apply regeneration 5 to player for 999 days
If any bugs happen, reply me; I would like to continue helping you
 
  • Like
Reactions: Yaşarhan
Try that:
Code:
on any move:
    execute console command "effect clear %player% minecraft:regeneration"
    set {_loc} to location of player
    set {count::%player%} to 0
    loop 5 times:
        wait 1 second
        add 1 to {count::%player%}
        if {count::%player%} >= 5:
            if player's location = {_loc}:
                send "&cHealing..." to player
                apply regeneration 5 to player for 999 days
If any bugs happen, reply me; I would like to continue helping you
You should use this instead of the command
Code:
remove regeneration from the player
 
Try that:
Code:
on any move:
    execute console command "effect clear %player% minecraft:regeneration"
    set {_loc} to location of player
    set {count::%player%} to 0
    loop 5 times:
        wait 1 second
        add 1 to {count::%player%}
        if {count::%player%} >= 5:
            if player's location = {_loc}:
                send "&cHealing..." to player
                apply regeneration 5 to player for 999 days
If any bugs happen, reply me; I would like to continue helping you

Thanks sir, nice you want to help, but it works inconsistently, and when the "on any move event" is used, even if the health of the player is full, it gives health.
And so I override my first code. :emoji_smile:

If we can check that the health is full, we can also do it using the "on any move" event.

This is my alternative code for now:
Code:
command /sit:
    trigger:
        set {_location} to location of player
        send "&6[SYSTEM] You sat." to player
        loop 50 times:
            set {_check} to location of player
            if {_check} = {_location}:
                set {stay.%player%} to true
                wait 7 seconds
                if {stay.%player%} is true:
                    apply regeneration 5 to player for 1 seconds
                else:
                    stop
            else:
                set {stay.%player%} to false
                stop

Provides health every 7 seconds unless it moves.
 
You can use the following to check if a player has full health:
Code:
if health of player is 10:
 
  • Like
Reactions: Yaşarhan
Actually the seating system in mmorpg games i want to make.
However, I would like to do this some time after being immobile without entering commands.
[doublepost=1590519461,1590519431][/doublepost]
You can use the following to check if a player has full health:
Code:
if health of player is 10:

May be more than 10.
 
max health is 10. You can read the docs: https://docs.skunity.com/syntax/search/id:3982

gvOs6R.png

[doublepost=1590520033,1590519983][/doublepost]Does it work in this way?
[doublepost=1590520253][/doublepost]I tried, not working.
 
I'm not sure what you're trying to do with the health of the player.
 
Player should give a little bit of health to a player in 10 seconds from when he's not moving.
Must repeat giving health every 10 seconds.
Should stop when health is full or the loop should stop if it moves.

This will gradually fill her health.
 
I can't make it right now because I have an exam I need to do

EDIT:
Try this

Code:
on any move:
    remove regeneration from the player
    if health of player is not max health of player:
        set {_loc} to location of player
        set {count::%player%} to 0
        loop 5 times:
            wait 1 second
            add 1 to {count::%player%}
            if {count::%player%} >= 5:
                if player's location = {_loc}:
                    send "&cHealing..." to player
                    apply regeneration 5 to player for 999 days
 
Last edited:
  • Like
Reactions: Yaşarhan
Did you see the edit of my post before?

I was opening another topic, I see now, I testing now.
[doublepost=1590527847,1590526334][/doublepost]
I can't make it right now because I have an exam I need to do

EDIT:
Try this

Code:
on any move:
    remove regeneration from the player
    if health of player is not max health of player:
        set {_loc} to location of player
        set {count::%player%} to 0
        loop 5 times:
            wait 1 second
            add 1 to {count::%player%}
            if {count::%player%} >= 5:
                if player's location = {_loc}:
                    send "&cHealing..." to player
                    apply regeneration 5 to player for 999 days

Successful, but deleting the regeneration will not work because I have a script like this;
Part of the script:

Code:
#First Wand       
on right click on player with a wooden shovel:
    if {healer.%player%} is true:
        if player's group is "BluePlusPlayer" or "blueplayer":
            if group of clicked player is "BluePlusPlayer" or "blueplayer":
                if {healled.%player%} is false:
                    set {healled.%player%} to true
                    apply regeneration 5 to clicked player for 1 seconds
                    wait 35 seconds
                    set {healled.%player%} to false
                    send "&a[SYSTEM] Example succesful message." to player
                else:
                    stop
            else:
                stop
        else:
            if group of clicked player is "RedPlusPlayer" or "redplayer":
                if {healled.%player%} is false:
                    set {healled.%player%} to true
                    apply regeneration 5 to clicked player for 1 seconds
                    wait 35 seconds
                    set {healled.%player%} to false
                    send "&a[SYSTEM] Example succesful message." to player
                else:
                    stop
            else:
                stop
    else:
        send "&c&l[SYSTEM] Example problem message." to player
        
on damage:
    if attacker's tool is wooden shovel:
        if {healer.%attacker%} is true:
            if group of attacker is "BluePlusPlayer" or "blueplayer":
                if group of victim is "BluePlusPlayer" or "blueplayer":
                    if {boosted.%attacker%} is false:
                        set {boosted.%attacker%} to true
                        apply health boost 2 to victim for 1 minutes
                        apply regeneration 4 to victim for 3 seconds
                        wait 5 minutes
                        set {boosted.%attacker%} to false
                        send "&a[SYSTEM] Example succesful message." to attacker
                    else:
                        stop
                else:
                    stop
            else:
                if group of victim is "RedPlusPlayer" or "redplayer":
                    if {boosted.%attacker%} is false:
                        set {boosted.%attacker%} to true
                        apply health boost 2 to victim for 1 minutes
                        apply regeneration 4 to victim for 3 seconds
                        wait 5 minutes
                        set {boosted.%attacker%} to false
                        send "&a[SYSTEM] Example succesful message." to attacker" to attacker
                    else:
                        stop
                else:
                    stop
        else:
            send "&c&l[SYSTEM] Example problem message." to attacker
#First Wand
[doublepost=1590528009][/doublepost]Frankly, I want to give health again in 10 seconds.

Regeneration: apply regeneration 5 to player for 1 seconds
If regeneration is given in this way, piecemeal health will be filled and should be 10 seconds between them.
[doublepost=1590528057][/doublepost]I tried it on your code but it didn't react.
 
Maybe this works?
Code:
on any move:
    if {healloc::%uuid of player%} is location of player:
        stop
    remove regeneration from the player
    if health of player is not max health of player:
        set {healloc::%uuid of player%} to location of player
        set {count::%uuid of player%} to 0
        loop 5 times:
            wait 1 second
            add 1 to {count::%uuid of player%}
            if {count::%uuid of player%} >= 5:
                while player's location is {healloc::%uuid of player%}:
                    send "&cHealing..." to player
                    apply regeneration 5 to player for 1 second
                    wait 1 second
                delete {healloc::%uuid of player%}

I can't test the code myself:emoji_slight_smile:
 
  • Like
Reactions: Yaşarhan
Maybe this works?
Code:
on any move:
    if {healloc::%uuid of player%} is location of player:
        stop
    remove regeneration from the player
    if health of player is not max health of player:
        set {healloc::%uuid of player%} to location of player
        set {count::%uuid of player%} to 0
        loop 5 times:
            wait 1 second
            add 1 to {count::%uuid of player%}
            if {count::%uuid of player%} >= 5:
                while player's location is {healloc::%uuid of player%}:
                    send "&cHealing..." to player
                    apply regeneration 5 to player for 1 second
                    wait 1 second
                delete {healloc::%uuid of player%}

I can't test the code myself:emoji_slight_smile:

I can not say that the problem has been solved, but I have used a few things from their code, thanks.
 
Status
Not open for further replies.