While -> Do , Function crashes game

Started by ConnorTron110 on

Topic category: Troubleshooting, bugs, and solutions

Last seen on 21:19, 20. Feb 2020
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
While -> Do , Function crashes game
Thu, 02/20/2020 - 21:22 (edited)

So i'm having this issue, and i know what the problem is i just need help solving it. Basically, when you put this full set of armor on, and press a key, it makes you invisible, now since its a toggleable feature, i need to make a While -> do part of the Block.
It looks something like this...
Block should be here, if you see this, it didn't load... :/

-

-

-

-

-

-

-

 

Ive made a Bool (True/False) Var, and by default its False, now before that there an If that makes sure that the entire suit of armor is on, then when the key is pressed, if the variable is False. Set to True and vice versa
When Said variable is True, Give potion effect, then in order to break out of the loop ,check if Toggle is False.

I believe the issue lays upon the fact that the While Function is Spamming Minecraft with the invisibility, and minecraft cant keep up, so it crashes. Is there a way to add a pause?
Its rather that or i'm missing out on something completely. 
All help would be appreciated :)

Edited by ConnorTron110 on Thu, 02/20/2020 - 21:22
Last seen on 20:38, 30. Dec 2022
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Minecraft only advances to…
Mon, 03/02/2020 - 12:40

Minecraft only advances to the next tick when that while loop is broken, which it will never be

You can achieve the result you want just by doing the if statement.

Also, another problem is that your toggle soundness be in the same procedure as your effect, otherwise it will keep toggling itself every other frame. Instead, set an NBT tag to the item, block or mob as the toggle, an then check for that in the update tick

Last seen on 20:38, 30. Dec 2022
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Soundness = shouldn't Oh…
Mon, 03/02/2020 - 12:42

Soundness = shouldn't

Oh good, auto correct...