364 lines
12 KiB
Plaintext
364 lines
12 KiB
Plaintext
//Script Name: evercliententer
|
||
//////////////////////////////////////////
|
||
//Created By: Genisys (Guile)
|
||
//Created On: 6/14/08 (Updated_8/10/08)
|
||
/////////////////////////////////////////
|
||
/*
|
||
This my premier OnClientEnter Module Event Script
|
||
for all my modules NWNX2 / Leto Modules
|
||
|
||
This script goes in the OnClient Enter Event
|
||
if you are using the nwnx2 system & leto!
|
||
*/
|
||
/////////////////////////////////////////////////////////////////
|
||
//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..
|
||
///////////////////////////////////////////////////////////////////////
|
||
|
||
//Required Includes (Don't touch!)
|
||
#include "nw_i0_tool"
|
||
#include "gen_inc_color"
|
||
#include "fky_chat_inc"
|
||
|
||
///////////////////////////
|
||
//Repetitive Variables..
|
||
effect eEffect;
|
||
int nInt;
|
||
object oItem;
|
||
object aTarget;
|
||
location bTarget;
|
||
|
||
void main()
|
||
{
|
||
//Declare Major Variables..
|
||
object oPC;
|
||
oPC = GetEnteringObject();
|
||
object oTarget;
|
||
oTarget = oPC;
|
||
object oPlayer = oPC;
|
||
object oPP = oPC;
|
||
|
||
if(GetIsDM(oPC))
|
||
{return; }
|
||
|
||
//object oInfo = GetItemPossessedBy(oPP, "pcidname");
|
||
//string sID = GetStringRight(GetName(oInfo), 14);
|
||
|
||
//Tell us if the entering CHARACTER has been banned or not
|
||
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);
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
//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 "; //The text to be colorized by the above color.
|
||
sMessage += GetRGB(15,15,1);//The next color.
|
||
sMessage += "to a "; //The next text to be colorized by the above color.
|
||
sMessage += GetRGB(15,1,1);//etc..
|
||
sMessage += "Revised Edition ";
|
||
sMessage += GetRGB(7,7,15);
|
||
sMessage += "of the ";
|
||
sMessage += GetRGB(1,15,1);
|
||
sMessage += "Classic Module";
|
||
sMessage += GetRGB(13,9,13);
|
||
sMessage += "Paths of Ascension ";
|
||
sMessage += GetRGB(12,10,7);
|
||
sMessage += "Created By: AW_Olorin ";
|
||
sMessage += GetRGB();
|
||
sMessage += "Revised By ";
|
||
sMessage += GetRGB(15,5,1);
|
||
sMessage += "Genisys (Guile) ";
|
||
sMessage += GetRGB(12,10,7);
|
||
sMessage += "on 7/21/08";
|
||
|
||
//Float welcome message by..
|
||
DelayCommand(13.3, FloatingTextStringOnCreature(sMessage, oPC, FALSE));
|
||
|
||
/////////////////////////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; }
|
||
|
||
/////////////////////////////////////////////////////////////////////
|
||
|
||
//If it's a DM entering the module...
|
||
if(GetIsDM(oPC))
|
||
{
|
||
//If the DM has never logged on before..
|
||
if(GetItemPossessedBy(oPC, "dmtoolz")==OBJECT_INVALID)
|
||
{
|
||
//Change "dmtoolz" to the tag name of any items you want given to DMs
|
||
//the first time they enter only...(copy / paste for more items)
|
||
//simply type // at the start of a line to deactivate it..
|
||
CreateItemOnObject("dmtoolz", oPC, 1);
|
||
CreateItemOnObject("dmtoolz", oPC, 1);
|
||
CreateItemOnObject("dmtoolz", oPC, 1);
|
||
CreateItemOnObject("dmtoolz", oPC, 1);
|
||
//CreateItemOnObject("dmtoolz", oPC, 1);
|
||
|
||
//This message is here for a reason!
|
||
DelayCommand(10.0, SendMessageToPC(oPC,
|
||
"<c<><63><EFBFBD>>You have been given DM Items and your DM Character was saved," +
|
||
"<c<><63><EFBFBD>> please login with the updated version of your DM Character and" +
|
||
"<c<><63><EFBFBD>> delete the original, thank you."));
|
||
|
||
//You may want to create a journal tagnamed "dmrules" and define
|
||
//what your DMs are not allowed to do here..
|
||
//simply delete the // on the line below to activate the jounral entry
|
||
//AddJournalQuestEntry("dmrules", 1, oPC, FALSE, FALSE);
|
||
}
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
//SimTools & Higher Ground's Legendary Leveler Functions
|
||
////////////////////////////////////////////////////////
|
||
string sCDKey = GetPCPublicCDKey(oPC);
|
||
|
||
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
|
||
|
||
|
||
//below removes the Letoscript string so the changes won't be applied again on the next logout
|
||
string Script = GetLocalString(oPC, "LetoScript");
|
||
if( Script != "" )
|
||
{
|
||
SetLocalString(oPC, "LetoScript", "");
|
||
}
|
||
|
||
///////////////////////////////////////////////
|
||
|
||
//Let's make sure that the following code is only executed
|
||
//on Players and not DMs..
|
||
|
||
if(!GetIsPC(oPC))return;
|
||
if(GetIsDMPossessed(oPC))return;
|
||
if(GetIsDM(oPC))return;
|
||
|
||
////////////////////////////////////////////////////////////////////////
|
||
////////JOURNAL ENTRIES////////
|
||
///////////////////////////////
|
||
//These function add journal entries by the tag names below
|
||
//If you do not have these journal entries you can create them
|
||
//I only included the 1st entry (1).
|
||
AddJournalQuestEntry("severrules", 1, oPC, FALSE, FALSE);
|
||
AddJournalQuestEntry("spells", 1, oPC, FALSE, FALSE);
|
||
AddJournalQuestEntry("x2spells", 1, oPC, FALSE, FALSE);
|
||
AddJournalQuestEntry("feats", 1, oPC, FALSE, FALSE);
|
||
AddJournalQuestEntry("shifter", 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)
|
||
//Simply type // before any effect you do not wish to apply...
|
||
if(GetHitDice(oPC) == 40)
|
||
{
|
||
//Lets make the concealed 40%
|
||
eEffect = EffectConcealment(40);
|
||
eEffect = SupernaturalEffect(eEffect);
|
||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
||
|
||
//Lets make the look like a ghost.. :)
|
||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC);
|
||
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
|
||
//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.
|
||
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));
|
||
|
||
}
|
||
|
||
//Since the player was dead when they logged, kill them!
|
||
if (GetItemPossessedBy(oPC, "death")!= OBJECT_INVALID)
|
||
{
|
||
effect eEffect;
|
||
eEffect = EffectDeath();
|
||
eEffect = SupernaturalEffect(eEffect);
|
||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
|
||
SendMessageToPC(oPC, "You died because you were dead when you logged out.");
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
////////////////////////////////////////////////////////////////////////
|
||
//Let's see if the player's character has been banned from the module..
|
||
//Not the save as a player being banned altogether..
|
||
if(nBann ==1)
|
||
{
|
||
//Boot the PC fast!
|
||
DelayCommand(3.9, BootPC(oPP));
|
||
return;
|
||
}
|
||
//Let's see if the player playing the character has been banned altogether!
|
||
if(GetCampaignInt(GetName(GetModule()), "BANN", oPP)==TRUE)
|
||
{
|
||
//If so boot them fast!
|
||
DelayCommand(3.5, BootPC(oPP));
|
||
|
||
//In Case They Can't be Booted..(Allow them to enter the module first..)
|
||
//Then lock thier game down! (Note; You cannot have a script in OnCutscenAbort!)
|
||
DelayCommand(9.0, SetCutsceneMode(oPP, TRUE, FALSE));
|
||
//They can't see nothing!
|
||
DelayCommand(9.1, FadeToBlack(oPP, FADE_SPEED_FAST));
|
||
//Turn them into a chiken :)
|
||
DelayCommand(9.2, ApplyEffectToObject
|
||
(DURATION_TYPE_PERMANENT, EffectPolymorph(113, TRUE), oPP));
|
||
DelayCommand(9.3, ExportSingleCharacter(oPP)); //Make the polymorph permanent!
|
||
return;
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
//Let's prevent badly named characters from logging onto the server..
|
||
|
||
// /*(Delete the // at the start of this line to deactivate this section)
|
||
|
||
//Let's verify they have 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));
|
||
|
||
|
||
return;
|
||
}
|
||
|
||
else // (do not touch this line!) */
|
||
{
|
||
//Welcome to them to the server..
|
||
DelayCommand(5.0, SendMessageToPC(oPP,
|
||
"<c<><63><EFBFBD>>Welcome to this CEP2 Persistent Module Created by <c }<7D>>Genisys"));
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////
|
||
|
||
//If the player has been inside of a party room, but logged out, then
|
||
//teleport them to the start and take the token!
|
||
if (GetItemPossessedBy(oPC, "partyroom")!= OBJECT_INVALID)
|
||
{
|
||
oItem = GetFirstItemInInventory(oPC);
|
||
|
||
while (GetIsObjectValid(oItem))
|
||
{
|
||
if (GetTag(oItem)=="partyroom") DestroyObject(oItem);
|
||
|
||
oItem = GetNextItemInInventory(oPC);
|
||
}
|
||
|
||
aTarget = GetWaypointByTag("home");
|
||
bTarget = GetLocation(aTarget);
|
||
|
||
if (GetAreaFromLocation(bTarget)==OBJECT_INVALID) return;
|
||
|
||
//Allow them to fully enter the module..
|
||
DelayCommand(8.0, AssignCommand(oPC, ClearAllActions()));
|
||
DelayCommand(8.1, AssignCommand(oPC, ActionJumpToLocation(bTarget)));
|
||
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
|
||
//Remove all Arena Tokens on enter..
|
||
|
||
if (GetItemPossessedBy(oPC, "arenatoken")!= OBJECT_INVALID)
|
||
{
|
||
oItem = GetFirstItemInInventory(oPC);
|
||
|
||
while (GetIsObjectValid(oItem))
|
||
{
|
||
if (GetTag(oItem)=="arenatoken") DestroyObject(oItem);
|
||
|
||
oItem = GetNextItemInInventory(oPC);
|
||
}
|
||
}
|
||
|
||
//End Script
|
||
}
|