#include "adv_include" #include "rwt_include" #include "inc_pcjournal" #include "disease_include" #include "inc_helper_funcs" // Determines which version characters are currently at. // If a character that logs in doesn't match this version they will be reinitialized // (AKA: All feats stripped, skills at zero, and stats set to 10) const int CHARACTER_VERSION = 1; void main() { object oPC = GetEnteringObject(); if(GetIsDM(oPC)) return; object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); object oModule = GetModule(); int iLoop = 1; // Fires only if player hasn't been initialized with the game system if(GetLocalInt(oDatabase, "GAME_SYSTEM_SETUP") == FALSE) { object oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { DestroyObject(oItem); oItem = GetNextItemInInventory(oPC); } // Create a database item oDatabase = CreateItemOnObjectSafe(PC_DATABASE, oPC, 1); // Now initialize all stats, remove feats, remove spells, set skills to 0 // for use with the custom advancement system // Also initialize HP regeneration amount and rate. ADV_InitializePC(oPC); // Mark the system as set up so that PCs don't go through this // again next time SetLocalInt(oDatabase, "GAME_SYSTEM_SETUP", TRUE); // Take all gold from PC AssignCommand(oPC, TakeGoldFromCreature(GetGold(oPC), oPC, TRUE)); // Set up their max Hunger level /* SetLocalInt(oDatabase, FOOD_CURRENT_HUNGER, 100); SetLocalInt(oDatabase, FOOD_MAX_HUNGER, 100); SetLocalInt(oDatabase, FOOD_HUNGER_COUNTDOWN, 30); */ DISEASE_SetDiseaseCap(oPC, 100); // Give the new character a unique ID number (used in other systems) int iNumOfIDs = GetPersistentInt(oModule, "CHARACTER_COUNT", "pwdata") + 1; SetLocalInt(oDatabase, PC_ID_NUMBER, iNumOfIDs); SetPersistentInt(oModule, "CHARACTER_COUNT", iNumOfIDs, 0, "pwdata"); // Mark the character's creation date on their database // Mainly used to track their 72 hour sanctuary effect, but can be referenced elsewhere as needed SetLocalString(oDatabase, CHARACTER_CREATION_DATE, RWT_GetCurrentTimestamp()); SetLocalInt(oDatabase, CHARACTER_CREATION_DATE, RWT_GetUnixTimestamp()); // Dicebag and Emote Wand CreateItemOnObjectSafe("dmfi_pc_emote", oPC, 1); CreateItemOnObjectSafe("dmfi_pc_dicebag", oPC, 1); // SIMTools Chat Targeter CreateItemOnObjectSafe("fky_chat_target", oPC, 1); // Handgun and ammo oItem = CreateItemOnObjectSafe("beretta_92f", oPC, 1); SetLocalInt(oItem, GUN_MAGAZINE_BULLET_COUNT, 10); oItem = CreateItemOnObjectSafe("ammo_box_1", oPC, 10); // Replace clothes DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)); oItem = CreateItemOnObjectSafe("starting_shirt", oPC, 1); AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)); // Personal journal //CreateNewJournal(oPC); // Starting gold AssignCommand(oPC, GiveGoldToCreature(oPC, 30)); // Initialize hot bar if(ADV_USING_LINUX) { // Remove all other quickbar slots int iSlot; for(iSlot = 0; iSlot <= 10; iSlot++) { SetRawQuickBarSlot(oPC, IntToString(iSlot) + " 0 0 0 0"); } // Add reload feat SetRawQuickBarSlot(oPC, "1 4 0 1116 0"); } else { struct quickslot_s stQuickslotData; stQuickslotData.iType = QUICKBAR_TYPE_INVALID; stQuickslotData.iParam1 = 0; // Clear the PC's hotbar list int iSlot; for(iSlot = 1; iSlot <= 10; iSlot++) { NWNXFuncs_SetQuickSlot(oPC, iSlot, stQuickslotData, FALSE); } // Put attack in slot 1 and reload in slot 11 (F12 in game) stQuickslotData.iType = QUICKBAR_TYPE_ATTACK; NWNXFuncs_SetQuickSlot(oPC, 0, stQuickslotData, FALSE); stQuickslotData.iType = QUICKBAR_TYPE_FEAT; stQuickslotData.iParam1 = 1116; NWNXFuncs_SetQuickSlot(oPC, 11, stQuickslotData, FALSE); NWNXFuncs_UpdateQuickbarGUI(oPC); } SetLocalInt(oDatabase, "CHARACTER_VERSION", CHARACTER_VERSION); } // Reinitializes the PC if their character version doesn't match the current one. // This is useful for when an update changes the way the advancement system works int iVersion = GetLocalInt(oDatabase, "CHARACTER_VERSION"); if(iVersion != CHARACTER_VERSION) { ReinitializePlayerCharacter(oPC, CHARACTER_VERSION, 8.0, TRUE); } }