Changed folder name.
Changed folder name.
This commit is contained in:
97
_module/nss/savepcinfo.nss
Normal file
97
_module/nss/savepcinfo.nss
Normal file
@@ -0,0 +1,97 @@
|
||||
////////////////////////////////////
|
||||
//Created by Genisys / Guile 6/14/08
|
||||
////////////////////////////////////
|
||||
/*
|
||||
|
||||
This script frequently saves the location of all players in the NWN Database
|
||||
When a playe rest they have thier location saved too, also when they die too..
|
||||
|
||||
NOTE: I don't know if it save's DM's location or not..
|
||||
|
||||
*/
|
||||
////////////////////////////////////
|
||||
//This checks to see if the player is polymorphed...
|
||||
int IsShifterMorphed(object oPC)
|
||||
{
|
||||
effect ef = GetFirstEffect(oPC);
|
||||
int iShifter = FALSE;
|
||||
//if (GetLevelByClass(CLASS_TYPE_DRUID,oPC)>0) //Is Shifter, search the PolyEff
|
||||
while( GetEffectType(ef) != EFFECT_TYPE_INVALIDEFFECT && iShifter == FALSE)
|
||||
{
|
||||
if ( GetEffectType(ef) == EFFECT_TYPE_POLYMORPH )
|
||||
iShifter = TRUE;
|
||||
|
||||
ef = GetNextEffect(oPC);
|
||||
}
|
||||
return iShifter;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
/////////SAVE LOCATION TIMER OPTION/////
|
||||
//Set the Float below (180.0 = 3 minutes) to the amount of seconds
|
||||
//that you want this script to execute at the designated time count.
|
||||
DelayCommand(180.0, ExecuteScript("savepcinfo", OBJECT_SELF));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
object oPP;
|
||||
object oPC;
|
||||
string sName;
|
||||
location lSaved;
|
||||
int MULTI_PLAYER = GetLocalInt(GetModule(), "multi");
|
||||
|
||||
oPP = GetFirstPC();
|
||||
while(GetIsObjectValid(oPP))
|
||||
{
|
||||
//Define the variables while in the loop as they will change EACH loop!
|
||||
//sName = GetStringLeft(GetName(oPC), 20);
|
||||
//Define the PC another time, this way we are not redefining oPP?
|
||||
oPC = oPP;
|
||||
lSaved = GetLocation(oPC);
|
||||
|
||||
//If they are in the guild...
|
||||
if(GetItemPossessedBy(oPC, "guildpass")!=OBJECT_INVALID)
|
||||
{
|
||||
//Let's make sure their area is valid!
|
||||
if(GetArea(GetAreaFromLocation(lSaved))!=OBJECT_INVALID)
|
||||
{
|
||||
object oGuild = GetItemPossessedBy(oPP, "guildstone");
|
||||
|
||||
//Store the PC's location, so they can come back here after relogging
|
||||
if(oGuild != OBJECT_INVALID)
|
||||
{
|
||||
SetCampaignLocation("LOCATIONS", GetName(oGuild), lSaved, oPC);
|
||||
SendMessageToPC(oPP, "Location Saved");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC, "Your location was NOT saved, you need to rest to save your location.");
|
||||
}
|
||||
}
|
||||
|
||||
//Make their death log empty again if they aren't dead..
|
||||
if(!GetIsDead(oPC))
|
||||
{
|
||||
SetCampaignInt(GetName(GetModule()), "DEATH_LOG", 0, oPC);
|
||||
}
|
||||
|
||||
//If the PC is not polymorphed save their character as well!
|
||||
if(IsShifterMorphed(oPC)==FALSE)
|
||||
{
|
||||
if(GetAreaFromLocation(lSaved)!=OBJECT_INVALID)
|
||||
{
|
||||
if(MULTI_PLAYER)
|
||||
{
|
||||
ExportSingleCharacter(oPC);
|
||||
SendMessageToPC(oPC, "Character Saved");
|
||||
}
|
||||
}
|
||||
}
|
||||
oPP = GetNextPC();
|
||||
}
|
||||
|
||||
//End Script
|
||||
}
|
Reference in New Issue
Block a user