I have run onto a problem with this, whenever I add the lines to my OnClientEnter script, the module wont load the starting area. removing the lines from the script returns the module to normal behaviour. Could anyone tell me how I am supposed to merge the two?
My OnClientEnter, created by Guile:
/*////////////////////////////////////////////////////////
----------------------------------------------------------
Script Name: gen_client_enter
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 4/23/08
Updated On: 9/09/09
----------------------------------------------------------
This is my premier OnClientEnter Module Event script
It is set up for single & multiplayer mode!
----------------------------------------------------------
///////////////////////////////////////////////////////////
NOTE: You can remove bann from ALL players, by
destroying the database BANNED from your "database" folder,
also, note that the database is used across any module
you create using this module!
///////////////////////////////////////////////////////////
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..
////////color useage defined///////////
Colors Defined
1 = Red (Bright) 2 = Aqua Marine
3 = Magenta 4 = Purple
5 = Pink 6 = Olive
7 = Peach 8 = Light Grey
9 = Gold 10 = Cyan
11 = Orange 12 = Sky Blue
13 = Lavender 14 = Tan
15 = Light Green 16 = Icy Blue
17 = Deep Blue Sea 18 = Dark Cyan 19 = Pure White (Full Intensity)
Example of use in script..
string sMsg = SetColorMessage(19, "Blah blah..");
This would return: Blah blah.. (*in pure white)
----------------------------------------------------------
/////////////////////////////////////////////////////////*/
//Redundant Variables Declared
effect eEffect;
int nInt;
object oItem;
object aTarget;
location bTarget;
//Required includes for this script (don't touch!)
#include "x3_inc_horse"
#include "_inc_gen_color_"
#include "nw_i0_plot"
//PROTOTYPE DECLARED (don't touch!)
void SendMessageToAllPC(string sMessage);
void GiveDMItems(object oDM);
void GivePCItems(object oDM);
///////////////////////////////////////////////////////////////////////////
//Main Script
void main()
{
//Declare ALL Major Variables..
object oPC;
oPC = GetEnteringObject();
object oTarget;
oTarget = oPC;
object oPlayer = oPC;
object oPP = oPC;
string sCDKey = GetPCPublicCDKey(oPC, FALSE);
object oToken = GetItemPossessedBy(oPC, "idtoken");
string sName = GetName(oToken);
int nHP = GetLocalInt(oToken, "CURRENT_HP");
int nNHP, nCHP, nHHP, nDHP;
effect eEffect;
int nXP = GetLocalInt(oToken, "CURRENT_XP");
int nCXP = GetXP(oPC);
string sXP;
int y = nCXP - nXP;
int MULTI = GetLocalInt(GetModule(), "multi");
object oP = GetItemPossessedBy(oPC, "_pc_pouch");
////////////////////////////////////////////////////////////////
/* STILL TESTING THIS...
if(nCXP!=nXP)
{
if(y>=4801) //More than 6 kills at level 40 in 15 seconds TOUGH!
{ //Warn DMs that something fishy is going on!
sXP = GetName(oPC);
sXP += " had - ";
sXP += IntToString(nXP);
sXP += " XP, but logged in with - ";
sXP += IntToString(nCXP);
sXP += " XP - Investigate.";
SendMessageToAllDMs(sXP);
}
}
*/
//If it's a DM entering...
if(GetIsDM(oPC))
{
AddJournalQuestEntry("dmrules", 1, oPC, FALSE, FALSE);
GiveDMItems(oPC); //Give the DM items..
return;// Stop here!
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//Remove plot or immortal from PC if they have it..
SetPlotFlag(oPC, FALSE);
SetImmortal(oPC, FALSE); //Accidents happen
'>
////////////////////////////////////////////////////////////////
//Handle PC Items here..
////////////////////////////////////////////////////////////////
//Higher Ground's Legendary leveler
//If in fact it's a multiplayer game...
int MULTI_PLAYER = GetLocalInt(GetModule(), "multi");
if(MULTI_PLAYER)
{
string Script = GetLocalString(oPC, "LetoScript");
if( Script != "" )
{
SetLocalString(oPC, "LetoScript", "");
}
}
///////////////////////////////////////////////////////////////////////
//Entering Message to All PCs..
//Please leave the credits to the module within the message.
/*
1 = Red (Bright) 2 = Aqua Marine
3 = Magenta 4 = Purple
5 = Pink 6 = Olive
7 = Peach 8 = Light Grey
9 = Gold 10 = Cyan
11 = Orange 12 = Sky Blue
13 = Lavender 14 = Tan
15 = Light Green 16 = Icy Blue
17 = Deep Blue Sea 18 = Dark Cyan 19 = PURE White (FUll Intensity!)
Example sMessage = SetColorMessage(3, "whatever");
*/
//Colorful Server Message sent to all PCs when they enter the module..
string sMessage;
sMessage = SetColorMessage(7, "Welcome to a ");
sMessage += SetColorMessage(10, "~ 1.69 / CEP 2.2 Persistant Starter Module ~ \\n");
sMessage += SetColorMessage(7, "For Single Player ");
sMessage += SetColorMessage(7, "or Multi-Player / Online Server Modules \\n");
sMessage += SetColorMessage(12, "Created By ");
sMessage += SetColorMessage(10, "Genisys (Guile) ");
sMessage += SetColorMessage(12, "From 4/22/08 - 7/31/10 !");
//Tell the new visitor..
string sNewb;
string sNewb2;
sNewb = SetColorMessage(12, "If you'd like to ask some questions, contact me at: ");
sNewb += SetColorMessage(10, "galefer003@hotmail.com");
sNewb2 = SetColorMessage(18, "Thanks for using the module & as always, ENJOY!");
string sEnter = GetName(oPC) + " / " + GetPCPlayerName(oPC) + " / " + GetPCPublicCDKey(oPC) + " / " + GetPCIPAddress(oPC) + " Entered." ;
SendMessageToAllDMs(sEnter);
WriteTimestampedLogEntry(sEnter);
string sEnter2 = GetRGB(15,1,1) + GetName(oPC) + " / " + GetPCPlayerName(oPC) + " / " + GetPCPublicCDKey(oPC) + " / " + GetPCIPAddress(oPC) + " Has Entered. </c>" ;
SendMessageToAllPC(sEnter2);
//Float welcome message by..
DelayCommand(12.3, FloatingTextStringOnCreature(sMessage, oPC, FALSE));
if(GetHitDice(oPC)<=6)
{
DelayCommand(14.3, FloatingTextStringOnCreature(sNewb, oPC, FALSE));
DelayCommand(24.3, FloatingTextStringOnCreature(sNewb2, oPC, FALSE));
}
if(oToken !=OBJECT_INVALID && MULTI_PLAYER) //It's a multiplayermodule..
{
if(GetLocalInt(GetModule(), sName))
{
DelayCommand(7.0,
FloatingTextStringOnCreature("Welcome back!", oPC, FALSE));
}
//Otherwise set that they have visited the module recently since restart!
else
{
SetLocalInt(GetModule(), sName, TRUE);
sNewb = SetColorMessage(9, "Greetings Everyone!");
if(MULTI_PLAYER)
{
AssignCommand(oPC, ActionSpeakString(sNewb, TALKVOLUME_SHOUT));
}
}
}
else
{
sNewb = SetColorMessage(9, "Greetings Everyone!");
if(MULTI_PLAYER)
{
AssignCommand(oPC, ActionSpeakString(sNewb, TALKVOLUME_SHOUT));
}
}
//////////////////////////////////////////////////////////////////
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..
////////////////////////////////////////////////////////////////////////////
//Stop here if it's a DM entering...
if(GetIsDM(oPC))return;
////////////////////////////////////////////////////////////////////////////
//The Token System...
if(oToken == OBJECT_INVALID)
{
//This MUST be delayed!
DelayCommand(8.0, ExecuteScript("give_token", oPC));
}
//Give them their starting bag...
if(oP == OBJECT_INVALID)
{
CreateItemOnObject("_pc_pouch", oPC, 1);
GivePCItems(oPC);
//Let's get their starting Information..
DelayCommand(12.5, ExecuteScript("starting_stats", oPC));
}
else
{
//Always ensure the PC Has ALL of their PC items...
GivePCItems(oPC);
}
/////////////////////////////////////////////////////////////////////////////
//Check For Cheating, if it's a Multiplayer Game ONLY!
if(MULTI_PLAYER)
{
DelayCommand(8.0, ExecuteScript("cheat_check", oTarget));
}
//////////////////////////////////////////////////////////////////////
//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!
if(MULTI_PLAYER)
{
//AddJournalQuestEntry("rules", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("enchantinggems", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("spells", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("crafting", 1, oPC, FALSE, FALSE);
//AddJournalQuestEntry("server", 1, oPC, FALSE, FALSE);
}
//////////////////////////////////////////////////////////////////////////////
if(MULTI_PLAYER)
{
//For DM Players...
if(GetItemPossessedBy(oPC, "guildpass")!=OBJECT_INVALID)
{
//Lets make them concealed 50%
eEffect = EffectConcealment(50);
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
eEffect = EffectHaste();
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, 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(MULTI_PLAYER)
{
if (GetItemPossessedBy(oPC, "banned")!= OBJECT_INVALID ||
GetItemPossessedBy(oPC, "char_bann")!= OBJECT_INVALID ||
GetCampaignInt("BANNED", "ADMIN_BANN", oPC)==2)
{
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));
}
}
// */
////////////////////////////////////////////////////////////////////////////
if(MULTI_PLAYER)
{
//Since the player was dead when they logged, kill them!
if (GetLocalInt(oToken, "DEATH_STATE")==TRUE)
{
eEffect = EffectDeath();
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
SendMessageToPC(oPC, "You died because you were dead when you logged out.");
}
else
{
nCHP = GetCurrentHitPoints(oPC);
//If the player logged out while damaged...
if(nHP != nCHP && nHP != 0)
{
if(nHP>=1)
{
nNHP = nCHP - nHP;
eEffect = EffectDamage(nNHP, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
DelayCommand(5.8, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC));
}
//Otherwise they must have had less than 1 hit points
else
{
eEffect = EffectDeath();
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
SendMessageToPC(oPC, "You died because you were dead when you logged out.");
}
}
}
}
///////////////////////////////////////////////////////////////////
//Bioware Scripting For Handing Horses (DECATIVATED!!)
/*
ExecuteScript("x3_mod_pre_enter",OBJECT_SELF); // Override for other skin systems
if ((GetIsPC(oPC)||GetIsDM(oPC))&&!GetHasFeat(FEAT_HORSE_MENU,oPC))
{ // add horse menu
HorseAddHorseMenu(oPC);
if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB"))
{ // restore PC horse status from database
DelayCommand(2.0,HorseReloadFromDatabase(oPC,X3_HORSE_DATABASE));
} // restore PC horse status from database
} // add horse menu
if (GetIsPC(oPC))
{ // more details
// restore appearance in case you export your character in mounted form, etc.
if (!GetSkinInt(oPC,"bX3_IS_MOUNTED")) HorseIfNotDefaultAppearanceChange(oPC);
// pre-cache horse animations for player as attaching a tail to the model
HorsePreloadAnimations(oPC);
DelayCommand(3.0,HorseRestoreHenchmenLocations(oPC));
} // more details
// DON'T TOUCH THIS LINE!! */
//////////////////////////////////////////////////////
///////////////////////////////
} //Main Script End
///////////////////////////////
/////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//##################### ALL PROTOTYPES DEFINED ########################//
//////////////////////////////////////////////////////////////////////////
//PROTOTYPE DEFINED
void SendMessageToAllPC(string sMessage)
{
object oPC = GetFirstPC();
while(GetIsObjectValid(oPC))
{
FloatingTextStringOnCreature(sMessage, oPC);
oPC = GetNextPC();
}
}
////////////////////////////////////////////////
//PROTOTYPE DEFINED
void GiveDMItems(object oDM)
{
object oWay = GetWaypointByTag("ref_point");
object oBarrel = GetNearestObjectByTag("gen_dm_items", oWay);
object oCopy = GetFirstItemInInventory(oBarrel);
string sTag;
while(GetIsObjectValid(oCopy))
{
sTag = GetTag(oCopy);
if(!HasItem(oDM, sTag))
{
CopyItem(oCopy, oDM, TRUE);
}
oCopy = GetNextItemInInventory(oBarrel);
}
}
///////////////////////////////////////////////////////
//PROTOTYPE DEFINED
void GivePCItems(object oDM)
{
object oWay = GetWaypointByTag("ref_point");
object oBarrel = GetNearestObjectByTag("gen_start_items", oWay);
object oCopy = GetFirstItemInInventory(oBarrel);
string sTag;
while(GetIsObjectValid(oCopy))
{
sTag = GetTag(oCopy);
if(!HasItem(oDM, sTag))
{
CopyItem(oCopy, oDM, TRUE);
}
oCopy = GetNextItemInInventory(oBarrel);
}
DelayCommand(3.0, ExecuteScript("pc_item_sort", oDM));
}