How Do I make trap command? Help please!

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

steveispog

Member
Aug 30, 2022
2
0
1
24
I want to make a trap command were you can do /trap <Player> <Time> and it puts glass all around then for a certain amount of time and then goes back to normal. I found my skript has some problems to it.

1. If the player is jumping there is no floor because I dont know how to save block data and when the timer is up only half of the glass disapears

2. The script is very long and anoyying to edit I asume there is a loop script to make it easier but I cant figure that out!

My script:

Code:
command /trap [<player>] [<text>]:
    permission: troll.trap
    permission message: &cYou dont have access!
    usage: /trap <player> <seconds>
    trigger:
        set block 1 north of the arg-1 to glass
        set block 1 block up north of the arg-1 to glass
        set block 1 north of the arg-1 to glass
        set block 1 block up east of the arg-1 to glass
        set block 1 east of the arg-1 to glass
        set block 1 block up south of the arg-1 to glass
        set block 1 south of the arg-1 to glass
        set block 1 block up west of the arg-1 to glass
        set block 1 west of the arg-1 to glass
        set block 2 blocks above the arg-1 to glass
        wait "%arg-2% seconds" parsed as timespan
        set block 1 north of the arg-1 to air
        set block 1 block up north of the arg-1 to air
        set block 1 north of the arg-1 to air
        set block 1 block up east of the arg-1 to air
        set block 1 east of the arg-1 to air
        set block 1 block up south of the arg-1 to air
        set block 1 south of the arg-1 to air
        set block 1 block up west of the arg-1 to air
        set block 1 west of the arg-1 to air
        set block 2 blocks above the arg-1 to air

As you can see its not ideal. Help would be awsome!
 
Code:
command /trap [<player>] [<number>]:
  permission: troll.trap
  permission message: &cYou dont have access!
  usage: /trap <player> <seconds>
  trigger:
    set {_vecs::*} to (vector(0,-1,0)), (vector(0,2,0)), (vector(1,0,0)), (vector(-1,0,0)), (vector(0,0,1)), (vector(0,0,-1)), (vector(1,1,0)), (vector(-1,1,0)), (vector(0,1,1)), (vector(0,1,-1))
    set {_loc} to location of block at arg-1
    teleport arg-1 to {_loc}
    loop {_vecs::*}:
      set {_vecs::%loop-index%} to {_loc} ~ loop-value
      set {_blocks::%loop-index%} to type of block at {_vecs::%loop-index%}
      set block at {_vecs::%loop-index%} to glass
    loop arg-2 times:
      wait 1 second
    loop {_vecs::*}:
      set block at loop-value to {_blocks::%loop-index%}
 
Last edited:
  • Like
Reactions: RoosSkywalker
Status
Not open for further replies.