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


Who Dun' It?

NWN scripts pretty much live alone, completely unaware of any of the other scripts that are there. That means that every time a script runs, you usually have to spend a few lines of code figuring out "who did it" and "who they did it to."

Who Spoke?

When a conversation takes place, it typically occurs between an object (NPC or placeable) and a player. When a conversation node kicks off a script (through the "Actions Taken" or the "Text Appears When" tabs) that means you're probably going to do something to the PC that's involved in the conversation and possible to the object running the conversation. Use these commands to locate that data:

object oSelf = OBJECT_SELF;
object oSpeaker = GetPCSpeaker( );

(Of course, OBJECT_SELF is a constant, so you don't really need to store it inside another variable). And I used oSpeaker, but you could use anything oPlayer is a favorite because, after all, who else would be speaking?

Who Used the Placeable?

If a player clicks on a placeable that is set to be "Used" then you'll want to find out who used it.

object oPlayer = GetLastUsedBy( );

Who Activated an Item?

If there's a "magic item" that can be used--particularly if you created it using the Unique Power-Self Only option, you'll need to find out who used it and what item was used. Remember that this is usually done as part of the module's onActivateItem script...

object oPlayer = GetItemActivator( );
oItem = GetItemActivated( );
string sItem = GetTag(oItem);

For all you programmers out there--yes you can nest things. I could have found the tag of the item with this line instead:

string sItem = GetTag(GetItemActivated( ));

If I want to test the tag of the item against a known string (say the "bent_wand") I could even nest that into my if( ):

if(GetTag(GetItemActivated()) == "bent_wand")

...but I find that to be a bit glazed-eye inducing, so I tend to break it out one-line-at-a-time, just like high school alegbra!

Who Crossed the Trigger? Who Entered the Area?

To find out who entered a trigger or entered an area, use:

object oCreature = GetEnteringObject( );

To find out who left a trigger or area, use:

object oCreature = GetExitingObject( );

Was It a Player? a DM?

Once you've "put your finger" on the creature that caused the script to run, you might want to find out if it was a player or a monster that did it.

For triggers and areas, its it quite possible that the "entering object" was not a player but was a creature. Typically you will want something to happen when it's the player...and nothing when it's a monster. So you'll have to test the identity of the creature after you find out who it is:

object oCreature = GetEnteringObject( );

if(GetIsPC(oCreature) == TRUE)
{
...//your code
}

Of course, here I'm testing to see if the entering object was a player, but once your script has identified the oCreature of any of the events, you can test to see if it was a player.

Usually, the DM character doesn't trip triggers. But he can (I think) make an area's onEnter script fire. Regardless, you can also find out if the person who caused the script to run is a DM character.

if(GetIsDM(oCreature) == TRUE)

and now you know.