Main Menu

Site Home Page

Glossary of Terms

Current Class Mod Package

Divider

Help! My mod is corrupted!

Divider

Week of June 15th, 2009

Topics:

  • Getting Help
    • The "Assistance" windows
    • The Lexicon
    • The Forums
  • Variables
    • Type-casting and the types
    • Conventions
    • Constants
  • Who Dun' It?
    • Who Spoke?
    • Who Used the Placeable?
    • Who Activated the Item?
    • Who Crossed the Trigger? Who Entered the Area?
    • Was it a Player? a DM?
  • Creating Objects
    • Preparing the Object
      • The Resref
      • The Object Type
    • At a Waypoint
      • Find the Waypoint
      • Find the Location
    • Where the player is
      • Find the Location
    • Create the Object
      • Deciding on a Tag
      • Spawning in the Object
      • Doing Things to the Object after Creation
  • Tracking Variables
    • Local Variables
    • Persistent Variables
  • Some Useful Scripts
    • Making Changes to the Avatar When It Enters the Game
    • Fiddling with the Avatar's Inventory
    • Destroying the Inventory Items
    • Destroying "Non-Destroyable" Items
    • Taking Gold From the Player
    • Giving Gold To the Player
    • Giving General Inventory Items to the Player
    • Giving Equipable Items and Forcing an Equip Action
    • Random Walk

Homework: Dungeon and Quest

Divider

Week of June 7th, 2009

Topics:

  • Items
    • Properties
    • Building your own items
    • How to make an item have a conversation.
  • Creatures
    • Properties
    • Building your own
  • Triggers
    • Choosing the right one
    • Drawing a trigger
    • Trigger Properties
    • Trigger Events and Scripting Preview
    • Examples of Trigger Use
  • Waypoints
    • Waypoint Properties
    • Waypoint Directions
    • Uses for Waypoints
    • Scripting Preview
    • How to Set Up a Patrol Route
  • Conversations
    • How they're used
    • The basic tree.
    • Branching
    • Links (or "Loop backs")
    • Tokens: Built-in and Custom
    • Colorizing the Text
    • Including Other Speakers
    • "Actions Taken" and other events
    • Conditional Nodes
  • The Journal
    • Categories
    • Entries
    • Updating the Journal through Conversations
    • Updating the Journal through Scripting
  • How to Test Your Mod
    • The Build Module Option.
    • The Real Way
    • The Test Module Option

Homework:


Divider

Week of June 1st, 2009

Topics:

  • Areas
    • Area Properties
    • Module Properties
  • Tiles
    • Tile Properties
  • Names
    • Blueprint / Resref
    • Tag
    • Display Name
  • Doors
    • Door Properties
    • Transitions between doors
    • How to make a door close itself
    • How to have a transition without a door
  • Placeables
    • Placeable properties
    • Spawning placeables.
    • How to stack placeables
    • How to have a placeable hold a conversation

Homework:

Divider

May 27, 2009

Topics

Homework

 

 

GAME CONCEPT AND DESIGN
COSC 320.101_SU09
SUMMER 2009


Triggers

If you think of a trigger as a "trap door," you'll have a good idea of how they're used. They're not trap doors, but they are sections of the map that do special things when a creatures steps on them.

Technically speaking an "encounter" (one of the buttons on the toolbar) is also a trigger but they behave a bit differently, so Bioware put them in their own area of the toolbar.

Choosing the Right One

There are lots of different types of triggers and you can play with them a bit, if you'd like, to see how they are set up to do the things they do. We are only going to look at a the "Generic" trigger and how you can use it to accomplish some of the things you might need to do in your learning games. So, from the Triggers palette, just choose New Generic.

If you know your trigger will be an area transition, select the New Area Transition trigger instead. This is for instances when you want to allow the player to move from area to area, but there isn't an obvious door to click. You can paint a trigger on the ground and let that serve as your door.

Drawing a Trigger

After choosing New Generic, move the mouse out onto the map and you'll see that it's the shape of a paintbrush. You're going to draw the outline of the trigger. So click where you'd like the trigger to begin and the toolset will "set" that point. Now, when you move the brush, you'll see a line stretch from the point to the brush. Click again to set the point for the next "corner" of your shape. Keep doing this to create the outer perimeter of your trigger. Once you get more-or-less where you want to close up the shape, double-click and the editor will close it up.

Now you have your trigger. You can click and drag it to a new location if you need to.

BEWARE: That the editor will let the line "crawl" up the side of a wall and sometimes over the scenery which will cause unexpected results when the player moves, oh, below the trigger. So just be careful to make sure that the lines are really on the ground. Move the editing camera around and get down to eye-level to make sure it's situated properly.

