PoA_PRC8/_module/nss/oncliententer.nss
Jaysyn904 7dd83ad168 Spell & Ability Upgrade
Reorganized hak files & removed duplicates.  Added @rafhot's PRC spell & ability level scaling expansion.  Further script integration.  Full compile.
2023-08-19 21:08:35 -04:00

347 lines
11 KiB
Plaintext
Raw Permalink Blame History

//Script Name: oncliententer
////////////////////////////////////////
//Created by Genisys / Guile
//Created On: 6/14/08 (Updated 8/10/08)
////////////////////////////////////////
/*
This my premier OnClientEnter Module Event Script for all my modules
(click edit / module properties to select this script for the event)
*/
/////////////////////////////////////////////////////////////////
/*
This script does multiple things, it checks to see if...
If the PC is immortal or level 40 (apply special effects)
If the character they have has been banned. (not a total bann)
If they logged out while dead, if so make them dead instantly!!! ;)
If the player is playing a legal character or not...read below..
And if the Player themself have been banned from the module or not..
*/
//////////////////////////////////////////////////////////////////////
//Redundant Variables Declared
effect eEffect;
int nInt;
object oItem;
object aTarget;
location bTarget;
//Required Include For Color Messages(Read include to learn more)
#include "gen_inc_color"
#include "inc_utility"
//Required Include for SimTools
//#include "fky_chat_inc"
//Main Script
void main()
{
ExecuteScript("prc_onenter", OBJECT_SELF);
//Declare Major Variables..
object oPC;
oPC = GetEnteringObject();
object oTarget;
oTarget = oPC;
object oPlayer = oPC;
object oPP = oPC;
string sCDKey = GetPCPublicCDKey(oPC, FALSE);
//IMPORTANT, please set the Nap Time Below!
//If changed here you must open the script "kopcwand" and adjust it there!
object oNap = GetItemPossessedBy(oPC, "napper");
if(oNap !=OBJECT_INVALID)
{
//Only on PCs!
if(GetIsPC(oPC) && !GetIsDM(oPC) && !GetIsDMPossessed(oPC))
{
//Start the nap all over again! (the 15 = minutes of nap!)
SetLocalInt(oTarget, "NAP_TIME", 15); //set 15 to your taste
//Allow them to actually enter the module...
DelayCommand(12.0, ExecuteScript("naptime", oPC));
return;
}
}
//Only for PCs!
if(GetIsDM(oPC))
{
AddJournalQuestEntry("dmrules", 1, oPC, FALSE, FALSE);
return; }
///////////////////////////////////////////////////////////////////////////
//SIMTOOLS
//DISABLED IT"S BUGGED!
/*
Speech_OnClientEnter(oPC);
int nPerm, nPerm2;
if (USING_NWNX_DB)
{
nPerm = GetPersistentInt(GetModule(), "FKY_CHT_BANSHOUT" + sCDKey);
nPerm2 = GetPersistentInt(GetModule(), "FKY_CHT_BANPLAYER" + sCDKey);;
if (ENABLE_LANGUAGES) DoLanguageSetupNWNX(oPC);
}
else //using Bioware db
{
nPerm = GetCampaignInt("FKY_CHT", "FKY_CHT_BANSHOUT" + sCDKey);
nPerm2 = GetCampaignInt("FKY_CHT", "FKY_CHT_BANPLAYER" + sCDKey);
if (ENABLE_LANGUAGES) DoLanguageSetupBio(oPC);
}
if (nPerm) SetLocalInt(oPC, "FKY_CHT_BANSHOUT", TRUE);
if (nPerm2 || GetLocalInt(oPC, "FKY_CHT_BANPLAYER")) DoBoot(oPC);//Boot them if Valid Object
else if (VAULTPATH_CHAT != "")
{
string Script = GetLocalString(oPC, "LetoScript");
if( Script != "" ) SetLocalString(oPC, "LetoScript", "");
}
*/
//////////////////////////////////////////////////////////////////////////
//Please leave the credits to the module within the message.
//Colorful Server Message sent to all PCs when they enter the module..
string sMessage;
sMessage = GetRGB(1,7,7); //The color (See above)
sMessage += "Welcome to "; //The text to be colorized by the above color.
sMessage += GetRGB(15,15,1);//The next color.
sMessage += "Server Genisys "; //The next text to be colorized by the above color.
sMessage += GetRGB(15,1,1);//etc..
sMessage += "a Revised ";
sMessage += GetRGB(7,7,15);
sMessage += "1.69 ";
sMessage += GetRGB(1,15,1);
sMessage += "Paths of Ascension ";
sMessage += GetRGB(13,9,13);
sMessage += "Classic Module ";
sMessage += GetRGB(12,10,7);
sMessage += "Revised & ";
sMessage += GetRGB();
sMessage += "Rescripted By ";
sMessage += GetRGB(15,5,1);
sMessage += "Genisys (Guile) ";
sMessage += GetRGB(12,10,7);
sMessage += "from 8/20/08 to 3/21/09.";
string sNewb = GetRGB(1,15,1) + "This is PRC Presents Path of Ascension.";
string sNewb2 = GetRGB(1,15,1) + "Contact Altpersona on Discord if you need assistance.";
//string sNewb = GetRGB(1,15,1) + "Be sure to read your journal frequently (press J).";
//string sNewb2 = GetRGB(1,15,1) + "Be sure to examine the Rest Menu carefully.";
string sEnter = GetName(oPC) + " / " + GetPCPlayerName(oPC) + " / " + GetPCPublicCDKey(oPC) + " / " + GetPCIPAddress(oPC) + " Entered." ;
SendMessageToAllDMs(sEnter);
//Get all the stats on the player when they enter the module...
WriteTimestampedLogEntry(sEnter);
//Float welcome message by..
DelayCommand(15.3, FloatingTextStringOnCreature(sMessage, oPC, FALSE));
if(GetHitDice(oPC)<=6)
{
DelayCommand(19.3, FloatingTextStringOnCreature(sNewb, oPC, FALSE));
DelayCommand(27.3, FloatingTextStringOnCreature(sNewb2, oPC, FALSE));
}
//This means the entering Character has been banned.
int nBann = GetCampaignInt(GetName(GetModule()), "CBANN", oPP);
object oTag;
location lTag;
//This part is about verifying the Player's name..
//A player must have at least a 2 character name or they are going to
//return with an error! If they have spaces in their name it will return
//with an error as well, including alt code!
string sPCNM = GetName(oPP);
string sPCNMR = GetStringRight(sPCNM, 2);
string sNC1; string sNC2; string sRNC1; string sRNC2;
int nBad;
//Find the second character of the players name..
sNC1 = GetSubString(sPCNM, 0, 1);
//Find the second character of the players name..
sNC2 = GetSubString(sPCNM, 0, 2);
//Find the last letter in the player's name.
sRNC1 = GetSubString(sPCNMR, 0, 1);
//Find the next to the last letter in the player's name.
sRNC2 = GetSubString(sPCNMR, 0, 2);
/////////////////////////IMPORTANT//////////////////////////////////
//You must make all the "" below into " " to check for legal names
//I turned it off because a lot of my characters have bad names!
//Simply put the cursor between "" and hit the space bar for "" to " "
if(sNC1 =="")
{ nBad =1; }
else if(sNC2 =="")
{ nBad =1; }
else if(sRNC1 =="")
{ nBad =1; }
else if(sRNC2 =="")
{ nBad =1; }
else { nBad = 0; }
//See below to activate this system..
////////////////////////////////////////////////////////////////////////////
//This is for the rest of the script, if it's not a PC stop here!
if(!GetIsPC(oPC))return;
/////////////////////////////////////////////////////////////////////////////
//These function add journal entries by the tag names below
//If you wish to create more, just copy / paste and change
//The tagname which is in "here", and the entry # remains 1 only!
//AddJournalQuestEntry("spells", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("x2spells", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("feats", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("shifter", 1, oPC, FALSE, FALSE);
AddJournalQuestEntry("xprules", 1, oPC, FALSE, FALSE);
AddJournalQuestEntry("serverrules", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("legartjournal", 1, oPC, FALSE, FALSE);
if(GetHitDice(oPC) <=5)
{
AddJournalQuestEntry("legartjournal", 1, oPC, FALSE, FALSE);
}
//////////////////IMPORTANT////////////////IMPORTANT////////////////////////
//This function scans the Entering PC to see if they have a legal character.
//Delete the // Below to activate the anti-cheat script
//DelayCommand(9.0, ExecuteScript("cheatercheck2", oPC));
/////////////////////////////////////////////////////////////////////////////
//If level 40 lets do some cool stuff to them :) (optional of course)
//If you do not wish to use this options you will need to delete the // below
// /* <<(don't touch this part)
if(GetHitDice(oPC) == 40 || GetItemPossessedBy(oPC, "guildpass")!=OBJECT_INVALID)
{
//Lets make the concealed 50%
eEffect = EffectConcealment(50);
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
//Lets make the look like a ghost.. :)
//To activate, simply delete the // below this line
//ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC);
}
// don't touch this line */
//////////////////////////////////////////////////////////////////////////////
//This is the immortal option, you must utilize the "makeimmortal" script
//to make players immortal (please read that script.)
if(GetItemPossessedBy(oPC, "immotoken") != OBJECT_INVALID)
{
//Run this script on the player (See script to configure settings)
ExecuteScript("powerimmortal", oPC);
}
//////////////////////////////////////////////////////////////////////////////
//If a player has been found with an illegal character they will have this item.
//It will prevent them from logging onto your server with that character.
//Note this will only work if you have activated the Anti-Cheat option above!
/*
if (GetItemPossessedBy(oPC, "banned")!= OBJECT_INVALID)
{
AssignCommand(oPC, ClearAllActions());
SetCutsceneMode(oPC, TRUE);
SetCameraMode(oPC, CAMERA_MODE_CHASE_CAMERA);
DelayCommand(4.0, FloatingTextStringOnCreature("You have an illegal character which is not allowed on this server.", oPC));
DelayCommand(5.0, SetCutsceneMode(oPC, FALSE));
DelayCommand(6.0, BootPC(oPC));
}
// */
////////////////////////////////////////////////////////////////////////////
object oDeath = GetItemPossessedBy(oPC, "death");
//Since the player was dead when they logged, kill them!
if (oDeath!=OBJECT_INVALID)
{
//FIRST REMOVE THE DEATH TOKEN!!
DestroyObject(oDeath, 0.0f);
effect eEffect;
eEffect = EffectDamage(3000, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
eEffect = SupernaturalEffect(eEffect);
DelayCommand(5.8, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC));
DelayCommand(6.2, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC));
DelayCommand(7.0, FloatingTextStringOnCreature
("<c<><63>6>Logging out to cheat death is not permitted on this server, YOU HAVE BEEN WARNED!</c>", oPC, TRUE));
SendMessageToAllDMs(GetName(oPC) + " HAS LOGGED OUT TO CHEAT DEATH!");
}
////////////////////////////////////////////////////////////////////////
//Handling BANN on this server...
//Let's see if the entering PC has been banned Altogether!
if(GetCampaignInt(GetName(GetModule()), "ADMIN_BANN", oPP)==2)
{
//Boot the PC fast!
DelayCommand(3.3, BootPC(oPP));
return;
}
//Let's see if the player's character has been banned..
if(GetItemPossessedBy(oPP, "char_bann")!=OBJECT_INVALID)
{
//If so boot them fast!
DelayCommand(2.5, BootPC(oPP));
return;
}
//////////////////////////////////////////////////////////////////////////////
//Let's prevent badly named characters from logging onto the server..
//Delete the /* below this line to activate the name checking system.
/*
//Let's verify the Entering PC has a legal name!
//NOTE This function works in conjunction with another script
//in which an NPC at the start verifies if the PC is playing a legal name.
//If the first 2 or last 2 letters of their name are bad..
if(nBad==1)
{
//Delay the following to allow the PC to enter the module..
DelayCommand(10.0,
FloatingTextStringOnCreature("You character name is not allowed!", oPP));
//Tell the database the player character is banned
DelayCommand(11.0, SetCampaignInt(GetName(GetModule()), "BANN", 1, oPP));
//Boot the PC
DelayCommand(14.0, BootPC(oPP));
return;
}
else
{
//do nothing..
}
// (do not touch this line!) */
///////////////////////////////////////////////////////////////
//End Script
}