Speed item help

Started by DerpyOreo on

Topic category: Help with MCreator software

Active 1 year ago
Joined Mar 2019
Points:
682

User statistics:

  • Modifications: 2
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
Speed item help
Thu, 08/13/2020 - 15:21 (edited)

In my mod, I'm making an item where if its in your inventory, it gives you speed, but if its not in your inventory it doesnt.
I did this
While the player has the speed item in inventory, give effect speed 1 for 1 second.

The game crashes when I put the item in my inventory.

Help!

(also if you dont have a secure connection, thats my bad because im using my website for the image LOL)

Edited by DerpyOreo on Thu, 08/13/2020 - 15:21
Active 2 years ago
Joined Dec 2017
Points:
1041

User statistics:

  • Modifications: 7
  • Forum topics: 24
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 332
So I tried what you have and…
Fri, 08/14/2020 - 07:30

So I tried what you have and it crashed, switched it to an if do statement and it worked. Don't forget the on player tick update trigger.

sugar

Active 4 years ago
Joined Jun 2020
Points:
637

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 58
Generally don't use while()…
Fri, 08/14/2020 - 11:25

Generally don't use while() statements in a procedure that runs every frame if you can use an if() statement instead.

The game crashes when I put…
Fri, 08/14/2020 - 11:27

The game crashes when I put the item in my inventory.

Your while loop locks the game from doing anything else, but checking for inventory item so it lags, freezes, and crashes