How to make a cage pet?

  • 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 community!

    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!

Youngblock2k

New Member
Sep 21, 2024
6
0
1
  1. Does anyone know how to make a Cage skript?
    • cage is ->
    when clicked at a player from 3 blocks it sumons a 5x5 cage in the players current location and the cage disappeares after 30s

    cage spawns like this
    1726917186609.png
 
my Current skript is:



command /cage <player>:
trigger:
# floor#
set block below the player to bedrock
set block below north the player to bedrock
set block below south the player to bedrock
set block below east the player to bedrock
set block below west the player to bedrock
set block below 2 meters north the player to bedrock
set block below 2 meters east the player to bedrock
set block below 2 meters west the player to bedrock
set block below 2 meters south the player to bedrock

#roof#
set block 4 above the player to bedrock
set block 4 above north the player to bedrock
set block 4 above south the player to bedrock
set block 4 above east the player to bedrock
set block 4 above west the player to bedrock
#bedrock roof 2#
set block 4 above 3 meters north the player to bedrock
set block 4 above 3 meters east the player to bedrock
set block 4 above 3 meters west the player to bedrock
set block 4 above 3 meters south the player to bedrock
set block 4 above 2 meters north the player to bedrock
set block 4 above 2 meters east the player to bedrock
set block 4 above 2 meters west the player to bedrock
set block 4 above 2 meters south the player to bedrock


#walls
set block 3 meters north the player to iron bars
set block 3 meters east the player to iron bars
set block 3 meters south the player to iron bars
set block 3 meters west the player to iron bars
set block above 3 meters north the player to iron bars
set block above 3 meters east the player to iron bars
set block above 3 meters west the player to iron bars
set block above 3 meters south the player to iron bars
# walls 2
set block 3 above 3 meters north the player to iron bars
set block 3 above 3 meters east the player to iron bars
set block 3 above 3 meters west the player to iron bars
set block 3 above 3 meters south the player to iron bars
# walls 3
set block 2 above 3 meters north the player to iron bars
set block 2 above 3 meters east the player to iron bars
set block 2 above 3 meters west the player to iron bars
set block 2 above 3 meters south the player to iron bars
#bedrock floor#/roof#
set block below 3 meters north the player to bedrock
set block below 3 meters east the player to bedrock
set block below 3 meters west the player to bedrock
set block below 3 meters south the player to bedrock
 
Last edited:
my Current skript is:



command /cage <player>:
trigger:
# floor#
set block below the player to bedrock
set block below north the player to bedrock
set block below south the player to bedrock
set block below east the player to bedrock
set block below west the player to bedrock
set block below 2 meters north the player to bedrock
set block below 2 meters east the player to bedrock
set block below 2 meters west the player to bedrock
set block below 2 meters south the player to bedrock

#roof#
set block 4 above the player to bedrock
set block 4 above north the player to bedrock
set block 4 above south the player to bedrock
set block 4 above east the player to bedrock
set block 4 above west the player to bedrock
#bedrock roof 2#
set block 4 above 3 meters north the player to bedrock
set block 4 above 3 meters east the player to bedrock
set block 4 above 3 meters west the player to bedrock
set block 4 above 3 meters south the player to bedrock
set block 4 above 2 meters north the player to bedrock
set block 4 above 2 meters east the player to bedrock
set block 4 above 2 meters west the player to bedrock
set block 4 above 2 meters south the player to bedrock


#walls
set block 3 meters north the player to iron bars
set block 3 meters east the player to iron bars
set block 3 meters south the player to iron bars
set block 3 meters west the player to iron bars
set block above 3 meters north the player to iron bars
set block above 3 meters east the player to iron bars
set block above 3 meters west the player to iron bars
set block above 3 meters south the player to iron bars
# walls 2
set block 3 above 3 meters north the player to iron bars
set block 3 above 3 meters east the player to iron bars
set block 3 above 3 meters west the player to iron bars
set block 3 above 3 meters south the player to iron bars
# walls 3
set block 2 above 3 meters north the player to iron bars
set block 2 above 3 meters east the player to iron bars
set block 2 above 3 meters west the player to iron bars
set block 2 above 3 meters south the player to iron bars
#bedrock floor#/roof#
set block below 3 meters north the player to bedrock
set block below 3 meters east the player to bedrock
set block below 3 meters west the player to bedrock
set block below 3 meters south the player to bedrock
That is a lot of code to spawn in a structure. I would recommend using SkBee and instead simply saving the cage as a structure then spawning it in. https://skripthub.net/docs/?id=10552
 
  1. Does anyone know how to make a Cage skript?
    • cage is ->
    when clicked at a player from 3 blocks it sumons a 5x5 cage in the players current location and the cage disappeares after 30s

    cage spawns like this
    View attachment 8811
Hello,
I think thats what you want.

1727298098729.png


Here is the codes:

Code:
function summonCage(p: player):
    set {_center} to location of {_p}
    
    loop blocks in radius 2 around {_center}:
        if loop-block is air:
            set loop-block to iron bars
    
    set {_topLocation} to {_center}
    add 2 to y-coordinate of {_topLocation}
    loop blocks in radius 2 around {_topLocation}:
        if loop-block is air:
            set loop-block to bedrock
    
    set {_bottomLocation} to {_center}
    subtract 2 from y-coordinate of {_bottomLocation}
    loop blocks in radius 2 around {_bottomLocation}:
        if loop-block is air:
            set loop-block to bedrock
    
    wait 30 seconds
    
    loop blocks in radius 2 around {_center}:
        if loop-block is iron bars:
            set loop-block to air
    
    loop blocks in radius 2 around {_topLocation}:
        if loop-block is bedrock:
            set loop-block to air
    
    loop blocks in radius 2 around {_bottomLocation}:
        if loop-block is bedrock:
            set loop-block to air
            
command /cage <player>:
    trigger:
        if arg-1 is a player:
            summonCage(arg-1)
        else:
            send "Player not found" to player
 
Can u make it like 7x7 inside?
Hello,
I think thats what you want.

View attachment 8818

Here is the codes:

Code:
function summonCage(p: player):
    set {_center} to location of {_p}
   
    loop blocks in radius 2 around {_center}:
        if loop-block is air:
            set loop-block to iron bars
   
    set {_topLocation} to {_center}
    add 2 to y-coordinate of {_topLocation}
    loop blocks in radius 2 around {_topLocation}:
        if loop-block is air:
            set loop-block to bedrock
   
    set {_bottomLocation} to {_center}
    subtract 2 from y-coordinate of {_bottomLocation}
    loop blocks in radius 2 around {_bottomLocation}:
        if loop-block is air:
            set loop-block to bedrock
   
    wait 30 seconds
   
    loop blocks in radius 2 around {_center}:
        if loop-block is iron bars:
            set loop-block to air
   
    loop blocks in radius 2 around {_topLocation}:
        if loop-block is bedrock:
            set loop-block to air
   
    loop blocks in radius 2 around {_bottomLocation}:
        if loop-block is bedrock:
            set loop-block to air
           
command /cage <player>:
    trigger:
        if arg-1 is a player:
            summonCage(arg-1)
        else:
            send "Player not found" to player
like mentioned abiove i want like that