Neverwinter Vault

Expand AllContract All -Site -My Profile -Features

Neverwinter Nights 2

-NWN2 Files -NWN2 Game Info -NWN2 Resources -NWN2 Community

Neverwinter Nights

-NWN Files -NWN Game Info -NWN Resources -NWN Community

Vault Network
RPG Vault
VN Boards
IGN Vault
Vault Wiki
· Age of Conan
· Anarchy Online
· Asheron's Call
· Dark Age of Camelot
· City of Heroes
· D&D
· EVE Online
· EverQuest
· EverQuest 2
· Final Fantasy
· Guild Wars
· Lineage 2
· Lord of the Rings Online
· Middle Earth
· Neverwinter Nights
· Pirates of the Burning Sea
· Rise of the Argonauts
· Star Wars Galaxies
· Tabula Rasa
· The Matrix Online
· The Witcher
· Titan Quest
· Two Worlds
· Vanguard
· Warhammer
· World of Warcraft

Planet Network
Planet Hub

IGN
Games
Cheats
Entertainment

The Web   The Site  



NWN2 SCRIPTS

- Jump to comments -
Name  Death and Respawning
Author  Zheldon
Submitted / Updated  03-26-2008 / 08-28-2009
Category  Death
Type  Type - Event
Format  Code Only
Patch  1.13
NWN2Game  All
Description
This ERF provides a basic blank starting point for customising your ondeath and onplayerrespawn events. Currently the onrespawn event does not fire which may confuse some people. I decided to create a basic blank starting point for people to use.

The ERF contains three files.
mod_onplayerdeath - Module level event that fires on death.
mod_onplayerrespawn - Module level event that does not fire by default on respawn. I still put mine in the module level events though just in case.
gui_death_respawn_self - Only slightly modified from the default one. Of course you will not over write the one that came with NWN2, it creates a copy in your module level scripts. This is the script that gets called when the player selects Respawn from the death menu.

**UPDATE 8/28/2009**
It was brought to my attention that in version 3, at line 35 I have it as int nHPHealed = GetHPHealed(oRespawner, FALSE); This will have the player respawn with hit points equal to their hit die, to have them respawn at full hit points change that to TRUE. I am sorry for any confusion.

Files

NameTypeSizeDownloads
Zheldon_blank_death_scripts.erfZheldon_blank_death_scripts.erf
Submitted: 03-26-2008 / Last Updated: 03-26-2008
erf3.17Kb272
--
Script_Version_3_With_Test_Module.zipScript_Version_3_With_Test_Module.zip
Submitted: 03-26-2008 / Last Updated: 08-20-2009
zip2.2Mb209
Version 3.
The update in this version is a function to set the hit points restored to the player. This call takes two parameters, the respawning object and a boolean (true or false). If set to true then it will restore the maximum hit points to the player. If set to false it will restore a number of hit points equal to the player's hit dice. Feel free to alter that function if you like.

I have also included a simple test module. It consists of three traps, two are lethal the other is just a gas trap. I wouldn't test it with a high level character.

One correction. The name of the variable my scripts look for on the module and or the areas is sRespawnTag. Obviously a string type variable that contains the tag of the way point where you want the player to spawn.
Zheldon_blank_death_scripts_2.erfZheldon_blank_death_scripts_2.erf
Submitted: 03-26-2008 / Last Updated: 05-21-2008
erf4.95Kb399
Here is a second version. I modified the mod_onplayerrespawn file. Basically it breaks down getting key variables by using function calls. I belive this will make it easier for builders and scripters to modify.

You can modify the functions, or just not use them and manually set the values where needed. I just think it adds a level of flexibility.

Also by default it will look for an area level variable named sRespawnTag to get the tag of the respawn waypoint. If that is blank it will look for the sRespawnTag on the module, again the tag of the respawn waypoint. This will allow you to easily set a different respawn point for each area and still keep a default fall back plan just in case you forget to put one on an area.
SCORE OUT OF 10
9.2
7 votes
View Stats
Cast Your Vote!
Voting FAQ

PORTFOLIO
Add this entry to your portfolio so you can track it
Manage your existing portfolios or create a new one.
SCREENS
No Images




You Must Be Logged In to Participate.
Comments (25):

Posted by erikbreau at 2009-09-21 05:59:29    Voted 10.00 on 09/21/09
I implemented this (with a little help form Zheldon) into my future PW: Europa. My test players are raving about it and I am very impressed with it's manageability. Easy to use, easy to modify, and effective. Deserve the 10!

