Started by
Delangel
on
Topic category: Help with Minecraft modding (Java Edition)
Hi, I am trying to make a procedure that can increase the current level of potion effect (Every so often with ticks or right click) is this possible?
Topic category: Help with Minecraft modding (Java Edition)
Hi, I am trying to make a procedure that can increase the current level of potion effect (Every so often with ticks or right click) is this possible?
Yes, it is possible, just make a procedure with a global trigger "On player tick update" (alternatively you can do it on every loaded entity instead of just players), detect if the entity has the potion (optional, I think it works without this), store the duration and level in variables, add 1 to the level variable, clear that specific effect and apply it with the variables as duration/level
I didn't test this but in theory this should work. And for right click you can do the same but without that global trigger.
Oh, also make it a chance or base it off a timer (stored in custom NBT for example)
Thanks a lot, i was trying to make with right click, In case it's not too much trouble, could you give me an example of the procedure? Thanks in advance
I don't know how to send a screenshot, so I'll just tell you what to do in text: First, make a "When right-clicked" procedure to your item. Then, make the 2 local number variables, I'll call them "amplifier" and "duration" here. Next make this code:
Set Local: amplifier to: Get effect level/amplifier of potion (your potion) for Event/target entity
Set Local: duration to: Get remaining ticks of potion (your potion) for Event/target entity
Remove specific potion effect (your potion) from Event/target entity
Add potion (your potion) with level [Get Local: amplifier + 1] for [Get Local: duration] ticks ambient (true/false) particles (true/false) to Event/target entity
Thanks bro! it helps me a lot!