Changed folder name.
Changed folder name.
This commit is contained in:
137
_module/nss/onpclevelup.nss
Normal file
137
_module/nss/onpclevelup.nss
Normal file
@@ -0,0 +1,137 @@
|
||||
//Script Name: onplayerlevelup
|
||||
//////////////////////////////////////////
|
||||
//Created By: Genisys (Guile)
|
||||
//Created On: 5/20/08 (Updated 8/10/08)
|
||||
/////////////////////////////////////////
|
||||
/*
|
||||
This OnPlayerLevelUp Module Event script
|
||||
must be in your Module Event, it does
|
||||
quite a few things when the PC levels
|
||||
up, and there are optional settings
|
||||
below, so please read this fully!
|
||||
*/
|
||||
////////////////////////////////////////
|
||||
|
||||
//PROTOTYPE DECLARED
|
||||
int IsShifterMorphed(object oTarget);
|
||||
|
||||
//PROTOTYPE DECLARED
|
||||
void SendMessageToAllPC(string sMessage);
|
||||
|
||||
//Main Script
|
||||
void main()
|
||||
{
|
||||
//Declare Major Variables
|
||||
object oPC = GetPCLevellingUp();
|
||||
string sName = GetStringLeft(GetName(oPC), 20);
|
||||
object oPP = oPC;
|
||||
object oTarget;
|
||||
oTarget = oPC;
|
||||
int nInt;
|
||||
nInt = GetObjectType(oTarget);
|
||||
int nHD = GetHitDice(oPC);
|
||||
effect eEffect;
|
||||
location lSaved = GetLocation(oPP);
|
||||
|
||||
//Remove any death tokens in their inventory..
|
||||
object oDeath = GetItemPossessedBy(oPC, "death");
|
||||
DestroyObject(oDeath, 0.0f);
|
||||
|
||||
//If it's not a PC stop the script
|
||||
if (!GetIsPC(oPC)) return;
|
||||
|
||||
///////////PLAYER LOCATION SAVING////////////////////////////////////////
|
||||
//These functions save the location of the player, the control for this
|
||||
//option are in the "startingjump" script which must go in your loading
|
||||
//area for your module's starting area..
|
||||
|
||||
//If in the guild only!
|
||||
//If they are in the guild...
|
||||
if(GetItemPossessedBy(oPC, "guildpass")!=OBJECT_INVALID)
|
||||
{
|
||||
if(GetArea(GetAreaFromLocation(lSaved))!=OBJECT_INVALID)
|
||||
{
|
||||
object oGuild = GetItemPossessedBy(oPC, "guildstone");
|
||||
|
||||
//Store the PC's location, so they can come back here after relogging
|
||||
SetCampaignLocation("LOCATIONS", GetName(oGuild), lSaved, oPC);
|
||||
|
||||
//Tell the PC thier location was saved..
|
||||
SendMessageToPC(oPC, "Location Saved.");
|
||||
}
|
||||
}
|
||||
////////////AUTOMATIC CHARACTER SAVING ON LEVEL UP OPTION///////////////////
|
||||
//Delete the // on the next 2 lines below to activate Automatic Character Saving.
|
||||
if(IsShifterMorphed(oPC)!=1)
|
||||
{
|
||||
DelayCommand(2.0, ExportSingleCharacter(oPC));
|
||||
|
||||
FloatingTextStringOnCreature("Your character was saved!", oPC);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
if(nHD == 5 || nHD == 10 || nHD == 15 || nHD == 20 ||
|
||||
nHD == 25 || nHD == 30 || nHD == 35 || nHD == 40)
|
||||
{
|
||||
SendMessageToAllPC(GetName(oPC) + " has reached level " + IntToString(nHD)
|
||||
+ " Congratulations!");
|
||||
|
||||
if(nHD == 40 || GetItemPossessedBy(oPC, "guildpass")!=OBJECT_INVALID)
|
||||
{
|
||||
//Lets make them concealed 40%
|
||||
eEffect = EffectConcealment(40);
|
||||
eEffect = SupernaturalEffect(eEffect);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
||||
if(nHD == 40)
|
||||
{
|
||||
//Make all level 40 PCs glow like a ghost
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,
|
||||
SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC, 480.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Apply a visual effect of knock each time a PC levels up :)
|
||||
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_KNOCK), oTarget);
|
||||
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_KNOCK), GetLocation(oTarget));
|
||||
|
||||
//////////////ANTI-CHEATING OPTION/////////////////////////////////////////
|
||||
//This function scans the PC who just leveled up to see if they are playing
|
||||
//a legal character or not, just delete the // below to use
|
||||
//DelayCommand(2.0, ExecuteScript("cheatercheck4", oPC));
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Main Script End
|
||||
}
|
||||
|
||||
//PROTOTYPE DEFINED
|
||||
int IsShifterMorphed(object oTarget)
|
||||
{
|
||||
object oPC = oTarget;
|
||||
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
|
||||
/*&& GetLevelByClass(CLASS_TYPE_DRUID,oPC)>0
|
||||
&& GetAppearanceType(oPC) <= 6*/)
|
||||
iShifter = TRUE;
|
||||
ef = GetNextEffect(oPC);
|
||||
}
|
||||
if(iShifter==TRUE)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//PROTOTYPE DEFINED
|
||||
void SendMessageToAllPC(string sMessage)
|
||||
{
|
||||
object oPC = GetFirstPC();
|
||||
while(GetIsObjectValid(oPC))
|
||||
{
|
||||
FloatingTextStringOnCreature(sMessage, oPC, TRUE);
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user