Posted by Zheldon at 2009-08-28 10:39:22    
Just in case you missed it in the description.

**UPDATE 8/28/2009**
It was brought to my attention that in version 3, at line 35 I have it as int nHPHealed = GetHPHealed(oRespawner, FALSE); This will have the player respawn with hit points equal to their hit die, to have them respawn at full hit points change that to TRUE. I am sorry for any confusion.

Posted by Zheldon at 2008-11-24 06:49:48    
Wow, thank you for your comment and adding my work to the DMFI.

Posted by Zheldon at 2008-09-24 09:47:19    
Thank you very much.

Posted by puket at 2008-09-23 14:12:08    Voted 9.00 on 09/23/08
Thats the way to make builders happy with solid basic scripts for newbies and oldies.Thank you Zheldon.

Cheers!

Posted by Zheldon at 2008-09-21 15:57:01    
Merci vraiment.

Posted by fanidhol at 2008-09-21 09:58:58    Voted 10.00 on 09/21/08
je vote pour vous :)

Posted by fanidhol at 2008-09-21 09:57:37    Voted 10.00 on 09/21/08
I did not make the variable in the properties of the module, now that works, it is great, thank you very much

Posted by Zheldon at 2008-09-20 14:38:36    
It does not create the way point with the tag. You must have the waypoint created already and give that waypoint the tag.

Posted by fanidhol at 2008-09-20 07:10:03    Voted 10.00 on 09/21/08
I search a script to get the respawn player in a special place = (LIMB)
Then, I must create WP with TAG
say to me if this script makes it?

« If you were using the second version of the script » yes I have this one Zheldon_blank_death_scripts_2.erf
thanks a lot

Posted by Zheldon at 2008-09-20 04:19:08    
fanidhol,

It looks like you are trying to manually set the tag of the respawn waypoint. To do it that way you will want to comment out the function calls that try to obtain the waypoint string from module or area level variables.

