| |
Main Menu
Site Home Page
Glossary of Terms
Current Class Mod Package

Help! My mod is corrupted!

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
- Create the Object
- Deciding on a Tag
- Spawning in the Object
- Doing Things to the Object after Creation
-
-
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

Week of June 7th, 2009
Topics:
-
Items
- Properties
- Building your own items
- How to make an item have a conversation.
-
-
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
-
Homework:

Week of June 1st, 2009
Topics:
-
Areas
- Area Properties
- Module 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:

May 27, 2009
Topics
Homework
|
|
GAME CONCEPT AND DESIGN
COSC 320.101_SU09
SUMMER 2009
Items
Items are the things that the player can "pick up" and put in his inventory. They may be things like books and quest-props that just sit there, or they may be clothing, rings, and such that can be equipped.
Most items can be dropped on the ground by the player. Some of them will look something like what they are. For example, a sword on the ground tends to look like a sword; armor often looks like a shirt or similar. It would be impossible, however, to have every item have a unique representation when on the map, so Bioware defaults most things to a "bag" graphic. Drop a book on the ground, and it'll look like a bag.
Editing the properties of items can be a bit tricky as there are all sorts of "in the background" D&D rules that the engine takes care of for you. For instance, even if your game isn't D&D combat, your folks have to wear something, so you create a special suit of armor. You make it look at pretty with nifty colors and so forth. Well, it may well be that in the design process you've selected a few options that the engine has determined means your armor is heavy armor. When you try it on one of your characters, they can't wear it or it's so heavy that their movement is slowed down. So you leap back in the editor and discover that there's no way to change the weight of the item...but you can give it the special "Base Item Weight Reduction" property to reduce it's weight. Guess what? Now your armor is considered "magical" and might have a level restriction assigned to it to prevent lower-level characters from using items that are too powerful. And now that it's magical, it might not be "identified" which means the player can't use it until it is identified. (Identified is a D&D term..check the glossary!)
...and so on. It's not meant to make you fear working with items, but just to give you a heads-up that you may find yourself banging your head on the table here and there.
Item Properties
General: Most of the things here will be greyed out as they reflect the hard-and-fast D&D rules. You can't change them--directly. Sometimes, you can make changes in other tabs that get reflected here.
- Charges: This can be a bit awkward to explain. If an item is magical, it often has to be "powered up" like a battery. (Frequently this is already done for the player.) When the player uses the item's special ability, a number of charges is used up. When the item no longer has enough power to cast the effect, it won't. Depending on the game it may be possible to re-charge it. Or not, in which case the item becomes useless...which falls into the notion of conserving resources, another key game mechanism of RPG type games.
- Stolen: If--in the plot of your game--this item has been stolen from elsewhere, you can check this button. Merchants can be set up to refuse to buy stolen goods. I think you can even make it so that guards and such will be antagonistic toward the player while the player carries the item. (Guards are psychic, I guess.)
- Plot: If the item is so crucial to your game that the plot can't advance if the person doesn't have it, then you can set this flag to prevent the player from selling the item to a vendor or destroying it.
- Category: This is where, in the palette tree, the item is located. When you create your own item you can specify where you want to store it.
- Name, Tag, Resref: There they are!
Appearance: Here's the fun part. Depending on the item there will be a number of drop-down boxes to allow you to customize the look of your item. Mostly, the look will only be really noticeable in the player's inventory window although quite a few of the weapons and armor will also be visible in the gaming window. Additionally, the appearance is largely just eye-candy and has no impact on actual game play. The exception is armor where certain choices for the "torso" can change the weight, "class," and armor class of the armor.
Properties: Ok...this is another fun area. This is where magical effects are assigned to the item (if you want the item to have such an effect). The window has two panes. Find the effect you want on the left, then double-click it (or click the -> arrow) to move it to the right pane. You can click an effect in the right-hand pane then click the Edit Property button which takes you to another screen allowing you to fine-tune the effect. Most of the options there are self-explanatory.
- Undroppable: Hooray! This is a relatively new box (at least to me). Checking this box will mean that the player cannot get rid of the item. He can't drop it, trade it, sell it, or even die to get rid of it. It makes it easy to create cursed items. The only way to remove such an item is through scripting.
For those new to programming, here is an example of working around a problem. In the bad old days of NWN, we didn't have this checkbox. So to make this happen we had to jump through a number of hoops.
- We'd have to add lines of code to the module's onItemUnAcquired script and check the tag of every dropped item.
- If the item's tag matches the tag of the "cursed" item, then we'd jump into our extra code.
- We couldn't use script to pick the item from the ground and put it back in the inventory so we had to delete the item on the ground, then use the resref to create a new copy of the item and put that in the player's inventory.
The upcoming correction is another demonstration of working around the abilities of the system to get an effect you want.
- Identified: If you check this box, the item will be pre-identified for the player.
Most of the magical effects are self-explanatory. You'll use one, however, to create your own custom effects...so let's look at that for a moment. Click the + next to the Cast Spells group and it'll expand. Scroll down and find Cast Spell - Unique Power Self Only. This let's the player "use" the item. Now, you edit the module's onActivateItem script, check the tag of the item used, and then kick off your special effect. If you want the item to be used as often as the player wants, click the Edit Properties button and set the value to Unlimited Uses Per Day.
Description: This is what the player sees when he examines the item. The description that you display can change depending on whether the item is identified or not.
Comments: Again, just for you.
Building Your Own Items
It's pretty easy to build your own item. Go to the item palette, right-click and select New. A wizard will pop up that will walk you through the item creation process, most of which are repeats of the options in the properties sheet. The big challenge is finding the inventory "picture" that the player sees when it's in inventory. Selecting whether an item's graphic takes up 1 slot, 3 vertical slots, a 2x2 square, or some other configuration is complicated by the notion that some pictures (for example a head) only exists as a 2x2 square and not as a 1-square picture. And if you don't like the picture you can't change it. You have to delete the item from the palette and start again.
How to Make an Item Have a Conversation
When last I checked, "Items" can't have conversations. Placables can because they're static (more or less) things on the map. But items can't.
But....there's a workaround. As I said, items can't have conversations, but placeables can. So here's a workaround that works (and I know it works because I tested it while helping a student do the very thing.)
1: Create your book. Make sure you jot down the tag of the book.
2: In the Properties tab of the book sheet, you want to have “Cast Spell: Unique Power Self Only (Unlimited Uses/Day) showing. If you don’t have that, here’s how to get it. (If you do have it, skip to step 3)
In the left pane, click on the + next to Cast Spell
Scroll down and find Unique Power Self Only. Double-click it to make that text appear in the right-hand pane.
Now double-click that text in the right-hand pane, and a new window opens.
Double-click on Unlimited Uses/Day. You should see it in the left-hand field under Item Cost Parameter.
Click OK
3: Make sure the Identified box has a check mark in it.
Now, we’re going to create an invisible placeable that will actually run the conversation. But since it’s invisible, the player won’t see it! And we’re going to set it up so we can spawn it in to whatever location the player is when he reads the book.
4: Now, click the placeables button to get the generic scenery.
5: Click the + next to Miscellaneous.
6: Scroll down to find Invisible Object. Right-click on it, and select Edit Copy. (You’re going to make a custom one.)
7: Leave most things alone, but go to the Advanced tab.
8: Change the Blueprint resref to bookreader. (There’s our resref for later.)
Now let’s put a picture in the conversation window that looks like a book.
9: Click the black box next to Portrait. A new window opens.
10: Click the button next to Placeable Objects and Doors, then check the box next to Category.
11: Open the dropdown box and select Miscellaneous Interior
12: Scroll about 1/3 of the way down and you’ll see a picture that looks like a side view of an opened book. It’s plc_x0_tme_
13: Double-click that and the window will close.
14: Click OK..and your book reader object should now be in the toolset.
Let’s turn our attention to the script that will start the conversation. That’s the module’s onActivateItem script. Either go to Edit>Module Properties then click on Events, then click the Edit button next to onActivateItem, or if the script (x2_mod_def_act) is in the left-hand assets pane, just double-click it.
The script window opens.
15: Don't delete the default stuff, but add in these lines of code just above the last }. (Note that I'm going to use some <variables> to represent your information.)
If(GetTag(oItem) == “<booktag>”) //the tag of the book
{
object oPlayer = GetItemActivator();
location lLocation = GetLocation(oPlayer);
object oBookReader = CreateObject(OBJECT_TYPE_PLACEABLE,”bookreader”,lLocation,FALSE,”bookreader”);
SetName(oBookReader,”CPR and You”);
AssignCommand(oPlayer,ActionStartConversation(oBookReader,”<conversation>”,TRUE,FALSE));
}
16: Of course, make sure that all the cases are right, punctuation, and so forth.
17: Click the little TV screen in the top-left of the button bar to compile and save the script. Hopefully, at the bottom of the window you’ll see “….compiled successfully”
So, when the player “activates” the book, the game will create a new instance of the invisible object, name it “CPR and You”, and place it where the player is standing. Then it’ll start the conversation.
Now, because we wanna be neat, we’re going to destroy the invisible object when we’re done with it.
18: Click the 2nd button on the toolbar..the one with a scroll with a red ribbon around it. (I know, there’s 2…use the left-hand one) This starts a new script.
19: The void main() and the braces are filled in for you so click between them and type this line of code:
DestroyObject(OBJECT_SELF);
20: That’s it. Click the TV screen and when it asks for a name, call this script killbookreader.
21: Exit the script editor.
22: Open up the conversation file.
23: You want the file to be at least 2 lines long. One for the book…one for the player. If you add extra, that’s fine. However, we want the last line where the player clicks his last bit of dialog. Click that line once to highlight it.
24: In the bottom right of the screen you’ll see a tab that says Actions Taken. Click it to bring it to the front if it isn’t already there.
25: Click the button with … and a window will open showing you all the scripts in your game.
26: Click the script you created named killbookreader, then click the Open button. You should see the name of the script in the field and a preview of the script in the window below. Now, when the player clicks that last line of code, the invisible book reader will delete itself.
27: Let’s be a bit more safe, just in case the player walks away without clicking the last line of code.
28: At the right edge of those tabs should be a < and a > button. Click the > to bring more tabs into view. Click Current File.
29: Click the … button next to Normal File and select the killbookreader script. Click the … button next to Aborted and select the killbookreader script.
30: Save your conversation.
31: Save your module.
32: Test it.
|