How should I make "When the player collides with this entity" only work once and not repeat infinitely?

Started by Tomek_ITA on

Topic category: Help with MCreator software

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How should I make "When the player collides with this entity" only work once and not repeat infinitely?

every time it repeats the collision trigger, It duplicates entities that should instantly despawn.

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Run a variable check by…
Tue, 03/28/2023 - 23:03

Run a variable check by setting a global variable to 0 for default value, then when you touch the entity if get variable (VariableName) is = 0 run your procedure then set the variable to = 1 so the loop stops. if you want the loop to reset then choose a trigger for example when entity spawns, if entity is subtype of  = YourEntity) you can set the variable (VariableName) to = 0.

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could set a local…
Mon, 04/10/2023 - 09:49

you could set a local variable named "collided", then whenever you check for collision, it would first check if the variable is true or false ; if false -> do your interaction code and set the variable to true , and if it's true, do nothing
You could even set a timer variable to reset the collided variable if you want to be able to collide with it every X time !