[Solved]Two Identical type of events but one doesn't work?

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I have two identical events but each for a different type of object [Adventurer] and [enemyUnits] (latter is a family but I don' think this should be an issue). One is functioning exactly the way I want it to:

    When the object instance variable reaches 0 health

    -->Destroy all instances of dummyAttack that targets the object

    -->Destroy all instances of dummyAttack created by the object (that has no health)

    *-->Set the variable of "target" to 0 for all instances of the object Adventurer

    -->Destroy all objects related to the instance with 0 health

    So this works perfectly fine when the enemyUnits object reaches 0 health and almost perfectly for when the Adventurer object reaches 0 health except one specific trigger.

    The specific trigger that is not working properly is the part for setting the "target" variable to 0, I tested using debug and when splitting up the units like displayed below, Once the top Adventurer dies only ONE of the enemyUnits object has their target variable reset to 0 however the rest are unchanged.

    I tested the adventurer death trigger for when the object enemyUnits die by creating a mass of Adventurers and when one enemyUnits dies it properly resets all referenced Adventurer's target variable back to 0.

    Events for the Working death of enemyUnits objects

    Events for the Not-Working death of Adventurer objects

    .c3p Project File: dropbox.com/s/f6b1nsic787hpqu/triggerIssue.c3p

  • Your events work correctly. However, the Adventurer is only destroyed at the end of the tick. So even if you destroy it in event 59, for all remaining events it will still exist. So in event 78 enemies re-acquire it as a target.

    You can add another condition to event 78 "Adventurer health>0" to fix this. Also, it will be a good idea to disable adventurer's collisions when destroying, it may prevent other similar issues.

    By the way, you don't need to use "System pick by evaluate" and "For each" in this case. You can simplify your events like this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your events work correctly. However, the Adventurer is only destroyed at the end of the tick. So even if you destroy it in event 59, for all remaining events it will still exist. So in event 78 enemies re-acquire it as a target.

    You can add another condition to event 78 "Adventurer health>0" to fix this. Also, it will be a good idea to disable adventurer's collisions when destroying, it may prevent other similar issues.

    By the way, you don't need to use "System pick by evaluate" and "For each" in this case. You can simplify your events like this:

    Thanks so much for the help! That seems to have been the cause of the issue, Ill be sure to be more careful with events conflicting with each other.

    And thanks for showing me how to simplify those events, I think with that I can actually simplify a lot of the events I've created.

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