Fight The Dragon

Fight The Dragon

27 ratings
Advanced ACK Techniques (Logic, Triggers, and Other Essentials)
By zingrook and 1 collaborators
Do you want to create adventures with complex logic and triggered events? Do you want players to ask aloud "How did they do that!"? Then this is the guide you have been asking for! Read on to learn about cascading logic blocks, timed events, NPC ambulation simulation, and more!
   
Award
Favorite
Favorited
Unfavorite
Introduction: Formal Logic and Preamble
WIP * WIP * WIP

Formal logic is based on a deceptively simple, but immensely powerful, statement:

If this, then that.
or
If p, then q.

This is called an If/Then statement, and understanding and using this concept will help immensely in dealing with logic such as is present within the ACK. Many of the If/Then statements you will be using when working within the ACK will be based upon, and result in, binary actions; that is, on/off, show/hide, etc.

Some examples of how these ideas apply to the ACK are:

  • If the player steps here, then spawn this mob.
    (The binary obverse of this statement is If the player does not step here, then don’t spawn this mob.)
  • If the player flicks this switch, then open this door.
  • If this mob dies, then drop this key.

Things can get much more complicated with the introduction of multi-tiered if/then statements; statements where there are more than one required condition for the result to be true. This could be formalized as:

If x, y, and z, then p.

These kinds of complex conditional statements can be used to great effect in the ACK to add flavor and variety to your creations. A simple example might be:

If x mob dies, and the player steps here, and y switch has been flipped, then open z door.

Read on to see these concepts in action. All controls referenced will be m/kb-specific.

*Disclaimer: As the game is still in post-1.0 active development, all content herein should be considered subject to change.
Mob cascading: Spawning mobs from mobs


Mobs have an in-built option in their UI panel labeled ON KILLED. This allows an mob to act as a simple binary trigger for events. The resultant action is sans-delay, firing immediately upon mob death. Place two mobs in your adventure. We will call the one that is acting as a trigger Mob A, and the one being triggered Mob B. Simply click on Mob A, then under the purple EVENTS tab, click ON KILLED. From here you can choose an actionable object or entity from the list, or click on FIND ITEM IN SCENE to click directly on the object you wish to trigger. Select Mob B and choose SPAWN. We'll be using the ATTACK option later, but ignore it for now. Tick the box beside FIRES ONCE and click ADD TO LIST.





For any kind of delay, we need to insert a Logic block between the trigger mob and his triggered subordinate. This will come with the added benefit of other events being fired to coincide with the mob's death.

Place a Logic block in the adventure, avoiding tiles where you may want to place other items. Click Mob A and click ON KILLED. In the list on the right, click Mob B to remove it from the list, and then click FIND ITEM IN SCENE. Click on the Logic Block you just placed. For this scenario, we only want it to FIRE ONCE. The tick box next to TRIGGER is already filled, as it is the only option. Click ADD TO LIST.



Now, when Mob A is killed, the Logic Block will be fired, triggering the events we will now add. Close Mob A's UI and click on the Logic Block. Under the purple EVENTS tab, click ON FIRED. Click FIND ITEM IN SCENE and click on then click on Mob B. This will achieve the same affect as the previous method, but now we can have a remote object from which we can trigger other events without relying solely on Mob A, and also allows for delayed firing.

Example[www.gfycat.com]


NPC Ambulation: Simulating NPC Movement
An NPC is a static entity; it cannot move from one tile to another. However, by using sequences of Logic Blocks and Triggers, you can give the illusion of ambulation. You are essentially simulating movement in the same fashion as stop-motion animation, or a flipbook, might achieve it. That is, we arrange a series of NPCs, all named and made to look alike, but are in fact individual entities, made to appear and disappear in such a fashion that it appears that one is moving. See the gif linked below for an example.

Example[www.gfycat.com]

Place two NPCs, one after the other, and give them the same name. Any NPCs other than the first in the sequence need to be hidden until called. The simplest way to achieve this is to use the SPAWN as a trigger. Click the SPAWN and click ON GAME START. Click FIND ITEM IN SCENE, click the NPC(s) you want to hide, and click HIDE and ADD TO LIST.





Next to the NPCs, place a Trigger. Click the Trigger, click EVENTS, and finally, click ENTER TRIGGER. Click FIND ITEM IN SCENE and click on the first NPC. Click HIDE and ADD TO LIST on the first NPC, and SHOW and ADD TO LIST on the second. When the player enters the Trigger, the first NPC will vanish, and the second NPC will appear. Tile this arrangement for whatever distance you want your NPC to move. In the example image below, I have a line of NPCs ready to move.


