Rune_PRC8/_module/nss/opw_mod_onenter.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

72 lines
2.1 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
//
// Olander's Module On Enter
// opw_mod_onenter
// By Don Anderson
// dandersonru@msn.com
//
// Miscellaneous On Enter Event.
//
////////////////////////////////////////////////////////////////////////////////
#include "nbde_inc"
#include "opw_inc_pstat"
#include "opw_inc_weapons"
void main()
{
object oPC = GetEnteringObject();
object oMod = GetModule();
//Update and/or Create Player Unique ID
string sPCU = NBDE_GetCampaignString("UNIQUEIDS","PCU",oPC);
if(sPCU == "")
{
string sPCN = GetName(oPC);
string sPre = GetStringLeft(sPCN,2);
int nNum1 = Random(10000) + 1;
int nNum2 = Random(10000) + 1;
int nNum3 = Random(10000) + 1;
int nNum4 = Random(10000) + 1;
int nAvg = (nNum1 + nNum2 + nNum3 + nNum4)/4;
string sID = sPre + IntToString(nAvg);
SetLocalString(oPC,"PCU",sID);
NBDE_SetCampaignString("UNIQUEIDS","PCU",sID,oPC);
}
else SetLocalString(oPC,"PCU",sPCU);
//Set Up Player Birthday and Start Time
int nBirthday = GetLocalInt(GetModule(),"BIRTHDAY");
if(nBirthday == 1) ProcessPCBirthday(oPC);
//The One Ring For All DM's
object oOneRing = GetItemPossessedBy(oPC,"dmfi_onering");
if(GetIsObjectValid(oOneRing) == FALSE && GetIsDM(oPC) == TRUE)
{
CreateItemOnObject("dmfi_onering", oPC,1);
}
//Racial Movement Rates
int nRacial = GetLocalInt(oMod,"RACIALMOVE");
if(nRacial == 1) SetRacialMovementRate(oPC);
if(GetIsPC(oPC) == TRUE)
{
int nAllege = NBDE_GetCampaignInt("ALLEGIANCE","FACTION",oPC);
SetLocalInt(oPC,"FACTION",nAllege);
//Align the Player
if(nAllege == 1) AlignGood(oPC);
if(nAllege == 2) AlignEvil(oPC);
if(nAllege == 3) AlignNeutral(oPC);
//Now Check the Creature Skin and Save it
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
string sSkin = GetResRef(oSkin);
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sSkin,oPC);
}
NBDE_FlushCampaignDatabase("UNIQUEIDS");
DelayCommand(1.0,NBDE_FlushCampaignDatabase("ALLEGIANCE"));
}