Fork principle
From GenieWiki
The fork principle is a workaround used in trigger design to create logical negation of conditions where it is not normally available. To avoid wordy explanations it is probably easier to explain the principle using an example. The first condition available is bring object to area. If the designer's aim is to detect when an object is in a certain area, this is easy enough to do. However, if we wish to detect when an object is not in an area, it becomes a little more difficult. There is no way to select a 'not' box within the condition itself, and there is no condition called 'Object not in area', so another method will be needed. One method would be to detect when the object is in any other area, however this would require 2 to 4 conditions to cover all the possible areas that aren't the area in question. A simpler method is to use the fork principle. This is where instead of trying to detect that the object isn't in the area, we detect when it is in the area, and use that trigger to switch another trigger off.
Example
We wish to know when a patrol is not in a street. There are several other areas the patrol can be in, and detecting all of them would take at least 4 separate triggers. Instead we want a single trigger cluster that detects when they are not in the street. To achieve this, the following triggers are used:
Trigger 1
Detects when the patrol is in the street
Starting state:On, Looping:Yes
Condition: Bring object to area
- Object:Patrol leader
- Area:Street
Effect: Deactivate trigger:Trigger 2
Trigger 2
Fires if not switched off, indicating the patrol is not in the street
Starting state:On, Looping:No
Condition: Timer: 2
Effect: Desired effect (e.g. Display Instructions: "The coast is clear!")
Trigger 3
Reactivates Trigger 2
Starting state:On, Looping:Yes
(No condition)
Effect:Activate trigger:Trigger 2
The above system works like this: If the patrol leader enters the street, the first trigger will fire, switching the second trigger off. The second trigger will fire almost immediately when the coast is clear, displaying this on screen to the player. However, the timer allows a small window in which the first trigger can deactivate this trigger, stopping the message from being displayed. The third trigger is necessary to continually reactivate the second trigger, otherwise it will remain in the off state and be unresponsive when the street is clear of patrols.
With this system in place, the three triggers act like a single trigger that fires when an object is not in an area. In other words, the small system works to create the 'Object not in area' condition through a simple workaround. In this example, as soon as the street has remained clear for 2 seconds, the message 'The coast is clear!' will display, signalling a chance to pass through before the patrols return.
Applications
The trick is an essential tool for the AoK designer, and it adds much more versatility to the trigger system. One example of use is in transport captains, where it detects when a transport is empty. The system can be applied to a number of different situations - see the article from Dragon Gaming Design Network below for some other applications.
External links
- The Fork Principle by SesameSticks - DGDN article (N.B. Trigger example won't work due to units garrisoned flaw)
- Transport captains article by Berserker Jerker - A trick employing a fork is detailed here at the Tsuniversity.