Event Looping: Sequential toggling
Logic Blocks have a very handy feature; they can fire one another. That is to say, a Logic Block can be connected to another Logic Block as a trigger, such that when Logic Block A is fired, it will then change from receiver to sender, and trigger Logic Block B.

Taking advantage of this feature, we can produce looping events with two or more Logic Blocks. The examples below shows the fire effect toggling between on and off states repeatedly. This method can be used on anything from gates and effects, to NPCs and (some) light props.

Example[www.gfycat.com]

Example[www.gfycat.com]

For this example, we will toggle a fire effect prop on and off. Place two Logic Blocks in the adventure. Next, place one of the fire effects. Click on one of the Logic Blocks and choose ON FIRED. Click FIND ITEM IN SCENE and choose the other Logic Block. Click TRIGGER, do not click FIRES ONCE, and click ADD TO LIST. Keep the UI open for Logic Block A and click FIND ITEM IN SCENE again. This time choose the fire effect we placed earlier; click TURN ON, do not click FIRES ONCE, and click ADD TO LIST.



Notice that we are triggering both Logic Block B and the fire effect with Logic Block A. Now, repeat these steps with Logic Block B, so that it will fire both Logic Block A and the fire effect. But this time, we want the fire effect to be turned off.

Now all we need is a trigger input, which can be any entity or item that can produce a signal. For this example, we will use a Trigger. Near the fire effect, place a Trigger. Click the Trigger and choose ENTER TRIGGER. Click FIND ITEM IN SCENE and choose Logic Block A. Remember, we want this setup to loop, so do not click FIRES ONCE.

Note: Effects are toggled on by default, so to make the fire effect turn on via an event, we have to first turn them off. Click on the SPAWN and click ON GAME START. In the ON GAME START UI, click FIND ITEM IN SCENE, and click your fire effect. In the UI, click TURN OFF. Since we want the effect to loop its state, toggling between on and off, do not choose FIRES ONCE. For the example we are setting up here, this step is not necessary. If you want the looping effect to start via another event, this step is necessary to hide the effect until called.
Logic Block Clocks: Timer-based Adventures and Puzzles


Logic blocks can (and if they are set to trigger one another, must) be set with a delay. The delay can be set between .05 and 5 seconds. By arranging a sequence of logic blocks with specific delays, you can create delayed/timed events that will only be triggered after a specified amount of time. The image below shows an array of 14 logic blocks: 12 set the timer at 60 seconds (5 seconds each * 12 logic blocks), the next logic block is set to 5 seconds as well, which is then added to the final block, which is set to 1 second delay. The last 2 blocks control how long the gates remain open.



You can see this technique in action in the adventure TEMPLE OF TIME. In the adventure, the player is tasked with reaching a series of "treasure rooms" before a specified time expires. After the allotted time has lapsed, the gates to the treasure room briefly open (for 6 seconds) before closing again, permanently.



Between the player and the treasure rooms are a series of mobs connected to logic blocks that open interceding gates. All enemies in each area preceding the treasure rooms must be cleared before their connected gates open. This adds urgency to the combat, and a tangible goal for the player to sprint through the level before the treasure is locked away from them.



At the entrance of each mob-laden area is a trigger that, when the player enters it, starts the timer for that segment of the map. Each segment culminates in a mini-boss fight, whose death, along with his minions', opens three gates: two side gates to allow the player to the next segment should they not have made it into the treasure room, and a gate directly in front of the treasure room gate. If the player kills the final enemies, including the mini-boss, before the treasure gate opens and closes again, they can reach the chests within.



To allow a player who does make it into the treasure to get out, there is a 1 by 1 trigger in the center of the treasure room. The trigger is set to fire when the player exits its radius. To prevent the player who made it into the room from allowing others to enter, the trigger is connected to a logic block.



The logic block, when fired, has two actions: action one opens both the front and rear gates of the treasure room for 1 second, while action two fires an adjacent logic block that is set to close both gates after 1.5 seconds. This delay is just enough to allow the player to make it out of the room before the gate closes. The gates cannot be opened from outside by any means once the logic block delay array has been completed.
Enabling/Disabling Triggers: Controlled triggering
Triggers are proximity-based event cues. They can be used to toggle the state of any actionable entity, from NPCs to effects, or even other triggers. But if you want to have a trigger only fire after a given connected (even by proxy!) event, you will need to disable the trigger first.

