Started by
DragonOfAsparas
on
Topic category: Advanced modding
Hey, i'm trying to make an item that has a cooldown just like the enderpearl in 1.9. When the item is right clicked it summons lightning (example) and then it has like 10 seconds cooldown before it can used again. Or if someone know the code for the cooldown so i can paste it in the code somehow. Anyone who has a solution?
Thanks
I am currently looking into this, and if I find a solution I will let you know.
Thanx i'll be looking forward if you find a solution :)
I feel like there's a lot of modding mechanics that are possible through code, and not as many through MCreator...
Of course there is Twizzy. Mcreator itself has been coded, the problem is, that there is only a couple people that work on MCreator. Thats why MCreator allows users to implement their own coding as well. If you code a mod yourself then that mod could be better because you dont have restrictions. Most people who use MCreator do not have coding knowledge.
Btw i kind of found a way how to make an item with cooldown...only it's quite a pain to make. So when you have an item you want to add the event "when right clicked remove item from inventory" then you make another item, i named it timer 1. Then u go back to the item that you want to have a cooldown on and go to the events . you add the event "when update tick inventory add item timer1. Unfortunately you can't set a tick rate on items so you will have to make like 10 "timer items" for just 10 seconds... So when the cooldown item is right clicked it does it's function or whatever you selected, then it gets removed and adds timer1, then event to remove timer1 and add item timer2. I hope you guys understand this it's quite hard to explain.
@#5 Hmmm, Very interesting. I can Cleary see the concept of how this works, which is quite ingenius. Yes, a pain, but could be utilized effectively. I am quite amazed at this. I will be trying this out, and if it works then I will do a video of it on my channel, plus, you will receive 100% credit for its discovery!
My channel if you are curious:
[Spoiler]
www.youtube.com/c/RsKingGifted
[/spoiler]
Thanx! I will be watching the video! :)
I am really close to find a way. Here is what I got yet:
if(true){
synchronized (obj) {
while (<notify>)
obj.wait(10);
// Perform action appropriate to condition
}
20 ticks is equal to 1 second
Did you get this to work?
Did you get this to work?
Where should I put the script?
I have found out the code on how to do this but thank you for the effort :)
where do i put this code ?
I've found a WAY easier way to do this by using entity nbt data!
Just add a nbt data to the player, for example : ("LghtRodCooldown", 100) and a true/false nbt statement : ("LghtRodToggle", true) when the player logs in, (join event). Then when on the right click event of the rod, (add an if statement that (if the toggle is true) summon lightning and make the current entities "LghtRodToggle" false). Then add an event for the player tick update event and make the cooldown decrease if it is not zero && if the "LghtRodToggle" is false. Then if the cooldown is zero, set the toggle to true and set the cooldown back to 100.
(100ticks is the equivalent of 5 real life seconds)