Solved BUG

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

zide

Member
Aug 23, 2017
42
1
0
20
Minecraft 1.12.1
skript dev32d (lastest)
command /test:
trigger:
set {_item} to 3 bread
set amount of {_item} to 2
send "%amount of {_item}%"
It sended 3,but not 2.
 
Minecraft 1.12.1
skript dev32d (lastest)
command /test:
trigger:
set {_item} to 3 bread
set amount of {_item} to 2
send "%amount of {_item}%"
It sended 3,but not 2.

Just out of curiosity, what are you trying to accomplish here?
Why not just set the original item to 2 bread if you are wanting it to send 2 bread?
 
Just out of curiosity, what are you trying to accomplish here?
Why not just set the original item to 2 bread if you are wanting it to send 2 bread?
I want to give player {amount} bread.
But code “give player {amount} bread“ is not ok.
 
what about trying this

code_language.skript:
command /give <player> <number> <item>:
    trigger:
        if arg-1 is set:
            give arg-1 arg-2 of arg-3

Essentially, you can pick a player, the amount, and which item you want to give said player
 
  • Like
Reactions: zide
code_language.skript:
set {_num} to 5
set {_x} to {_num} of anything named "test"
if player has {_x}:
    send "yes"
It don't work.
code_language.skript:
set {_x} to 5 of anything named "test"
if player has {_x}:
    send "yes"
It work.
 
code_language.skript:
set {_num} to 5
set {_x} to {_num} of anything named "test"
if player has {_x}:
    send "yes"
It don't work.
code_language.skript:
set {_x} to 5 of anything named "test"
if player has {_x}:
    send "yes"
It work.
Im really not sure what you are trying to accomplish here.
First you said you wanted to give players an item (bread)
So I gave you the simplest of simple codes I think everyone knows, and that would do EXACTLY what you want to do.
But after that, now you are posting some other bunch of code referring to if a player has # of ITEM and it will send yes?
If you require further help, in my opinion you really need to post more of what you are working on or what you are trying to accomplish, because I feel like the help I gave you was being ignored, and you started writing something totally different than your original posting was saying to us.
 
Im really not sure what you are trying to accomplish here.
First you said you wanted to give players an item (bread)
So I gave you the simplest of simple codes I think everyone knows, and that would do EXACTLY what you want to do.
But after that, now you are posting some other bunch of code referring to if a player has # of ITEM and it will send yes?
If you require further help, in my opinion you really need to post more of what you are working on or what you are trying to accomplish, because I feel like the help I gave you was being ignored, and you started writing something totally different than your original posting was saying to us.
I am very sorry about it.
I said "I want to give player {amount} bread." because I am bad in English,I hope I can tell you my problem in an easy way,avoiding making grammar mistakes or other mistakes.
Originally, my problem is I can't check whether the player has a certain number of a name item,such as 10 things named "test"(I am making an quest plugin).
I tried "set {_x} to 1 anything named "%{name}%" ",and set amount of it,but I can't set amount of it,so there's a question I first asked.
Should I create a new post to solve my original problem?
 
Hm... I think I know what you are meaning.
Im going to bed shortly, but maybe tomorrow I will see if I can make something happen for you.
Im not the most advanced Skripter, but, I think what you would need to do is loop players (if you are wanting to check all players - if not, just use a command for one player) and have it loop their inventory to check for a certain item.

I will write something out and get back to you when I think I have it figured out for you.
[doublepost=1519764701,1519730596][/doublepost]So i started working on a little something for you.
Im not 100% if this will match what you are looking for but here we go.

code_language.skript:
Options:
    item: test

command /quest:
    trigger:
        loop all players: 
            set {_amount::%loop-player%} to 0
            loop all items in loop-player's inventory:
                if loop-item's name is "{@item}":
                    add  amount of item loop-item to {_amount::%loop-player%}
            send "%loop-player% has %{_amount::%loop-player%}% of {@item}" to player

This gives you an option at the top, to set the name of the item you are looking for.
When you run the command, it will check for that item in the player's inventory, and return the player's name as well as how many of that item they have, back to you (the person who issued the command)

##EDIT##
Set it so it would return the total number of items in one line, rather than, in the even a player has more than 1 stack, it won't spit out multiple lines back to you!
 
Last edited:
Status
Not open for further replies.