string sTag = "LIMB";
object oArea = GetArea(oDead);
//Get tag based on area level variable
//sTag = GetLocalString(oArea,"sRespawnTag");
//Check for tag and default to a module level variable
if(sTag == "LIMB")
{
//sTag = GetLocalString(GetModule(),"sRespawnTag");

If you were using the second version of the script I made it easier in the mod_onplayerrespawn file to do the manual setting, here is part of that file.
void main()
{
//Create initial variables
object oRespawner = GetRespawningPlayer();
object oArea = GetArea(oRespawner);
string sDestTag = GetDestinationTag(oRespawner);
object oRespawnPoint = GetRespawnPoint(sDestTag, oRespawner);
location lDeathSpot = GetLocation GetLastRespawnButtonPresser());
location lRespawnPoint;

What you would want to do is modify the sDestTag from this
string sDestTag = GetDestinationTag(oRespawner);
to this
string sDestTag = "LIMB";

Of course all this is assuming you are trying to manually set a respawn point where players will always respawn. If this is not the case let me know and I will help you further.

Posted by fanidhol at 2008-09-20 00:32:57    Voted 10.00 on 09/21/08
this does not work, the pj stays or he died, I put TAG here:

string sTag = "LIMB";
object oArea = GetArea(oDead);
//Get tag based on area level variable
sTag = GetLocalString(oArea,"sRespawnTag");
//Check for tag and default to a module level variable
if(sTag == "LIMB")
{
sTag = GetLocalString(GetModule(),"sRespawnTag");


Thank�s
(I am French, be able to speak simply)

Posted by Timidon at 2008-08-27 12:51:38    Voted 9.00 on 08/27/08
Worked right off the bat. Thanks, I was having problem with the death scripts. Fixed it up real nice. A must have for the new to NWN2 modding.

Posted by Zheldon at 2008-05-21 05:55:10    
Ooops, I messed up when I went to upload the newer version last night. I did it right this time.

I did a quick little test so please let me know if anyone has any troubles.

Posted by Zheldon at 2008-05-19 11:51:50    
Oh hey I forgot, I did change it a little. I have not tested it yet, so I will upload it after I test it.

Posted by Zheldon at 2008-05-16 10:52:22    
O.K. I'll try to find time this weekend to throw something together.

Posted by StoutJacob at 2008-05-13 10:24:53    
Yes, that would be great. I figured it would have to be an "on enter", but since I have very little scripting knowledge, I wasn't going to make any suggestions.

Thanks for your quick response, by the way. I'm not used to that, so I didn't check back right away.

But anyway, that sounds perfect, and I look forward to seeing the results.

Posted by Zheldon at 2008-05-09 07:55:58    
It seems it would be possible until you think about how NWN2 looks at the waypoints. The system does not have a way of rating distance to a waypoint outside of your current area.

With that said it could be done but not perfectly. What I am getting at is basing the respawn points on the area of death. You can use an on enter event for the area to set the variable, or ideally set the variable on an area object.

Would that method work for you?

Posted by StoutJacob at 2008-05-08 13:10:41    
Since you offered, I would like to see a system that has multiple respawn points and respawns a player to the closest one upon death. Can you help with that, Zheldon? Thanks, in advance, for any help.

Posted by Evliss at 2008-04-03 07:31:53    Voted 9.50 on 04/01/08
Ah... there we go. Thanks!
Yeah, I've seen mods where you go to different places based on your alignment, but I'm not doing that. This works good for me.

Posted by Zheldon at 2008-04-02 19:48:47    
Yes, instead of using the one for getnearestobjectbytag use the getwaypointbytag. One is commented out and the other uncommented out. I left those in as examples.

Of course you would need to setup something a little more elaborate for multiple respawn points. I can probably help you out with that as well if you need it.

Posted by Evliss at 2008-04-02 19:30:32    Voted 9.50 on 04/01/08
Hmmm... it seems to me that player teleport works only if the waypoint is in the same area. Any ideas on how to correct this?

Posted by Zheldon at 2008-04-02 18:09:28    
Wow, thank you both for the feedback. I am so happy I was able to help people out.

Posted by shockwolf at 2008-04-02 13:23:16    Voted 8.00 on 04/02/08
Cheers for this!
_________________________
ShockWolF -
Author of Wulverheim

Zhjaeve � Know that I must begin every sentence with the word �Know�. Know that everything I say must be known. Know that it is important that you know this.




Posted by Evliss at 2008-04-01 20:32:22    Voted 9.50 on 04/01/08
Just what I was looking for. Thanks!

You must be Logged In to post comments in this section.

10 - A Masterpiece, Genuinely Groundbreaking
9 - Outstanding, a Must Have
8 - Excellent, Recommended to Anyone
7 - Very Good, Deserves a Look
6 - Good, Qualified Recommendation
5 - Fair, Solid yet Unremarkable
4 - Some Merit, Requires Improvements
3 - Poor Execution, Potential Unrealized
2 - Very Little Appeal
1 - Not Recommended to Anyone

 
Most recent posts on the MMO General Boards
Analyst: Star Wars: The Old Republic Could...Analyst: Star Wars: The Old Republic Could Sell 3M: more numbers
- last reply by Acao on Aug 15, 2011 06:15 PM
which class will your first character be
- last reply by Blisteringballs on Aug 15, 2011 05:50 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 05:00 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 04:00 PM
NWN Idea Database Update
- posted by Vault_News on Aug 15, 2011 03:46 PM
Missing Votes for NWN2 Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:40 PM
Missing Votes for NWN Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:39 PM
Random Questions and game altering suggest...Random Questions and game altering suggestions!!!
- last reply by ArkadyTepes on Aug 15, 2011 03:22 PM
State of the game?
- last reply by LyricOpera on Aug 15, 2011 01:37 PM
Yesterday streaming, now demanding downloa...Yesterday streaming, now demanding download :(
- last reply by Sinane-tk on Aug 15, 2011 10:23 AM
 

   


IGN Entertainment
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2011, IGN Entertainment, Inc. | Support | Privacy Policy | User Agreement | RSS Feeds
IGN’s enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.


NWN2 Hall of Fame

HOF NWN2 Models


View all Hall of Fame entries


Neverwinter Nights 2

TOP NWN2 Modules

NEW Modules

NEW Reviews

NEW INTL. Modules

TOP Hakpaks

TOP Gameworlds

TOP Tutorials

TOP Prefab:Areas

TOP Blueprints

TOP Plugins

TOP UI

TOP Other

TOP Visual Effects

TOP Scripts

TOP Tools

TOP Movies

TOP Models

TOP Characters





Hall of Fame

HOF NWN Modules


View all Hall of Fame entries


TOP NWN Modules

NEW NWN Modules

NEW Reviews

TOP Intl. Modules

TOP NWN Hakpaks

TOP NWN Gameworlds

TOP NWN Models

TOP NWN Portraits

TOP NWN Scripts

TOP NWN Prefabs

TOP NWN Other

TOP NWN Movies

TOP Sounds

TOP NWN Textures

TOP NWN Creatures

TOP NWN Characters