Trigger Once While True not working in a For Each loop

0 favourites
  • 3 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hey all,

    I've got a Multiplayer game with one Host and one Peer. The characters are moved around by the HeroBase object.

    With the code below, the conditions are met when a player moves within a certain range of a Puzzle object. It works as expected when one player is within range, but when both are in that area, the "Trigger Once While True" seems to get ignored, and the conditions get met every tick.

    Does anyone know why this is, please? Am I doing this the right way?

    + System: For each HeroBase
    + Hero: associatedPlayer = HeroBase.associatedPlayer
    + Puzzle: Pick nearest to (HeroBase.X, HeroBase.Y)
    --------+ Hero: X ≥ Puzzle.X - 200
    --------+ Hero: X ≤ Puzzle.X + 200
    --------+ System: Trigger once
    ---------> testText: Set text to Self.Text & "1"
    
  • Multiplayer projects are hard to diagnose. Try to remove an aspect one at a time until you see what specifically is causing the problem.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Don't use "Trigger once" in loops or when the object in the condition has multiple instances. It will only cause obscure bugs.

    What are you trying to achieve here with "trigger once"? If you need to stop the loop when any hero is close to a puzzle, use "Stop loop" action.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)