PWE_PRC8/_module/nss/mod_cliententerd.nss
Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

86 lines
2.8 KiB
Plaintext

#include "inc_isdm"
#include "sha_disallo_devc"
void main()
{
// ExecuteScript("ff_on_cl_enter", OBJECT_SELF);
CheckForDevestatingCritical(GetEnteringObject());
object oPC = GetEnteringObject();
if(GetIsDM(oPC))
return;//dont mess with DMs
if(GetXP(oPC)== 0)
{
//first entry
// Check Equip Items and get rid of them
int i;
for(i=0; i<14; i++)
{
object oEquip = GetItemInSlot(i,oPC);
if(GetIsObjectValid(oEquip))
{
SetPlotFlag(oEquip,FALSE);
DestroyObject(oEquip);
GiveXPToCreature(oPC,1);
}
}
// Check general Inventory and clear it out.
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem,FALSE);
if(GetHasInventory(oItem))
{
object oItem2 = GetFirstItemInInventory(oItem);
while(GetIsObjectValid(oItem2))
{
SetPlotFlag(oItem2,FALSE);
DestroyObject(oItem2);
oItem2 = GetNextItemInInventory(oItem);
}
}
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
//Take their Gold
int nAmount = GetGold(oPC);
if(nAmount > 0)
{
AssignCommand(oPC,TakeGoldFromCreature(nAmount,oPC,TRUE));
}
object oClothes = CreateItemOnObject("nw_cloth022", oPC);
AssignCommand(oPC, ActionEquipItem(oClothes, INVENTORY_SLOT_CHEST));
SetLocalInt(oPC, "League", 0);
}
else
{
//add code to jump to module start here
AssignCommand(oPC, JumpToLocation(GetLocation(GetWaypointByTag("WP_RealStart"))));
}
object PC = GetEnteringObject();
SetPlotFlag(PC, FALSE);
SetImmortal(PC, FALSE);
ExecuteScript("fixitems", PC);
if (GetItemPossessedBy(PC, "EmoteWand") == OBJECT_INVALID) CreateItemOnObject("emotewand", PC);
if (GetItemPossessedBy(PC, "whostone") == OBJECT_INVALID) CreateItemOnObject("whostone", PC);
if (GetItemPossessedBy(PC, "NW_IT_RECALL") == OBJECT_INVALID) CreateItemOnObject("recall", PC);
int toys = GetCampaignInt(GetModuleName(), "toys", PC);
SetLocalInt(PC, "toys", toys);
int dm = isdm(PC);
int s, tcnt = GetLocalInt(GetModule(), "tcnt");
string ref;
object item;
for(s=0; s<tcnt; s++) {
ref = GetLocalString(GetModule(), "tref"+IntToString(s));
item = GetItemPossessedBy(PC, "toy_"+ref);
if (((1<<s) & toys) != 0 || dm != 0) {
if (item == OBJECT_INVALID) item = CreateItemOnObject(ref, PC);
}
if (item != OBJECT_INVALID) SetLocalInt(item, "id", s);
}
DelayCommand(15.0, AddJournalQuestEntry("welcome", 1, PC, FALSE));
}