UW2_PRC8/_module/nss/onpclevelup.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

130 lines
4.1 KiB
Plaintext

//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 oPC);
//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);
//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(GetAreaFromLocation(lSaved)!=OBJECT_INVALID)
{
//Store the PC's current location..
SetCampaignLocation("LOCATIONS", GetName(oPP), lSaved, oPP);
//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_PERMANENT,
SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC);
}
}
}
//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 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
/*&& 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))
{
SendMessageToPC(oPC, sMessage);
oPC = GetNextPC();
}
}