Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web


Scapex - Working with Triggers



  First and foremost, I must say that Scapex is one of the best editors I have ever had the pleasure of using. Although there are a few things that would make nice additions to its engine, its ones of the most configurable editors I've ever seen. The purpose for this guide is to help those that wish to use scapex but dont think they can. A lot of people experiment with it and even go as far as making a few multiplayer maps. But thats about where it ends. Hopefully this guide will be enough to get you started and possibly even get more single player scenarios and cutscenes into circulation within the community. It seems that everything is pretty clear and well explained in the manual as far as defining what things are and it definately gives the user enough info to get started. When we get to triggers and setting them up correctly is where most get stuck or somewhat confused. It seems that the key, at least for me, to figuring out scapex and how to correctly implements its trigger is a long process of trial and error. You set up a few triggers...save map...close scapex...load Sacrifice...test map...close Sacrifice...reload scapex...make adjustments....over and over and over again. Its a never ending process that can be extremely time consuming. So hopefully this brief guide will save you a bit of time during your trial and error period. I think if the manual would have included indepth examples of how triggers are set up, then we would be seeing a lot more products of Scapex. One good way to find out how to do something or to learn specifically how somebody did something, is to simply load the map into Scapex and look at the triggers they've used and how they've been set up. I am by no means, an expert on Scapex. There are still a lot of things I dont know about it but I figured I would share what I have learned with anyone who wants to learn. This guide is outlined primarily for cutscenes and single player scenarios. Well lets begin, shall we........




