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

Started by Tomek_ITA on Tue, 03/28/2023 - 15:08

Topic category: Help with MCreator software

Last seen on 17:25, 16. May 2023
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?
Tue, 03/28/2023 - 15:08

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

Last seen on 05:52, 3. Jun 2023
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.

Last seen on 08:25, 20. Apr 2023
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 !