Delayed item effect

Started by Blockadile on

Topic category: Help with modding (Java Edition)

Last seen on 18:20, 27. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Delayed item effect

im trying to make a food item that give you a potion effect (similarly to a golden apple) but gives you a set of diifferent effects after the longest one runs out, does anyone know how to do this?

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would make two procedures…
Sun, 06/18/2023 - 23:08

I would make two procedures. One that simply gives the main potion effect when eaten. Then a second procedure that gives the other potion effects when the main one is depleted. I guess you could do it all in one procedure but that's how I would do it.

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So below is my idea of what…
Sun, 06/18/2023 - 23:48

So below is my idea of what it would like like.

In the "Add potion" statement, select the main effect that is supposed to afflict the other effects. Set it for the "Has active potion" statement nested inside the if statement as well. Then under the "Add potion" statement nested in the "Do" statement, select all the effects you want to trigger.

Note: The "Wait {ticks} do" ensures that the effects will trigger at the right time. Basically, without it, the procedure will apply the main effect then check to see if it's gone but since it just got applied, the procedure will end. What you need to do is set the ticks inside the "Add potion" statement that triggers the main effect that was first stated to match the same amount of ticks in the "Wait do" statement. Maybe bump up the tick in the "Wait do" statement by 1. So if you want the main effect to last 30 seconds, set it to 600 ticks (20 ticks is a second in Minecraft) then set the "Wait do" statement to 601 so right after it ends, then it will check for the player and see if they have the main effect, if not, it'll apply the potion effects you specify.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Actually, as I'm writing this. I'm realizing there's a much simpler way to do this and I'm over-complicating things.

This is much simpler and makes more sense. I was treating the first one as if they were two different procedures, sorry. Just set it up like this and in my mind, it should work? I'm not sure as I've never tested it but to me, it makes perfect sense. Any further help, just reply or message me on Twitter, @ZarephLae.