Me and my friends are making a class based minigame and we are wondering how we could make usable items (such as spawn eggs, snowballs, etc) with infinite uses.
One of the classes is going to use an infinite custom spawn egg. I want to know any way I could make the spawn egg regenerate itself, so it could be used infinitely. I also want to know if there's a way to not make it regenerate itself if someone switches off the class.
I have created cooldown timers but that's usually only effective for throwing items on the ground. You could give them an item that "replenishes" what they have. When you detect it give them all the appropriate items
Not sure what plugins etc you have already but I would do what the above said. Maybe a condition that if they run out it triggers an event to give them more of the item. Could also just make a shop that sells the item for free.. but it would be more fun if it was automatic
just put down a commandblock with a clock and type in the following command:
/replaceitem "Target"(Name of Player,Mob, @a,@e,...) "Slot"(Hotbar,inventory,chest,...) "Item-ID"(pickaxe,shovel,sword,...) "number of items"
this should do it, i havent tried it in the newer versions, but in 1.7-1.8 it worked
That's almost it. If you want to make sure only one class can use it, then you need a way to identify the class. The best solution to this is to use tags.
Whatever classes you use, create tags for them with the command /tag @p add <ClassName>
Remember that when someone changes class, you have to remove their other class tag with /tag @p remove <ClassName>
In order to avoid any potential glitches, I would recommend running a command that removes every class tag from the player before giving them a new class.
Now that you have created tags for classes, run the /replaceitem command in this way:
/replaceitem entity @a[tag=ClassName] hotbar 0 <ItemName> <Amount> <Data> -> Run this command through an always-on repeat command block
Here, the 0 after "hotbar" stands for the slot in the player's hotbar to be replace at all times. 0 is the first slot, 1 is the second...and 8 is the last.
Me and my friends are making a class based minigame and we are wondering how we could make usable items (such as spawn eggs, snowballs, etc) with infinite uses.
One of the classes is going to use an infinite custom spawn egg. I want to know any way I could make the spawn egg regenerate itself, so it could be used infinitely. I also want to know if there's a way to not make it regenerate itself if someone switches off the class.
I have created cooldown timers but that's usually only effective for throwing items on the ground. You could give them an item that "replenishes" what they have. When you detect it give them all the appropriate items
Not sure what plugins etc you have already but I would do what the above said. Maybe a condition that if they run out it triggers an event to give them more of the item. Could also just make a shop that sells the item for free.. but it would be more fun if it was automatic
Hey, maybe this is what you are looking for
just put down a commandblock with a clock and type in the following command:
/replaceitem "Target"(Name of Player,Mob, @a,@e,...) "Slot"(Hotbar,inventory,chest,...) "Item-ID"(pickaxe,shovel,sword,...) "number of items"
this should do it, i havent tried it in the newer versions, but in 1.7-1.8 it worked
That's almost it. If you want to make sure only one class can use it, then you need a way to identify the class. The best solution to this is to use tags.
Whatever classes you use, create tags for them with the command /tag @p add <ClassName>
Remember that when someone changes class, you have to remove their other class tag with /tag @p remove <ClassName>
In order to avoid any potential glitches, I would recommend running a command that removes every class tag from the player before giving them a new class.
Now that you have created tags for classes, run the /replaceitem command in this way:
/replaceitem entity @a[tag=ClassName] hotbar 0 <ItemName> <Amount> <Data> -> Run this command through an always-on repeat command block
Here, the 0 after "hotbar" stands for the slot in the player's hotbar to be replace at all times. 0 is the first slot, 1 is the second...and 8 is the last.
Now you're all set. Good luck!