The simplest way to achieve this is to set the SPAWN to disable the trigger ON GAME START. In the image below, there is a simple implementation of this technique.



The trigger on the left is Trigger B, and the trigger on the right is Trigger A. To the right of Trigger A is a fire effect, and on the other side of that is the SPAWN; the player will come through the fire to reach this segment.

Trigger A (on the right) is connected to the SPAWN, and set to TURN OFF ON GAME START (see image below).



When a trigger is set to OFF by another entity (see: SPAWN), it will not be fired by the player's proximity as it normally would. It is sleeping, until we tell it to wake up and allow itself to be fired.

Here, we want the player to pass through Trigger A without firing it, and enter Trigger B, which will fire and spawn the enemy that stands on the other side of it--Skeleton B. Skeleton B has an event tied to it, set to TURN ON Trigger A. Thus, when the player walks back out of the area through Trigger A, it will be awake this time, and fire its connected event, which is to spawn Skeleton A. In the screenshot below, you can see the wiring that connects Skeleton B to Trigger A.



The screenshot below shows Trigger A connected to Skeleton A. When the player goes through Trigger A the second time, after first passing through without firing it to go spawn and kill Skeleton B, Trigger A will fire and spawn Skeleton A.



This technique can be used to allow "On-the-way-back" events; events where the player has already passed through the area and is returning to a central hub area, such as after acquiring a key to a locked door. An example of this technique can be found in my adventure TOWER OF PYTH in the bathroom adjacent to the bedroom on the first floor of the eponymous tower.

The player passes through the bedroom without resistance. In the bathroom, there is a key chest which, when opened, turns on a trigger just outside of the bathroom door in the bedroom. When the player exits the bathroom after opening the chest and collecting the key, the trigger is on, and will fire, spawning a few enemies in an ambush event.

Below is a gif showing this technique (which is shown in the ACK screenshots above) in action in my testing adventure. If you use this technique in an adventure, please share the name in the comments!

Example[www.gfycat.com]
Remote Mob Activation: Calling mobs through teleporters
Logic Block Cascading: Firing Logic Blocks with Logic Blocks
Wave-spawning Mobs: Connecting packs of mobs to single Logic Blocks
9 Comments
G4mm4g0bl1n 27 Jun, 2015 @ 10:33am 
Event Looping: Sequential toggling

Dont deactivate the logic blocks and activate them, reset them insteed!
When a Logic Switch or Logic Block was Hit by a trigger, then it counts a true and this state will be constant till the block will be resetted. :) So the right way is to reset them, to make a Loop.

Example
When activate PressurePlate and this plate fires a logic block opens a Door. Step away from the Plate and you will see the Logic Block is still "True" and the door wont close, because the block has first to be reset before you can use it again. So when you step away from the PressurePlate have you to declare that this action resets the Logic Block to Close the Door.

Its only a formal thingy, because I use a Quest Reminder which prints every 3min the actual Quest on the screen. Your method didnt work with that, because the 3min Delay would be overrided by this method.
zingrook  [author] 27 Jun, 2015 @ 8:48am 
@cOOLsp0T Everything above works. There are even gifs if them in action. What didn't ork for you?
G4mm4g0bl1n 27 Jun, 2015 @ 6:45am 
The Loop Function will not work when done like in the tutorial said, because when a Logic Block is fired, then its fired! It has to be reset, before it can fire again.

So Correct is:
Trigger A: Reset Trigger B AND Fire Trigger B
Trigger B: Reset Trigger A AND Fire Trigger A
This works fine for me!

This Tutorial is good. If you need help with something, then feel free to add me as Friend. My first Map will be released soon and you all will be surprised. ;D
MurrayMcGut 23 Jun, 2015 @ 5:52am 
This guide is very interesting. Keep it it running ^^. I want to know how you do that :D
zingrook  [author] 13 Dec, 2014 @ 6:06am 
@Kurashi Enabling/Disabling Triggers section is live!
zingrook  [author] 12 Dec, 2014 @ 6:05pm 
@Kurashi Tomorrow. :)
Kio Kurashi 12 Dec, 2014 @ 5:28pm 
Waiting impatiently for the Enabling/Disabling trigger section.
Saitech 10 Dec, 2014 @ 11:34am 
A very well put together guide, worth reading even for the more seasoned map makers. :ftd_minotaur:
Sapjes-Bas 9 Dec, 2014 @ 2:30pm 
Great guide so far. Extremely helpful! Logic blocks can be a little bit confusing for a beginner like me, so I am very happy you wrote this!