Death Prefab Version 2.0 15 August 2003 by Bob Stewart dreambard@bigplanet.com http://www.employees.org/~bstewart Introduction When a player dies in a Neverwinter Nights module the game presents the option to respawn. Upon choosing it in a custom module that has no custom death handling, the player returns to the place of death, healed and with no consequences for the death. The Death prefab is an easy way to improve on this with minimal effort, and with a bit more easy implementation, you, the module implementer, can add options for where a player can return to game play after death. Death consequences include the standard XP and gold penalties and reputation adjustment as from the Neverwinter Nights Official Campaign modules. The options available to the player returning from death, with increasing effort on your part, are: . The exact place the player died. . A fixed, module-wide location, such as a temple. . A safe place in the area where the player died. . A place the player chose previously through interaction with an object (such as a bind stone). . A place chosen by you through scripting, according to progress in the module. The zipped prefab package contains: . readme.txt - this documentation. . Death.erf - the Death area and all its components. . Death Test.mod - a demonstration and test module with the Death area installed. Death.erf is the only file you need to import to use any of the prefab features. Death Test.mod lets you try the features and, using the Aurora Toolset, see exactly how I implemented them and how you can use them. Free Use The Death prefab is available for free use in whole or in part by any developer of Neverwinter Nights content. If you use the prefab as is, or take parts of it, please give me credit for my contribution. I'd also appreciate hearing about its use. Minimum Effort Option With minimum effort on your part, the player who dies sees: . An area away from mainstream game play. . Death consequences as in the Official Campaign, that is, loss of XP and gold. . Reset of reputation as in the Official Campaign. . The ability to rest and to choose the best time to return. . The ability to return to the place of death, fully healed. . A place to meet and interact normally, but not enter combat, with other players who are dead at the same time. The "Death" area is an otherwise normal area that does not allow combat and has no exits except through conversation with an NPC, The Lord of Limbo. The Lord of Limbo offers return options according to what you have made possible. To gain all of these functions in a custom module, in the Aurora toolset simply import Death.erf into your module, using: File>Import...>Death.erf All of the scripts, conversations, blueprints, and so on have the prefix "bsd", for Bob Stewart Death. It's that simple, with one slight qualification. If you find the Lord of Limbo treating you as if you'd attacked an innocent but you haven't, see the Faction Bug note at the end of this document. Extended Options The options add possibilities for where the player can return from death, with increasing amounts of your effort to install them. All of them include the features of the minimum effort option. Each of the following options is independent of the others. Using scripting, you can dynamically enable or disable any of the options, including return to the place of death. How to do that is explained below, following the individual option descriptions. Module-wide Location You can define one module-wide location for return after death. This may be, for example, a temple. Such a location is typically placed at or near the start of a module, so that an early death does not put the player deep into unexplored territory. From that location the player must be able to return to any other area necessary to continue playing. You may have only one such location for the entire module. To add this option for the user, in the Aurora Toolset use: Paint Waypoints>Custom>Special>Custom 5>safety and comfort Place this waypoint only once in your module, at the location to which the player will return from Death when selecting this option from the Lord of Limbo. The tag for this waypoint must be "bsd_wp_Temple". Although the word "Temple" appears in the prefab internals, it is not displayed to the player, so you can make the visible terminology whatever you wish. The name of this waypoint, which defaults to "safety and comfort", appears in the text the player sees to select this return location. You may change this name to suit yourself. Area Safe Location In each area you can define a safe location for return when a player dies in that area. Whether there really is such a place depends on your area design and whether the player may have dragged hostile creatures within range of it. If your area has no safe place, then don't place one in it. You may have no more than one such location in each area. To add this option for the user, in the Aurora Toolset use: Paint Waypoints>Custom>Special>Custom 5>a safe place Place this waypoint only once in any area, at a reasonably safe location to which the player will return from Death when selecting this option from the Lord of Limbo. The tag for this waypoint must be "bsd_wp_Safe". The name of this waypoint, which defaults to "a safe place", appears in the text the player sees to select this return location. You may change this name to suit yourself. Bind Location You may place bind locations anywhere in your module that you see fit. You probably want them in relatively safe places, but that's up to you. A bind location requires some player interaction, typically with a conversation presenting the player the option of binding to a location. The player can have only one active bind location at a time. The interaction could be a conversation with an object or an NPC, or simply using an object. I have provided a conversational bind stone that you can use as is. In the Aurora Toolset use: Paint Placeable Objects>Custom>Special>Custom 5>Death's Beacon Stone Place this object wherever you like, as many times as you like, at locations where the player can use it to make that place an option to get from the Lord of Limbo. This object includes a conversation, "bsd_bindstone", that gives the user the option of binding to that location. The conversation uses the script "bsd_bind" to set the bind location. The script records the name of the object to include in the text the player sees to select this return location from the Lord of Limbo. Using the example of my bind stone and the bsd_bind script you can design your own bind objects if you wish. Scripted Location You may create and change a return location based on your own design and scripting. To do this you set local variables on the player as follows: object oWho = ; location lLocation = ; string sDescription = ; SetLocalInt(oWho, "bsd_Script", TRUE); SetLocalLocation(oWho, "bsd_ScriptLocation", lLocation); SetLocalString(oWho, "bsd_ScriptName", sDescription); For example, if you are basing this on a conversation, could be GetPCSpeaker(). If you are basing it on, say, entry into an area, could be GetEnteringObject(). And so on... If you want the player to return to the player's present location, could be GetLocation(oWho). For your waypoint tagged "MyWaypoint" could be GetLocation(GetObjectByTag("MyWaypoint")). Finally, is the text you want displayed by the Lord of Limbo when offering this return location to the player. To completely remove the option of your scripted location use: object oWho = ; DeleteLocalInt(oWho, "bsd_Script"); DeleteLocalLocation(oWho, "bsd_ScriptLocation"); DeleteLocalString(oWho, "bsd_ScriptName"); This is a powerful option that you could use to change an available return location based, for example, on a player's class, alignment, or progress through the module. Scripted Option Selection With your own scripting you can dynamically enable and disable any of the return options, including returning to the place of death. All options are initially enabled if their other required setup exists as described above. To disable an option: SetLocalInt(, "", TRUE); To reenable an option: DeleteLocalInt(, ""); Or: SetLocalInt(, "", FALSE); In both cases is as described in the section on Scripted Location. The values for are: bsd_BindOff bsd_DeathOff bsd_SafeOff bsd_ScriptOff bsd_TempleOff They control the return option with the corresponsing name, with bsd_Death controlling the ability to return to the location the player died. Note that it is entirely possible for you to disable all the options, thus leaving the player stranded in the Death area. Players are not likely to appreciate this, so be careful. If you should do this, intentionally or accidently, the Lord of Limbo will inform the player that there is no way out. Demonstration and Test Module I used the demonstration and test module, "Death Test.mod", to develop V2.0 of my Death handler. I did my testing with an unadorned level 1 character, so he'd die easily when I wanted him to. You can play the module to see how the various options look to a player and in the Aurora Toolset you can see how the whole thing is put together. The module has three areas in additon to the Death area that you get from death.erf: Mortal Ruins Guardian Office Temple of Returning Mortal Ruins is the starting area. It has a safe point and a bind stone and two other objects. The Hand of Death kills you instantly when you touch it. The Sphinx of Returning is for testing and demonstrating the return option based on your own custom scripting. It has my own quick, crude scripting as an example of setting the right variables. The Sphinx will kill you if you pick a fight. Guardian Office is just another room with a safe point and a Shield Guardian that will kill you if you pick a fight. Temple of Returning is a temple return area with a bind stone and a Will-O'-Wisp that will kill you if you pick a fight. Acknowledgements Much credit goes to posters on the BioWare scripting forum, script contributors at Neverwinter Vault, and the Neverwinter Nights Lexicon. Those three provided many examples, tips, and necessary information nuggets. My test team: Bob Stewart Jr., Ben Stewart, and Rob Brown tested the original in place in a couple of my modules. Bob Stewart Jr. tested the prefab with the Death Test module. Version History V2.0 - 15 August 2003 Added options for returning to central module location, safe point in area of dying, bind point, or scripted point. Improved some of the Lord of Limbo's behavior and made him immune to combat attempts. Packaged as prefab. V1.0 - 28 April 2003 Included in my Island Holiday module. Faction Bug In developing this prefab I discovered an obscure bug in Neverwinter Nights. I reported it but got little or no comment back. There appears to be little hope it will be fixed. The bug appears in certain cases when a player dies. Normally if a player attacks a friendly creature an internal flag is set, indicating that the players reputation is damaged. Normal death processing clears that. For some unaccountable reason, if you die in certain ways where you don't deserve bad reputation, you still look like you have bad reputation and the Lord of Limbo will ding you for it unfairly. Specifically, a death from the Hand of Death, caused directly by an OnUsed script, improperly makes you look like you've attacked a non-hostile NPC. The workaround for this problem is to have at least one custom faction. I know that's weird, but it makes the difference. Since custom factions do not export and import, it's up to you to create one if you don't already have any. In the Aurora Toolset use: Tools>Faction Editor>Add Faction Name it "BsdDeath", or anything you like. I usually use "SillyBugWorkaround". Sorry about this little bit of mess. It's out of my hands...