Check if player is near a block

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

aescraft

Well-Known Member
Mar 1, 2017
295
13
0
36
Is it possible with skript?
Something like "if player is 1 block from a furnace, reduce 1 heart per second and send a message about overheating". Something like that.

Thanks!
 
Is it possible with skript?
Something like "if player is 1 block from a furnace, reduce 1 heart per second and send a message about overheating". Something like that.

Thanks!

code_language.skript:
on join:
    wait 1 tick
    while player is alive:
        loop all blocks in radius 1 around the player:
            if loop-block is a furnace:
                damage player by 1.0
                message "Put here your message."
        wait 1 second
 
Just saying that instead of loop the blocks you could do the following:
code_language.skript:
if blocks in radius 1 of player contains furnace:
    #do stuff
[doublepost=1489212770,1489200202][/doublepost]

@aescraft I don't know why you marked my post as best answer if the guy above me posted the solution and I just did a recommendation for the code that him actually did.
 
So much thanks for the ideas, but I could not make it work.

I am really looking to make a modification for a spigot plugin. The plugin makes the player sit down. I want to have some particles and some potion effects when the player is next to a brewing stand (simulating a bong to get high lol) and giving nausea and spawning particles.

But the loop did not worked for me :emoji_disappointed_relieved::emoji_disappointed:

Any ideas?
 
So much thanks for the ideas, but I could not make it work.

I am really looking to make a modification for a spigot plugin. The plugin makes the player sit down. I want to have some particles and some potion effects when the player is next to a brewing stand (simulating a bong to get high lol) and giving nausea and spawning particles.

But the loop did not worked for me :emoji_disappointed_relieved::emoji_disappointed:

Any ideas?

code_language.skript:
on join:
    wait 1 tick
    while player is alive:
        if blocks in radius 1 of player contains Brewing Stand:
            apply nausea 2 to the player for 1 second
        wait 1 second

You need to do the particles by yourself , i can't know what type of them you want on it.
 
  • Like
Reactions: aescraft
code_language.skript:
on join:
    wait 1 tick
    while player is alive:
        if blocks in radius 1 of player contains Brewing Stand:
            apply nausea 2 to the player for 1 second
        wait 1 second

You need to do the particles by yourself , i can't know what type of them you want on it.
I want to make this to be triggered by a command, not by only walking into a brewing stand.
This is what I tough:

code_language.skript:
command /sitdown:
  description: sit down and relax
  executable by: players
  trigger:
    make player execute command "/sit"
    wait 1 second
    if blocks in radius 3 of player contains Brewing Stand:
      wait 5 seconds
      apply nausea 1 to the %player% for 120 seconds
      show 10 "largesmoke" particles at location of %player% for player offset by 0.4, 0.7, 0.4
    if blocks in radius 3 of player isn't Brewing Stand:
      stop

But its not working. The "make player execute command "/sit" part is working, but the rest isn't.

I also tried this:
code_language.skript:
command /sitdown:
  description: sentar
  executable by: players
  trigger:
    make player execute command "/sit"
    if blocks in radius 3 of player contains Brewing Stand:
      broadcast "MESSAGE TEST!"
      stop

But the "MESSAGE TEST" is not broadcast (as if the condition is not met in the IF).
 
Last edited by a moderator:
@aescraft

Sure that it doesn't work..you have put %player% instance of player in the effect strings.
code_language.skript:
      apply nausea 1 to the player for 120 seconds
      show 10 "largesmoke" particles at location of player for player offset by 0.4, 0.7, 0.4
 
@aescraft

Sure that it doesn't work..you have put %player% instance of player in the effect strings.
code_language.skript:
      apply nausea 1 to the player for 120 seconds
      show 10 "largesmoke" particles at location of player for player offset by 0.4, 0.7, 0.4
But as I said, even this doesn't work:

code_language.skript:
command /sitdown:
  description: sentar
  executable by: players
  trigger:
    make player execute command "/sit"
    if blocks in radius 3 of player contains Brewing Stand:
      broadcast "MESSAGE TEST!"
      stop
 
@aescraft
code_language.skript:
command /sitdown:
    trigger:
        make player execute command "/sit"
        loop all blocks in radius 3 of player:
            if loop-block is Brewing Stand:
                broadcast "TEST MESSAGE"
 
Status
Not open for further replies.