If you haven't already refer to HELP TRIGEDIT-MOB-TUTORIAL. The process is
the same:
1. Decide what you want the trigger to do.
2. Make the mobs, objects, and rooms.
3. Split up the quest into simple sections.
4. Decide what trigger types you need.
5. Write the triggers.
6. Attach the triggers - permanently
7. Done ?
Decide what you want the trigger to do.
First determine the type of trigger you want: Room, Mobile, or Object.
Then decide what action you want to activate the trigger. Doing this before
worrying what can be done prevents you from limiting yourself to what you have
seen other triggers do, and allows you to produce a more interesting trigger.
For this example, I want to create a gate guard for a small walled town. The
ruler of the town has decided that each group of people will be charged ten
coins to enter his domain. The gate guard must notify travelers of the cost to
enter, collect the money, allow people who have paid to enter the city, and
close the gate after them. This will be a mob trigger.
Make the mobs, objects, and rooms.
Split up the quest into simple sections.
Decide what trigger types you need. HELP TRIG-TYPE
Our gate guard needs to react to four different events. These events are what
will cause the triggers to fire. Remember: a trigger requires a "triggering"
action. i.e. speech, command, greet, etc.
1. A character entering the room from the south needs to be told the price for
entrance. This will be a mobile greet trigger. HELP TRIG-MOB-GREET
2. When the guard is given ten or more coins, the guard must open the gate. This
is done by a mobile bribe trigger. HELP TRIGEDIT-MOB-BRIBE I also want
the guard to give change and refuse entry for those without the money.
3. When someone passes through the gate, the guard must close and lock the gate
behind them. This is done with a mobile act trigger. HELP TRIG-MOB-ACT
4. When the gate is opened from the other side, the guard must eventually close
it. This will be another act trigger.
Determine the arguments and the numerical arguments of the triggers from the help
files. For the bribe trigger, the guard must respond whenever someone gives him
some coins, so Numeric Arg should be 1. The Act triggers should fire off "leaves
north" and "the gate is opened from the other side."
Write the body of the trigger.
This is the most complex and time consuming part. The valid commands and
variables are explained in the help files HELP TRIG-COMMANDS and HELP
VARIABLES. Expressions are also used: HELP EXPRESSIONS
For the greet trigger, I want the guard to inform anyone entering from the
south how to get into the city. First, I must check if the character is
entering from the south. If they are then the guard should tell the actor the
cost of entry. TSTAT 4
Under HELP TRIG-MOB-GREET we see that the variable %direction% is set to
the direction that the character entered. The percent signs around any word
means it is a variable and it can be found in HELP VARIABLES. The two equal
signs together compares the value of the variable to the word "south" if these
are equal the lines in the body of the if will be executed. The "wait 1 sec"
pauses the trigger for 1 second to allow the character to enter the room. (The
greet trigger is actually checked before the character enters the room. After
another brief pause, the guard announces the cost to enter the town. The
indentations are not needed, but make it easier to read. You can auto-indent a
trigger by using /f or /fi. This is HIGHLY encouraged. Remember, every if needs
an end!
The guard must open the gate if ten or more coins were given to him. TSTAT 5
After a brief wait (so everything doesn't happen at once), the guard unlocks
the gate and opens it. The guard will close the gate after 10 seconds, even if
no one passes through it. For the line "give %amount% coins %actor.name%", the
variables amount and actor are both set when the bribe trigger is called, these
variables are automatically substituted.
For the first act trigger, I want the guard to close and lock the gate after
someone passes through the gate. The guard should wait briefly so he isn't
shutting the gate on the character's back, then close and lock the gate. TSTAT 7
For the last act trigger we want the guard to close and lock the gate when it
is opened from the other side. TSTAT 8 The "wait 5 sec" gives time for
someone on the other side to get through the gate. Next decide the order of the
triggers. The triggers are checked from first to last. If there are two
triggers of the same type, the first one run will be the only one run.
There are is one set of triggers which are the same type, the act triggers.
Since both have arguments that will not occur together the order does not
matter.
Write the trigger.
Simply use trigedit to create your trigger and they will be auto-saved for you
when you exit the editor. HELP TRIGEDIT, HELP TRIGEDIT-MENU for help
Attach the triggers.
In the OasisOLC medit, redit, oedit menus, use menu option S to enter the
trigger menu. Then select the triggers that will be part of your trigger. Note,
that order is important! If there are two possible triggers that could both be
executed at the same time, only the first one found in the list will be
activated. In this example. If you require two of the same trigger types to work
you must use a return 0. HELP RETURN-0
Test the trigger.
You should see how the trigger actually works in the game, and watch other
people interact with it. Often you will see ways you can improve it.
GOTO 13 and work your way north to test these out. Triggers 4, 5, 7, 8
See also:: TRIG-EXAMPLES, TRIG-GAMES