Solved Cannot Be Attacked With Axe

  • 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
He shouldn't be able to do any damage to someone with his iron axe.
Can you offer alternative solutions.

The code I wrote is working but I don't want to delete the tool.

I tryed change cursor slot, can only hit once.
Maybe could send the tool to the inventory. :emoji_thinking:

Code:
on left click:
    if player's tool is a iron axe:
        loop items in player's inventory:
            if loop-item is iron axe:
                clear the loop-item

Thanks to the helpers. :emoji_slight_smile:
 
Can you try to explain it on another way?

bUR1uY.png
 
Do you want the item to be moved into slot 9 and if there is something in that slot, should it then use the next slot? (slot 10)
300px-Items_slot_number.png


What if the player has a full inventory, where should the axe then get moved to?
 
Last edited:
  • Like
Reactions: Yaşarhan
It doesn't have to be 9, sir.
"if there is something in that slot, should it then use the next slot?" Yes, dont moving if inventory is full.
 
Try this and see if it does what it should

Code:
on damage:
    if attacker's tool is an iron axe:
        cancel event
        set {_tool} to attacker's tool
        loop 26 times:
            set {_slot} to loop-value + 9
            if slot {_slot} of attacker is air:
                clear the attacker's tool
                set slot {_slot} of attacker to {_tool}
                stop
 
  • Like
Reactions: Yaşarhan
Try this and see if it does what it should

Code:
on damage:
    if attacker's tool is an iron axe:
        cancel event
        set {_tool} to attacker's tool
        loop 26 times:
            set {_slot} to loop-value + 9
            if slot {_slot} of attacker is air:
                clear the attacker's tool
                set slot {_slot} of attacker to {_tool}
                stop

Great sir, the 9.slot was bypassed, I changed "+ 9" to "+ 8" and It was dissolved but not including hotbar.
Will it work when I change cycle times from "26" to "34" ?
 
I'm not sure if it's like this you want it.

Code:
on damage:
    if attacker's tool is an iron axe:
        cancel event
        set {_tool} to attacker's tool
        loop 36 times:
            set {_slot} to loop-value - 1
            if slot {_slot} of attacker is air:
                clear the attacker's tool
                set slot {_slot} of attacker to {_tool}
                stop
 
  • Like
Reactions: Yaşarhan
I'm not sure if it's like this you want it.

Code:
on damage:
    if attacker's tool is an iron axe:
        cancel event
        set {_tool} to attacker's tool
        loop 36 times:
            set {_slot} to loop-value - 1
            if slot {_slot} of attacker is air:
                clear the attacker's tool
                set slot {_slot} of attacker to {_tool}
                stop

Thank you soo much sir, works perfectly !
 
  • Like
Reactions: WeeHee
Status
Not open for further replies.