Hey everyone,
I recently put up my ne PW <shameless plug> Dragonlance, Age of Despair </shameless plug> and I have a little issue i need to take care of asap.
I have noticed on PW i have played on that if the server crashes the server will save characters and send a message to the client letting players know their characters have been saved.
On my PW, if the server happens to crash the players can loose progress on their characters since the game does not automaticly save them. I am using NWNX4 and was wondering if there is a plugin, or a script function of some sort that I can put in the moduel's on exit event handler to save characters if the server crashes?
This would be very helpful to the players since no one wants to loose progress on their characters...
PW Character Saving script
Débuté par
niapet
, avril 08 2011 04:02
#1
Posté 08 avril 2011 - 04:02
#2
Posté 09 avril 2011 - 02:59
Anyone have any ideas?
#3
Posté 12 avril 2011 - 02:01
I am surprised no one else chimed in, so here is what we use! We have a two-fold system for saving. One is a wand that allows players so save whenever they want. The second is the same function, but on triggers that are in all our areas:
This one is on a wand that players get:
#include "x2_inc_switches"
void main()
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
{
object oWand=GetItemActivated();
object oUser=GetItemActivator();
object oTarget=GetItemActivatedTarget();
object oMod = GetModule();
location lTargetLoc=GetItemActivatedTargetLocation();
string sWandTag=GetTag(oWand);
ExportSingleCharacter(oUser);
SendMessageToPC (oUser, "Your character has been saved to the vault.");
object oArea = GetArea(oUser);
string sAreaTag = GetTag(oArea);
location lPC = GetLocation(oUser);
string sArea = GetName(oArea);
string sSubString = GetSubString(sArea,0,1);
if (sAreaTag != "01_startarea")
{
if (sSubString != "+")
{
object oToken = GetItemPossessedBy(oUser, "tal3_infotoken");
SetLocalLocation(oToken, "persLoc", lPC);
SendMessageToPC (oUser, "Your persistent location has been set.");
}
}
}
Here is the script on the oneneter part of a trigger:
void main()
{
object oPC = GetEnteringObject();
ExportSingleCharacter(oPC);
location lPC = GetLocation(oPC);
object oToken = GetItemPossessedBy(oPC, "tal3_infotoken");
SetLocalLocation(oToken, "persLoc", lPC);
}
Double check all the brackets, I am no scripter, the copy-paste might be flawed.
Anyhow, this is what we use. Players save when they want (after DM XP, getting a nice loot, etc) and they are autosaved when they go to a new area and step into the trigger placed at the transition.
Hope it helps!
(shameless plug: RP -orientated PW - http://worldoftalernon.com )
This one is on a wand that players get:
#include "x2_inc_switches"
void main()
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
{
object oWand=GetItemActivated();
object oUser=GetItemActivator();
object oTarget=GetItemActivatedTarget();
object oMod = GetModule();
location lTargetLoc=GetItemActivatedTargetLocation();
string sWandTag=GetTag(oWand);
ExportSingleCharacter(oUser);
SendMessageToPC (oUser, "Your character has been saved to the vault.");
object oArea = GetArea(oUser);
string sAreaTag = GetTag(oArea);
location lPC = GetLocation(oUser);
string sArea = GetName(oArea);
string sSubString = GetSubString(sArea,0,1);
if (sAreaTag != "01_startarea")
{
if (sSubString != "+")
{
object oToken = GetItemPossessedBy(oUser, "tal3_infotoken");
SetLocalLocation(oToken, "persLoc", lPC);
SendMessageToPC (oUser, "Your persistent location has been set.");
}
}
}
Here is the script on the oneneter part of a trigger:
void main()
{
object oPC = GetEnteringObject();
ExportSingleCharacter(oPC);
location lPC = GetLocation(oPC);
object oToken = GetItemPossessedBy(oPC, "tal3_infotoken");
SetLocalLocation(oToken, "persLoc", lPC);
}
Double check all the brackets, I am no scripter, the copy-paste might be flawed.
Anyhow, this is what we use. Players save when they want (after DM XP, getting a nice loot, etc) and they are autosaved when they go to a new area and step into the trigger placed at the transition.
Hope it helps!
(shameless plug: RP -orientated PW - http://worldoftalernon.com )





Retour en haut