Important things to keep in mind when creating a map:

  Triggers at their most basic level, are nothing more then cause and effect situations. You set the cause or condition that will activate the trigger, and then set the effect or what is to happen if the set conditions are met. Also, save yourself some time and frustration by making backups of your maps. Several people have reported saving and loading problems with their maps and have had to start over from scatch. So just in case, try to aviod this and always save a backup of your work. Which brings us to a little bug you should try to avoid if it effects you. This happens when you save your map under its normal name, then save it again under a backup name, and then save it again under its original name, as a way of getting back to the original name. What happens is you will usually get a load error when you save back to the original name. To avoid this, after you've saved under the original name and then the backup...close Scapex and then reload it and open your map from its original name (if thats the one you want to work with, that is). Try not to go too crazy on widgets either. Widgets are the extra little things like flowers, weeds and rocks that can be used to spice up the landscape. For one, if you use a lot of them, they will increase the size of the map file a bit and they can be a pain if you need to remove a bunch, especially since they can only be seen very close to the ground when in Scapex. Keep in mind the overall amount of items that you place also. A huge amount of items such as numerous trees, widgets, creatures, etc...can really slow down the graphics engine, especially on slower pc's. There doesn't really seem to be a limit for the amount of triggers you can use. I've used nearly 150 on one map and couldn't noticably detect any slowdown from it (and this is on a PIII 600mhz, 128 ram). Sound files or Samples on the other hand, can soon add up and make your map file extremely large. More on that later...

  There will always be at least two sides when you first create a map. First there is the single player side. This is the side for anything belonging to the playing character, even triggers that will effect this side. And then there is the neutral side. Several items can only be found under this side. Things like trees and manafountians can only be found under the neutral side, so if you can't find something, check there. You will not be able to change certain types of items from anything other than neutral side also, mainly just items of nature like the trees and rocks. When placing manaliths, keep two things in mind. First, you can only place manaliths on top of existing manafountains. So place a fountain, and then you'll be able to stick a manalith on top of it. Several people have asked why all they get is a red X when they try to place a fountain and the reason is almost always because they dont know to place it on top of a fountain. Secondly, when placing a manalith, its important to keep in mind the type of manalith you are placing. You will want it to match to the same god as the one of the wizard that it is for. So if your wizard is set to charnel as its god, and you place nothing but Stratos manaliths for that wizard, then that wizard will not get any mana from the manaliths and is likely to just stand around most of the time, doing nothing. An enemy wizard that doesn't have a good source of mana and souls, cant do much and is an easy opponent. Also try not to space manafountains too far apart or too few or they will seem useless. Then again, spacing them could be used to increase challenge a little as too many might make mana regeneration very fast giving the player an easier time casting spells. Souls are important also and there are several ways to provide the AI with them. One way it through triggers that directly give a wizard souls. Another source is to set the starting soul amount under the wizards properties. Another source is to pre-place souls around the map for the first come, first serve kind of thing. And lets not forget another source of souls...yep, you guessed it, from the single player.

 1. Always save a backup of your map, just in case
 2. Try to avoid extreme usage of widgets and such
 3. There is no limit on triggers (or at least I haven't run into it yet)
 4. Some items are only found under the neutral side
 5. You can only place a manalith on top of a manafountain
 6. Always match the wizard and his starting manaliths to the same god
 7. Try to avoid placing too few or too many manafountians
 8. AI must have access to mana and souls to be effective



Setting up basic triggers:

  Triggers are extremely fun to work with and set up once you get a basic understanding of how to use them and hopefully this guide will be enough to get you started. First we will discuss conditions. As mentioned above, the condition is what will activate the set trigger actions. So this is the most important part of the trigger as you dont want them going off at just any time or not at all. It's very easy to mess up the conditions so that the action never goes into effect, so pay close attention when setting them up. Also, before you get into triggers, you will want to set up all the sides that will be used during the course of the map, in the side properties under the Scenario menu in Scapex. There doesn't seem to be a limit on how many different sides you can have, and you can have a side set up for as few as 1 creature (or no creatures at all for that matter). The actions set by triggers can only execute for the side the actions are going to effect, therefore triggers must be placed under the appropriate side. Lets say that you are working with 3 total sides (not including the neutral) and we will call them Singleplayer side, Marduks Forces, and Smokin' Joe. Just like with variables, you can name the sides whatever you like as that wont matter. Now if I needed a trigger that told Smokin' Joe to go somewhere at a certain time or under a certain situation, I wouldn't want to put this under the Singleplayer side or Marduks Forces side because even if the conditions are met, the actions wont take effect because they are under the wrong side. The side the trigger is under MUST also control the creature or item to be effected by the actions set in the trigger. The conditions can be for any side though. For example, we can have the condition be something like "if Marduks Forces control wizard within 25 meters of Single player wizard, then order Smokin' Joe to attack Marduk 38". But this trigger will only work if we place it under the Smokin' Joe side which Smokin' Joe belongs to. So the conditions that have to be met can reference any side but the actions must be set to effect the side they are set up under. Also remember that its not a good idea to use markers to activate triggers. For some reason, triggers dont always like to activate when the condition is set to a marker. For example, a trigger set up to tell Smokin' Joe to attack something when he gets so many meters within marker 45, might never go off because the condition refers to a marker. My solution for this was to place a tree or some other object near the marker and have that be the reference under the condition.

  Actions are what is to occur once certain conditions are met. This is where you can get extremely complex with things and this is most likely to be the main focuss when testing and setting up your maps. Like with conditions, setting up the actions will have you dealing mainly with statements that refer to sides, creatures, structures and ntts. Sides refers to what side the creature or structure belongs to and creature or creature type refers to, of course...yep, creatures. Structures refer to buildings, while ntt refers to just about everything you've placed on the map, including markers. Now markers work much better with actions. A marker is simply a designated spot on the map. It is invisible to the player during the game and things like its range of area and name can be edited under the markers properties. Markers work great for things like giving a creature the order to go to a certain spot, or to even guard or just stand in that certain spot. They also work great for placing camera view points during cutscenes but more on that later... They can even be used to tell a creature what direction to face, by setting an action that orders the creature to face the marker. You can usually use markers to designate where spells are to be cast. Automatic spells (the autocast trigger) seems to work when using a marker, creature, wizard or object (such as a tree or building) as the target. I dont know the reason for this, but 75% of the time when I couldn't figure out why a certain trigger wasn't activating or completing correctly, was due to the fact that I was using a marker as the focus somewhere in the trigger. Once replaced with a physical object, the triggers would usually start working correctly. Keep that in mind if something doesn't seem to be working right. Actions can be anything from starting a cutscene and giving creatures orders, to changing the weather or ending the scenario (in victory or defeat). This is where Scapex really shines because the amount of different actions you have access to, with a little imagination, can lead to some very interesting and different ideas.

  Triggers can only be set up to effect pre-placed creatures and objects. The only exception to this is when using the triggers that use creature type as the focus. Also keep in mind that when different enemy sides come into contact, even when under orders through triggers, the enemies will often stop what they are doing and engage in combat. This even occurs during a cutscene. One way you might try to get around this is to temporarily have the creatures in question, be neutral or friendly to each other, at least until the desired action is completed. You might also want to try to avoid using the and condition. I've had better success with using the or condition. Sometimes these can produce undesired effects or none at all. If you need multiple conditions to set off a trigger action, simply stack them by adding them one at a time under the conditions table. There doesn't seem to be a limit on how many conditions you can place to be met before the action takes place. It's the same for the not condition and you can mix as many as you like (including variable conditions) as long as it is possible for all of them to be met at the same point, otherwise nothing will ever happen. Every item you place will have a number beside its name that tells Scapex exactly which creature or item is refered to. This is the reason it's difficult to set up triggers that involve creatures that aren't pre-placed on the map at the start of the game. You can't set up the action to effect a creature if you dont know the exact creature to be effected, unless its an area type trigger that will effect any creature in the area. For example, you can have triggers that goes as follows: "If game elapse time is at least 12500 frames" then "order all dragons at marker 64, attack Marduk 35". All dragons in the range of marker 64 will be ordered to attack marduk after the correct time has elapsed, but only if those dragons belong to the same side that the trigger is under. In that type of trigger, it doesn't matter if the dragon was pre-placed or player created. You can't, for example, set up a trigger that states that if the singleplayer wizard has at least 1 dragon and there is a creature within so many meters of the dragon that has at most 0 health (meaning...dead), then order dragon cast breath of life on creature. First off, you can't give an order to a creature, telling it to use its natural ability, unless you know exactly which creature to give the order to. This means that it would have to be pre-placed and you could only put in a specific creature, like dragon 23. Also, you would have to know exactly which creature has "at most 0 health" and exactly which creature to cast breath of life on. This would be ok: "If singleplayer control dragon 23 within 75 feet of warmongrel 62" -then add- "If warmongrel 62 has at most 0 health" then "Order dragon 23, cast breath of life on warmongrel 62".

  The above example would work well if the dragon came within range of the warmongrel and the warmongrel was dead. By default, trigger actions are set to occur only once. You can remove the check from the action table flag labeled Run Once if you wish this action to be performed every time the conditions are met. Be careful when disabling this flag. The trigger will repeatedly go off over and over again until the conditions are no longer met. So you wouldn't want a trigger like this, set to occur more then once: "If singleplayer side controls singleplayer wizard within 35 meters of tree 72" then "Create 1 locust at marker 123". What would happen is that even though you told it to only create 1 creature, it would continuously creature 1 locust after another, very quickly and for as long as you stood within 35 meters of tree 72. Before you know it, there would be an army of locust. There is an easy way to prevent triggers that need to run multiple times from running too often and that is to add in the pause command. Under the action used above, add "pause for 1500 frames". This would make it so that every so many second that you stood within range, a locust would be created. 60 frames is equal to about 1 second. Often when placing multiple actions under the same trigger, it's a good idea to place the pause trigger in between actions. Sometimes actions in the same trigger don't wait for the previous action to stop, before they start. One is usually launched one after another, unless you add the pause trigger. To give actions time to execute, a "pause for 25 frames" is usually good enough and is sometimes not needed at all. There are some exceptions of course, like with samples. In a trigger action that uses sample, the next action wont usually go into effect until the sample is done playing. You can use variables to get around this, if you need to set up actions that occur as the sample is playing...again, more on that later...

  1. Remember to set up the different sides that will be used in the map
  2. Conditions are the cause and actions are the effect in triggers
  3. Trigger conditions can reference to any side
  4. Trigger actions will only effect the side they are set up under
  5. Avoid using markers in conditions for triggers...unreliable results
  6. Pre-placed creatures and objects- can be specifically triggered to a great degree
  7. User created creatures-limited to area effect triggers, cannot be targeted specifically
  8. Enemies engage in combat once within range, even with trigger orders and during cutscenes
  9. Be careful when disabling the Run Once flag at the bottom of the action table
10. Use "Pause for xxx frames" trigger to adjust time for an actions execution or repeat



Samples & Variables:

  Samples and variables are discussed briefly in the manual, but not to the extent of giving the user a good idea of how to properly use them. Variables are primarly used for setting up special conditions to activate triggers. For example, if you have a trigger that you only want to be activated at a certain time or when a certain situation occurs then variables are a good idea. You can call a variable anything you like, just be sure thats its something that will remind you in some way of what the variable represents. For example, if you want a trigger activated only when a certain character is attacked (for this guide we will use Smokin' Joe the warmongrel, as our example character) then you might call the variable something like "Smokin' Joe is attacked". It doesn't really matter what you name the variable, just as long as you remember what it represents. By default, variables are set to faulse. This is important to remember when using them because the whole purpose of using variables is so that they will activate triggers under certain conditions and you dont want them setting off at just any time. So here is what we would do. First we create the variable. Then we will need to create one trigger that will make the variable true and another trigger that will describe the action that is to occur when the variable becomes true. Something like the following would most likely work:

(Example variable) Smokin' Joe is attacked
Trigger 1: "If Warmongrel 67 is attacked by Marduks Force" then "Set Smokin' Joe is attacked equal to true"
Trigger 2: "If Smokin' Joe is attacked true" then "autocast lifeshield on Warmongrel 67"

The above example would only work if you made sure that the second trigger was placed under the Smokin' Joe side, otherwise the shield might not cast on the warmongrel. The trigger that sets the variable to true can be under any side since it doesn't directly effect any creature or object. If you wanted the shield to come on every time the warmongrel was attacked, just remove the check from the Run once box near the bottom of the action table. During a cutscene, variables are very useful to jump to another trigger when you need actions to take place during a sample. For example, if you had a section of music you wanted to play as the camera moves around or as creatures perfom certain actions during the cutscene, you would want your last 2 actions in the first trigger to be: "set true" and then "play sample". Then create the next trigger using the previous variable set to true as the condition for it. This way you can have the sample start in one trigger and then as it starts to play, the variable causes it to switch over to another trigger allowing actions to occur at the same time. This is very useful and is sort of like using variables to jump from trigger to trigger. If put the set variable command last, it wont be set until the sample finishes playing, so make sure it's just before the play sample command.

  Samples are simply sound files that you create or input into the scenario. They have to be in 8 bit wave format. It doesn't really matter whether they are in mono or stereo and the quality (11,025hz/22,050hz/44,100hz,etc) is up to you. Just remember, the better the quality - the larger the overall map size. I recommend using a program like Goldwave and recording voice samples at 11,025hz and music samples at 22,050hz but it's totally up to you. Samples are great and can really bring a scenario to life. Plus it's fun trying to make voice samples for the characters in your scenario. One problem with samples is that the trigger's action commands are temporarily stopped for the trigger, while the sample plays. Normally trigger actions occur one right after another, or perhaps one frame after another, but samples normally play out before the next action is executed. The easiest way to set up a sample that plays while other actions occur, like during a cutscene, is to set up two seperate triggers and use a variable that when set to true, will play the sample. Lets say for example, that we have a sound file we want to add that is a piece of music that's to be played as a character walks over and kills another creature. Now lets assume that we've already created our wav file (sample) and we've called it heavyintro.wav. We will do this with 2 seperate triggers. Since multiple triggers can run at the same time, the sample will start to play (triggered by the variable being set to true) just after the warmongrel is ordered to go to the zombie. Then after a couple seconds, the warmongrel 16 will attack the zombie 45, whether the sample is done playing by then or not:

(Example variable) Zombie must die
(Sample) heavyintro

Example Trigger #1:

"If singleplayer side controls warmongrel 16 within 50 meters of zombie 45"
then
"Cinematics start"
"Set view origin from warmongrel 16, focus to zombie 45"
"Order warmongrel 16, go to zombie 45"
"Set Zombie must die equal to true"
"Pause for 250 frames"
"Order warmongrel 16 attack zombie 45"
"Pause for 200 frames"
"Cinematics end"

Example trigger #2:

"If Zombie must die true"
then
"Play sample (heavyintro)"



Putting together a cutscene:

  Cutscenes are probably the best part about making single player scenarios. You want your cutscene to look really cool and show off the graphics engine, but at the same time, tell a story and/or set up the atmosphere. Don't try to do everything for the cutscene in one trigger. It's perfectly ok to break the cutscene up over many triggers and over triggers of different sides. For example, you can have your first trigger set it into cutscene mode, set the starting view and start a sample playing. Then based on the variable, jump to a new trigger with a few nice camera movements. Then possibly on to a couple different sides as the creatures perform given actions, and then an ending. There are all sorts of possibilities for cutscenes and they can be as long or short as you like. The first consideration for a cutscene should be the condition or trigger for the cutscenes start. You might want your scenario to start with a cutscene or have a cutscene kick in after a certain time. You might also want a cutscene to kick in once a certain character gets to a certain location on the map or performs a certain action. The choice is yours. After you decide on the conditions for the cutscene's start, the next thing to consider is camera placement...and what you want to happen in the cutscene as far as camera movements and creature movements. Markers are great for camera work as the "set view origin from marker xx at xx meters height, focus to xxxx" trigger will become one of your best friends...as well as the "set view speed to xxx" and "fade to xxxx over xxx frames" triggers. So the first trigger for a cutscene that starts when the player gets to a certain location, might go as follows:

(Example variable) Cutscene starting
"If singleplayer side commands singleplayer wizard within 50 meters of Ruined Temple 47"
then
"Cinematics Start"
"Set view origin from marker 37 at 10 meters height, focus to singleplayer wizard"
"Set variable Cutscene starting equal to true"
"Play sample(xxxx)"

  Then you could set your next cutscene trigger up using the condition of "If Cutscene starting true", then proceed to do whatever you'ld like while the sample was playing. You may want to add in some camera panning effects with "set view speed to xxx" trigger. 0 equals instantaneous movement while larger numbers slow the camera movement speed. The number represented here by the xxx determines the length of time (or number of frames actually) it take the camera to move from one location, to the next. A number like 300 might make for a nice smooth steady speed, depending on the distance the camera has to move between places. Another way to simulate camera movement is to set the focus to a moving target, such as an approaching character. The fade to xxxx over xxx frames" trigger is very useful also for creating nice fade-outs at the end of a cutscene or for flashes of color like red, during a battle scene. Its tricky setting up a fade-out at first because the actions occur one right after another. Here is an example of how you might create a nice ending fade out effect, and avoid the camera jumping that can occur when coming out of a cutscene and returning to the behind the wizard view:

"Fade to Black over 125 frames"
"Pause for 125 frames"
"Cinematics End"
"Pause for 75 frames"
"Fade to clear over 150 frames"

  The pause commands allow time for the fade in and outs to occur before the camera starts jumping back to its origin, but you may have to adjust depending on the distances the camera has to move.



More Examples of Triggers:

(Note: The numbers used with the items in the following triggers are only examples. Your creatures and objects will have their own corresponding numbers, generated when the item is initially placed on the map)


Trigger purpose- Creates a transparent familiar thats follows your wizard

"Always"
then
"Cast Ghostly form at familiar 29"
"Order familiar 29, guard singleplayer wizard"

  For this trigger to work, you would need to have familiar 29 somewhere on the map and on the same side that you placed the trigger under. Ghostly Form only needs to be cast once but in order to have the familiar always follow the wizard around like in the single player campaign, you have to use the order command as above and remember to disable the Run once flag on the action table of the trigger. Since the actions effect the familiar, the above trigger will fail if it's not under the same side as the familiar. You could break this up into 2 seperate triggers, one that cast Ghost Form and the other to tell the creature to always guard your wizard. You could also substitute the Guard order with the Go to order. I've noticed that sometimes familiars don't like to go transparent when using Ghostly Form on them, but I've had no problems using the Zyzyx creature in place of a familiar.



Trigger purpose- Guardians creatures to manaliths at the start of the game

"Always"
then
"Cast Guardian at Pheonix 34"
"Cast Guardian at Hellmouth 17"
"Cast Guardian at Rhinok 54"

  This trigger will automatically guardian these specific creatures to the manafountain they are standing next to at the start of the game. The creature's side, manaliths's side and the side the trigger is placed under, must all match for it to work. When you guardian several creatures in the same trigger, the creatures dont have to be next to the same manalith but they will have to be within range of a manalith of their side.



Trigger purpose- enters cutscene, starts to rain, camera pans, fade-out, ends cutscene

"If singleplayer side controls singleplayer wizard within 50 meters of tree 29"
"Not if Marduks Force controls at least 1 creature within 50 meters of tree 29"
then
"Cinematics start"
"Set rain on"
"Set view origin from marker 47 at 12 meters height, focus Singleplayer wizard"
"Pause for 125 frames"
"Set view speed to 300"
"Pause for 25 frames"
"Set view origin from marker 47 at 12 meters height, focus to Ruined Temple 53"
"Pause for 300 frames"
"Fade to black over 125 frames"
"Pause for 125 frames"
"Cinematics end"
"Pause for 50 frames"
"Fade to clear over 125 frames"

  The added "not" condition is used here so that the trigger wont go off if the enemy is also within range. Sometimes you might not want it to be in the middle of a battle with the enemy when the trigger goes off or cutscene starts and this is a good way to prevent this from happening. The "pause for 300 frames" allows the camera to finish its movements before the next action occurs. Since we set the view speed to 300, it's going to take the camera 300 frames to complete the movement. The camera speed will stay at 300 until you enter in a different speed or go to another trigger. The first pause command after "fade to black over 125 frames" allows time for the fade-out to occur and make sure the screen is black before the camera shifts back to the behind the wizard view when the cutscene ends. You don't want to see the camera shifting while the screen is still fading to or from black, which is also the reason for the pause just after the cutscene ends. The last fade to clear command brings everything back into view, with the view automatically set back to behind your wizard.



Trigger purpose- cutscene starts, creature speaks while sample is played, variable set to true, jump to another trigger

"If elapsed game time is at least 12500 frames"
then
"Cinematic start"
"Set view origin from marker 65, focus to slave 33"
"Speech slave 33 says (Please help us...we are doomed...) auto-timed with sample(helpus)"
"Set variable (plea for help) equal to true"

  In this trigger, the cutscene will start after a certain amount of time. The view will immediately be switched to the creature (slave 33) and then a text box appears as a sample is played, usually representing the text or setting the mood with music. The Auto-timed option is used so the text will disappear after the sample is played. The variable wont be set until the sample is done playing either so you can set up the next trigger to take over the cutscene, with the condition of "If plea for help true" then set whatever actions you wish to occur next in the cutscene. Just remember to set the trigger under the side that will be effected by the actions in the trigger.



  I hope this guide will help some of you and there is so much more that we could have touched on, but hopefully this will give you enough information to get a good start. I've probably made several errors though-out this little guide and you may be able to find lots of better ways to do things so please forgive any inaccuracies....Glad I could help.....Elrick