Changed folder name.
Changed folder name.
This commit is contained in:
83
_module/nss/savecharacters.nss
Normal file
83
_module/nss/savecharacters.nss
Normal file
@@ -0,0 +1,83 @@
|
||||
/*--------------------------------------------------------
|
||||
|
||||
Script Name: savecharacters
|
||||
----------------------------------------------------------
|
||||
Created By: Genisys(Guile)
|
||||
Created On: 2/09/09
|
||||
----------------------------------------------------------
|
||||
|
||||
This saves all characters on the server
|
||||
|
||||
----------------------------------------------------------*/
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//Main Script
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPP = GetFirstPC();
|
||||
string sName = GetStringLeft(GetName(oPP), 20);
|
||||
location lSaved = GetLocation(oPP);
|
||||
int MULTI_PLAYER = GetLocalInt(GetModule(), "multi");
|
||||
|
||||
while(GetIsObjectValid(oPP))
|
||||
{
|
||||
//If they are in the guild...
|
||||
if(GetItemPossessedBy(oPP, "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, oPP);
|
||||
SendMessageToPC(oPP, "Location Saved");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPP, "Your location was NOT saved, you need to rest to save your location.");
|
||||
}
|
||||
}
|
||||
|
||||
//If the PC is not polymorphed save their character as well!
|
||||
if(IsShifterMorphed(oPP)==FALSE)
|
||||
{
|
||||
if(GetAreaFromLocation(lSaved)!=OBJECT_INVALID)
|
||||
{
|
||||
if(MULTI_PLAYER)
|
||||
{
|
||||
ExportSingleCharacter(oPP);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPP, "Your character was not saved, because you are polymorphed.");
|
||||
}
|
||||
|
||||
oPP = GetNextPC();
|
||||
}
|
||||
|
||||
SendMessageToPC(GetPCLevellingUp(), "All characters on the server are saved when any character levels up.");
|
||||
string oDM = (GetPCPlayerName(GetPCLevellingUp())+" has leveled. All characters saved.");
|
||||
SendMessageToAllDMs(oDM);
|
||||
}
|
Reference in New Issue
Block a user