Item with cooldown

Started by DragonOfAsparas on

Topic category: Advanced modding

Active 4 years ago
Joined Apr 2016
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 53
Item with cooldown

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

Active 3 years ago
Joined Dec 2013
Points:
983

User statistics:

  • Modifications: 4
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 398
I am currently looking into
Fri, 11/11/2016 - 01:22

I am currently looking into this, and if I find a solution I will let you know.

Active 4 years ago
Joined Apr 2016
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 53
RE:I am currently looking into
Fri, 11/11/2016 - 09:48

Thanx i'll be looking forward if you find a solution :)

Active 8 years ago
Joined Nov 2016
Points:
711

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3
I feel like there's a lot of
Thu, 11/17/2016 - 10:26

I feel like there's a lot of modding mechanics that are possible through code, and not as many through MCreator...
 

Active 3 years ago
Joined Dec 2013
Points:
983

User statistics:

  • Modifications: 4
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 398
RE:RE:I am currently looking into
Thu, 11/17/2016 - 16:02

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.

Active 4 years ago
Joined Apr 2016
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 53
RE:I am currently looking into
Tue, 11/22/2016 - 08:56

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.

Active 3 years ago
Joined Dec 2013
Points:
983

User statistics:

  • Modifications: 4
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 398
RE:RE:I am currently looking into
Tue, 11/22/2016 - 17:19

@#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]

Active 4 years ago
Joined Apr 2016
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 53
RE:I am currently looking into
Tue, 11/22/2016 - 18:47

Thanx! I will be watching the video! :)

Active 1 month ago
Joined Feb 2016
Points:
910

User statistics:

  • Modifications: 2
  • Forum topics: 10
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 257
I am really close to find a
Mon, 01/30/2017 - 21:41

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

Active 7 years ago
Joined Feb 2018
Points:
756

User statistics:

  • Modifications: 4
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 43
Did you get this to work?
Sat, 02/17/2018 - 22:59

Did you get this to work?

Active 7 years ago
Joined Feb 2018
Points:
756

User statistics:

  • Modifications: 4
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 43
Did you get this to work?
Sat, 02/17/2018 - 23:00

Did you get this to work?

Active 3 years ago
Joined Nov 2017
Points:
734

User statistics:

  • Modifications: 1
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 32
Where should I put the…
Mon, 02/26/2018 - 13:07

Where should I put the script?

Active 4 years ago
Joined Apr 2016
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 53
I have found out the code on…
Mon, 03/05/2018 - 11:05

I have found out the code on how to do this but thank you for the effort :)

Active 3 years ago
Joined May 2019
Points:
732

User statistics:

  • Modifications: 1
  • Forum topics: 7
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 44
where do i put this code ?
Mon, 09/09/2019 - 09:12

where do i put this code ?

Active 3 years ago
Joined Nov 2018
Points:
965

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 539
I've found a WAY easier way…
Mon, 09/09/2019 - 17:35

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)