If you need to redraw the trigger, you can right-click anywhere inside it and select Redraw Polygon from the pop-up menu.

Trigger Properties

Yup, and it has a few tabs.

Basic: Is pretty basic. Name and Tag, there they are.

Scripts: We'll revisit this in a moment but here's a bit of a preview of the events:

onClick is when the player clicks on the trigger. However, only triggers that are set up to be Area Transitions will be clickable.

onEnter is when a creature enters the trigger.

onExit is when a creature exits the trigger.

onHeartbeat and onUserDefined are the same as other objects.

Advanced: Here are more of the, er, standard advanced properties that we've been seeing. There are a couple of notes, though.

Key Tag: If your trigger is an Area Transition Trigger and you only want it to work if the creature has a particular item in its inventory, type the tag of the item here.

Auto-Remove Key: Check this if you want the game to remove the key item from the player's inventory once they transition.

Blueprint: Although you probable could spawn copies of the trigger in your module, they might not work well given the drawing problems mentioned above.

Cursor and Portrait: I have no idea why these are here. Only Area Transition triggers can have a cursor..and there's only one to choose from. And triggers can't talk, so there's no need to give it a portrait. <shrug>

Variables: Yup.

Comments: Need I say it?

Area Transition: This tab only shows up if you choose the Area Transition trigger. It works pretty much the same way as setting up a transition for a door.

Scripting Preview

When you get ready to start using triggers, you'll probably be writing scripts for them. Here's a few things to let percolate in your heads as you prepare for it.

  1. One of the first things you'll want to do is get the identity of the creature that entered the trigger. The command for this is GetEnteringObject( ). So if we used this line:

    object oCreature = GetEnteringObject( );

The identity of the creature would be placed in the variable oCreature (which is a "object" type variable)

  1. After getting the identity of the creature, you might want to check the type of creature. Players, NPCs, and sometimes the DM character can all trip triggers and you might not want that. So you can check for Player or DM using GetIsPC( ) and GetIsDM( ) in an if( ) construction. So after getting the identity of the creature (using item #1 above)...

if(GetIsPC(oCreature) == TRUE)
{
   //your code for what to do if it's a player
}

if(GetIsPC(oCreature) == FALSE && GetIsDM(oCreature) == FALSE)
{
   //your code for when a creature enters the trigger
}

  1. You might want to get the tag of the creature so that the baby dragon trips it, but the orc chief does not. Use GetTag( ) to get the tag of the creature.

    object oCreature = GetEnteringObject( );
    string sCreatureTag = GetTag(oCreature);

    if(GetTag(oCreature) == "baby dragon")
    {
       //code for the dragon
    }

  2. To get the identity of the creature who exited the tag, use GetExitingObject( )

Examples of Trigger Use

As you start playing, you'll start thinking of ways to use them, or begin realizing that the only way to get a particular effect is to use a trigger. But here's a few examples.

  1. As mentioned, you might want to have an area transition in a location where there isn't a handy door. So paint a trigger on the ground.
    1. If you it to be a click-able transition, then use an Area Transition Trigger and set it up accordingly. They player's cursor will change to the door icon and they can click to move.
    2. If you don't want it to be clickable--if you want them to jump when they enter the trigger--use a Generic trigger and write your "teleport" script in the trigger's onEnter event.
  2. Sometimes, you want to fiddle with the player's inventory when the module first starts up, but you can't do it on the module's onClientEnter event because although the client has logged on, the player's avatar has not yet entered the world. But you can put a trigger around the start point and when the avatar enters the world, they'll trip the trigger and your onEnter event fires. Your script then:
    1. Checks to make sure the entering creature is a PC.
    2. Checks the PC for a variable like... if(HasBeenStripped == TRUE) .(you can attach variables to avatars through scripting).
    3. It won't find the value you're looking for because the variable does not yet exist.
    4. Do all the work you need to do to the character.
    5. Then create the variable HasBeenStripped, set it to TRUE, and attach that to the avatar.
  3. In the case of my girl in the cave, I set a trigger at her home location. When the game began , I created a variable (something like "CurrentStep") set it to 1 and attached it to her.
    1. When you click her in the cave, CurrentStep is equal to 1 so the script has her run conversation 1.
    2. When you open the door, my door script set CurrentStep to 2, so she plays conversation 2 and heads for home.
    3. When she got home, she entered the trigger which checked to see if it was her (because the player and dad could enter the trigger as well). If it was her, I set CurrentStep to 3 which caused her to play Conversation 3.

So, using triggers sometimes requires a bit of finesse, but they're very handy for doing those sorts of things....and others.