Bring Condition Bug

From Staredit Network Wiki
Jump to: navigation, search

Although rare, there are cirumstances in which the "Bring" condition in Starcraft will return true when we know it to be false. Associated with each Location in Starcraft is a block of data, and unfortunately it does not always update correctly between triggers. The Location data will only update when certain Trigger Actions fire, and at the beginning of a trigger cycle*. Here is a prime example of how this bug can occur:

  • *needs verification from someone who is 100% sure

Location37.jpg

Trigger("Player 1"){
Conditions:
  Always();
Actions:
  Set Deaths("Current Player", "Terran SCV", Add, 1);
  Preserve Trigger();
}
Trigger("Player 1"){
Conditions:
  Deaths("Current Player", "Terran SCV", Exactly, 3);
Actions:
  Kill Unit("Current Player", "Terran Marine");
  Preserve Trigger();
}
Trigger("Player 1"){
Conditions:
  Deaths("Current Player", "Terran SCV", Exactly, 3);
  Bring("Current Player", "Terran Marine", "Location 37", At least, 1);
Actions:
  Display Text Message(Always Display, "Whoa, this trigger thinks there is a Marine at Location 37!");
}

In the above example, the deaths of SCV are used to simulate whatever game event could be occuring where the bug happens, but has no actual effect on the bug. In these triggers, when the trigger cycle of exactly 3 SCV deaths (or whatever other event is in your map) comes around, the middle trigger kills all the marines on the map for Current Player. Then the next trigger, which fires immediately after the middle trigger, also fires, when we know it should not fire, since we know all the marines are already dead. This happens because the Location data did not update so StarCraft still thinks there is a Marine at Location 37.

This is not the only possible way for this bug to occur, but occurances of it are rare, which is one reason why it's such a frustrating bug. If it happens to you and you don't know about it, then you won't be able to find a logic error in your triggers.

Fortunately, we can force Starcraft to update the Location data for a given location between any two given triggers by using the actions Remove Unit at Location, Kill Unit at Location, Move Location, and Move Unit. The best action to use is "Remove 1 Map Revealer for Player at Location" because it will not actually remove a map revealer (they can only be removed by the Remove All Unit action) so the only effect it will have is to update the Location data.