UW2_PRC8/_module/nss/onplayerlevelup.nss
Jaysyn904 f69e979e53 Updated event system
Added caller scripts to the PC events.  Full compile.  Updated release.
2023-11-13 13:16:17 -05:00

173 lines
6.1 KiB
Plaintext

/*--------------------------------------------------------
Script Name: onplayerlevelup
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 3/03/09
----------------------------------------------------------
Intergrated SimTools to the OnPlayerLevelUp Event
----------------------------------------------------------*/
//Required Include for SimTools
#include "fky_chat_inc"
void SendMessageToAllPC(string sMessage)
{
object oPC = GetFirstPC();
while(GetIsObjectValid(oPC))
{
SendMessageToPC(oPC, sMessage);
oPC = GetNextPC();
}
}
void main()
{
object oPC = GetPCLevellingUp();
int nHD = GetHitDice(oPC);
location lSaved = GetLocation(oPC);
///////LOCATION SAVING OPTION////////
//Delete the /* above to activate
//Store the PC's current location..
//SetCampaignLocation("LOCATIONS", "SAVED_LOC", lSaved, oPC);
//Tell the PC thier location was saved..
//SendMessageToPC(oPC, "Location Saved.");
// (DO NOT TOUCH THIS LINE!) */
/////////////////////////////////////////
///Character Auto Save (Single Character / safe save)
//Save the PC's character instantly..
if(GetLocalInt(GetModule(), "MULTI")==TRUE)
{
DelayCommand(1.0, ExportSingleCharacter(oPC)); //Allow them to deshift!
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)
ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC);
}
{
object oPC = GetPCLevellingUp();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = oPC;
int nInt;
nInt = GetObjectType(oTarget);
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));
}
/////////////////////////CHARACTER SCANNING OPTIONS////////////////////////
//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));
//////////////////////////////////////////////////////////////////////////
//SimTools Languages
////////////////////////////////////////////////////////////
/*
if (ENABLE_LANGUAGES)//check to see if they gained a level in a language class, and if so, add that language
{
object oPC = GetPCLevellingUp();
if (USING_NWNX_DB)
{
if ((GetLevelByClass(CLASS_TYPE_RANGER, oPC) || GetLevelByClass(CLASS_TYPE_DRUID, oPC)) && (!GetLocalInt(oPC, "FKY_CHAT_LANG37")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG37", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG37", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_ROGUE, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG44")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG44", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG44", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_ASSASSIN, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG5")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG5", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG5", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_DRUID, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG14")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG14", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG14", TRUE);
}
if ((GetLevelByClass(CLASS_TYPE_WIZARD, oPC) || GetLevelByClass(CLASS_TYPE_SORCERER, oPC) || GetLevelByClass(CLASS_TYPE_PALEMASTER, oPC)) && (!GetLocalInt(oPC, "FKY_CHAT_LANG71")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG71", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG71", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_PALEMASTER, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG80")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG80", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG80", TRUE);
}
}
else
{
object oStorage = GetItemPossessedBy(oPC, TAG_OF_LANGUAGE_STORAGE_OBJECT);
if ((GetLevelByClass(CLASS_TYPE_RANGER, oPC) || GetLevelByClass(CLASS_TYPE_DRUID, oPC)) && (!GetLocalInt(oPC, "FKY_CHAT_LANG37")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG37", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG37", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_ROGUE, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG44")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG44", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG44", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_ASSASSIN, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG5")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG5", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG5", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_DRUID, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG14")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG14", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG14", TRUE);
}
if ((GetLevelByClass(CLASS_TYPE_WIZARD, oPC) || GetLevelByClass(CLASS_TYPE_SORCERER, oPC) || GetLevelByClass(CLASS_TYPE_PALEMASTER, oPC)) && (!GetLocalInt(oPC, "FKY_CHAT_LANG71")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG71", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG71", TRUE);
}
if (GetLevelByClass(CLASS_TYPE_PALEMASTER, oPC) && (!GetLocalInt(oPC, "FKY_CHAT_LANG80")))
{
SetLocalInt(oPC, "FKY_CHAT_LANG80", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG80", TRUE);
}
}
}
// */
/////////////////////////////////////////////////////////////////////////
}