Solved %entity-block% is not door

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

Shroomz

Supporter +
Jun 22, 2017
44
0
6
25
I am trying to bang my head on the wall and think why the %entity-block% is not the whole door item. Is there any variable that could do the same but would register whole door! I am doing rpg styled locks and it sucks now bacause you have to lock "both" block of the door... :I
 
Without seeing your code idk exactly how youre locking doors but something along these lines should work (assumes people lock doors by right clicking it):
code_language.skript:
on rightclick on a door: #or whatever event players use to lock doors
    set {locked_doors::%player%::%clicked block's location%} to true

    set {_block_above_door} to the block above clicked block
    if {_block_above_door} is a door:
        set {locked_doors::%player%::%{_block_above_door}'s location%} to true

    set {_block_below_door} to the block below clicked block
    if {_block_below_door} is a door:
        set {locked_doors::%player%::%{_block_below_door}'s location%} to true

when the player goes to lock a door this simply just checks if the block above/below the door is also a door, and if so, lock it as well
 
Last edited by a moderator:
Without seeing your code idk exactly how youre locking doors but something along these lines should work (assumes people lock doors by right clicking it):
code_language.skript:
on rightclick on a door: #or whatever event players use to lock doors
    set {locked_doors::%player%::%clicked block's location%} to true

    set {_block_above_door} to the block above clicked block
    if {_block_above_door} is a door:
        set {locked_doors::%player%::%{_block_above_door}'s location%} to true

    set {_block_below_door} to the block below clicked block
    if {_block_below_door} is a door:
        set {locked_doors::%player%::%{_block_below_door}'s location%} to true

when the player goes to lock a door this simply just checks if the block above/below the door is also a door, and if so, lock it as well
How about on double chests?

Edit: Also I dont want to lock the door for player its locked for item like I have done with single chests:
code_language.skript:
on place of chest:
    set {%event-block%.lukossa} to false

on leftclick on chest holding wooden hoe:
    if {%event-block%.lukossa} is false:
        set {%event-block%.lukossa} to true
        set {%event-block%.lukittu} to name of player's tool
        message "You succesfully locked it."

on rightclick on chest:
    if {%event-block%.lukossa} is true:
        if player is not holding wooden hoe named "%{%event-block%.lukittu}%":
            message "Locked."
            cancel event
 
Last edited by a moderator:
How about on double chests?

Edit: Also I dont want to lock the door for player its locked for item like I have done with single chests:
code_language.skript:
on place of chest:
    set {%event-block%.lukossa} to false

on leftclick on chest holding wooden hoe:
    if {%event-block%.lukossa} is false:
        set {%event-block%.lukossa} to true
        set {%event-block%.lukittu} to name of player's tool
        message "You succesfully locked it."

on rightclick on chest:
    if {%event-block%.lukossa} is true:
        if player is not holding wooden hoe named "%{%event-block%.lukittu}%":
            message "Locked."
            cancel event
Correct me im wrong but in your variables shouldnt you be using event-block's location because right now it just reads as {chest.lukossa} so if you rightclick on any chest it will say it's locked even if you only locked 1 chest.
 
Correct me im wrong but in your variables shouldnt you be using event-block's location because right now it just reads as {chest.lukossa} so if you rightclick on any chest it will say it's locked even if you only locked 1 chest.
Actually that works right! Only the block that I have locked is locked.. no other block.
 
Hmm youre right that weird. anyways when someone leftclicks the chest just check if any of the blocks on any side of the chest are a also chest and if so lock it too. same thing for doors but you only need to check the block above it
 
Hmm youre right that weird. anyways when someone leftclicks the chest just check if any of the blocks on any side of the chest are a also chest and if so lock it too. same thing for doors but you only need to check the block above it
Does btw this work:
code_language.skript:
the block behind the clicked block is "chest"

edit: Like if I put sign on chest and I wanna by clicking sign that IS attached to the chest do something
 
ya
[doublepost=1499805037,1499804994][/doublepost]well actually itd be:
code_language.skript:
if the block behind the clicked block is a chest
 
ya
[doublepost=1499805037,1499804994][/doublepost]well actually itd be:
code_language.skript:
if the block behind the clicked block is a chest
Somehow it does not work... is sign and chest sharing same block when sign is attached to the chest?

EDIT: MY BAD WORKS!
 
Status
Not open for further replies.