Aschbourne_PRC8/_module/nss/se_new_player.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

168 lines
6.1 KiB
Plaintext

//::////////////////////////////////////////////////////////////////////////////
//:: Name - Simple New Player Setup v1.3
//:: File Name - se_new_player
//:: File Type - include
//:: Copyright (c) 2005 Melnibone Corp.
//::////////////////////////////////////////////////////////////////////////////
/*
NOTE - This is an include file so will not compile like
a normal script once you have changed your settings save(Ctrl+S)
You MUST also save the OnClientEnter script after any changes.
DESCRIPTION:
Simple include file for an on enter script for setting up new characters,
set starting level, remove inventory, remove slots, remove gold,
give starting gear/gold etc.
APPLICATION:
1) Use the example code "on_client_enter" for your OnClientEnter event or
create your own.
2) Change the settings below to suit your module.
*/
//::////////////////////////////////////////////////////
//:: Created By : Sir Elric
//:: Created On : 25th June, 2005
//:: Modified On: 21st July, 2005
//::////////////////////////////////////////////////////
/************************************************************************************/
/****************** ADJUST SETTINGS BELOW TO SUIT YOUR MODULE ********************/
/************************************************************************************/
int nWhichPlayers = 3; // 0 Turns ALL settings off!
// 1 New players only(ie: Only charcters with 0xp).
// 2 New players lower than nStartingLevel only.
// 3 All players once only(saves to database)PW Style
int nStartingLevel = 1; // What level should players start on 1 - 40?
int nStripAllItems = FALSE; // Strip all items in players inventory TRUE or FALSE?
int nStripAllSlots = FALSE; // Strip all items in players slots TRUE or FALSE?
int nStripAllGold = FALSE; // Strip all gold from player TRUE or FALSE?
int nStartingGold = 200; // Give new player starting gold? - 0 is off
int nStartingGear = FALSE; // Give new player starting gear TRUE or FALSE?
// If TRUE add ResRef between the quotes below(not tag),
// plus stack size,if applicable.
// eg. string sResRef = "potion"; int nStack = 6;
string sResRef = ""; int nStack = 1;
string sResRef1 = ""; int nStack1 = 1;
string sResRef2 = ""; int nStack2 = 1;
string sResRef3 = ""; int nStack3 = 1;
string sResRef4 = ""; int nStack4 = 1;
/************************************************************************************/
/************************** END OF SETTINGS **********************************/
/************************************************************************************/
// Returns Experience min for level given
int GetXPByLevel(int iLevel);
int GetXPByLevel(int iLevel)
{
int nXP = (((iLevel - 1)*iLevel)/2)*1000;
return nXP;
}
//Set up new players on enter of your module
void SirElrics_SimplePlayerSetUp(object oPC);
void SirElrics_SimplePlayerSetUp(object oPC)
{
object oMod = GetModule();
int i;
object oItem;
if(GetIsDM(oPC)) return;//DM so break...
if(!GetLocalInt(oMod, "INITIATE_VARIABLES"))
{
SetLocalInt(oMod, "STRIP_ALL_ITEMS", nStripAllItems);
SetLocalInt(oMod, "STRIP_ALL_SLOTS", nStripAllSlots);
SetLocalInt(oMod, "STRIP_ALL_GOLD", nStripAllGold);
SetLocalInt(oMod, "GIVE_STARTING_GOLD", nStartingGold);
SetLocalInt(oMod, "WHICH_PLAYERS", nWhichPlayers);
SetLocalInt(oMod, "STARTING_GEAR", nStartingGear);
SetLocalInt(oMod, "STARTING_LEVEL", nStartingLevel);
SetLocalInt(oMod, "INITIATE_VARIABLES", 1);
}
if(GetLocalInt(oMod, "WHICH_PLAYERS") == 1 && !GetLocalInt(oPC, "SE_ENTERED"))
{
if(GetXP(oPC) > 0) return;
GiveXPToCreature(oPC, 1);
SetLocalInt(oPC, "SE_ENTERED", 1);
}
else if(GetLocalInt(oMod, "WHICH_PLAYERS") == 2 && !GetLocalInt(oPC, "SE_ENTERED"))
{
if(GetHitDice(oPC)>= nStartingLevel) return;
SetLocalInt(oPC, "SE_ENTERED", 1);
}
else if(GetLocalInt(oMod, "WHICH_PLAYERS") == 3)
{
if(GetCampaignInt("New_Player_Setup", GetName(oPC), oPC)) return;
SetCampaignInt("New_Player_Setup", GetName(oPC), 1, oPC);
}
else
{
SendMessageToAllDMs("Simple New Player Setup v1.3 is switched off!");
return;//Player set up is switched off!
}
if(GetLocalInt(oMod, "STARTING_LEVEL"))
{
int nCurrentXP = GetXP(oPC);
int nGetXP = GetXPByLevel(nStartingLevel);
int nNewXP = nGetXP - nCurrentXP;
if(nCurrentXP < nGetXP)
GiveXPToCreature(oPC, nNewXP);
else
SetXP(oPC, nGetXP);
SendMessageToPC(oPC, "Levelling you to - "+IntToString(nStartingLevel));
}
if(GetLocalInt(oMod, "STRIP_ALL_GOLD"))
AssignCommand(oPC, TakeGoldFromCreature(GetGold(oPC), oPC, TRUE));
if(GetLocalInt(oMod, "GIVE_STARTING_GOLD"))
AssignCommand(oPC, GiveGoldToCreature(oPC, nStartingGold));
if(GetLocalInt(oMod, "STRIP_ALL_SLOTS"))
{
for(i=0; i < NUM_INVENTORY_SLOTS; i++)
{
oItem = GetItemInSlot(i, oPC);
if(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
SetItemCursedFlag(oItem, FALSE);
DestroyObject(oItem);
}
}
}
if(GetLocalInt(oMod, "STRIP_ALL_ITEMS"))
{
oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
SetItemCursedFlag(oItem, FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
}
if(GetLocalInt(oMod, "STARTING_GEAR"))
{
CreateItemOnObject( sResRef, oPC, nStack);
CreateItemOnObject(sResRef1, oPC, nStack1);
CreateItemOnObject(sResRef2, oPC, nStack2);
CreateItemOnObject(sResRef3, oPC, nStack3);
CreateItemOnObject(sResRef4, oPC, nStack4);
}
}
/*void main()
{
}*/