diff --git a/_module/are/hightopcity.are.json b/_module/are/hightopcity.are.json index 4b15e38d..5e403047 100644 --- a/_module/are/hightopcity.are.json +++ b/_module/are/hightopcity.are.json @@ -9840,7 +9840,7 @@ }, "Version": { "type": "dword", - "value": 108 + "value": 111 }, "Width": { "type": "int", diff --git a/_module/are/icyplainsbarrack.are.json b/_module/are/icyplainsbarrack.are.json index 5931a671..95e868a5 100644 --- a/_module/are/icyplainsbarrack.are.json +++ b/_module/are/icyplainsbarrack.are.json @@ -87,7 +87,7 @@ "Name": { "type": "cexolocstring", "value": { - "0": "Icy Plains Barracks" + "0": "The Icy Plains: Barracks" } }, "NoRest": { @@ -1230,13 +1230,17 @@ } ] }, + "TileBrdrDisabled": { + "type": "byte", + "value": 0 + }, "Tileset": { "type": "resref", "value": "tin01" }, "Version": { "type": "dword", - "value": 11 + "value": 12 }, "Width": { "type": "int", diff --git a/_module/are/icyplainsoutpost.are.json b/_module/are/icyplainsoutpost.are.json index 29ea99a2..60f750a6 100644 --- a/_module/are/icyplainsoutpost.are.json +++ b/_module/are/icyplainsoutpost.are.json @@ -87,7 +87,7 @@ "Name": { "type": "cexolocstring", "value": { - "0": "Icy Plains Outpost" + "0": "The Icy Plains: Outpost" } }, "NoRest": { @@ -1230,13 +1230,17 @@ } ] }, + "TileBrdrDisabled": { + "type": "byte", + "value": 0 + }, "Tileset": { "type": "resref", "value": "tin01" }, "Version": { "type": "dword", - "value": 13 + "value": 14 }, "Width": { "type": "int", diff --git a/_module/are/respawning.are.json b/_module/are/respawning.are.json index b431a875..942f93ac 100644 --- a/_module/are/respawning.are.json +++ b/_module/are/respawning.are.json @@ -87,7 +87,7 @@ "Name": { "type": "cexolocstring", "value": { - "0": "Respawning" + "0": "| Respawning |" } }, "NoRest": { @@ -337,7 +337,7 @@ }, "Version": { "type": "dword", - "value": 28 + "value": 33 }, "Width": { "type": "int", diff --git a/_module/fac/repute.fac.json b/_module/fac/repute.fac.json index 199d146f..6cfac2d0 100644 --- a/_module/fac/repute.fac.json +++ b/_module/fac/repute.fac.json @@ -37,7 +37,7 @@ "__struct_id": 2, "FactionGlobal": { "type": "word", - "value": 1 + "value": 0 }, "FactionName": { "type": "cexostring", @@ -52,7 +52,7 @@ "__struct_id": 3, "FactionGlobal": { "type": "word", - "value": 1 + "value": 0 }, "FactionName": { "type": "cexostring", @@ -995,7 +995,7 @@ }, "FactionRep": { "type": "dword", - "value": 50 + "value": 100 } }, { @@ -1280,7 +1280,7 @@ }, "FactionRep": { "type": "dword", - "value": 50 + "value": 100 } }, { @@ -1310,7 +1310,7 @@ }, "FactionRep": { "type": "dword", - "value": 50 + "value": 100 } }, { @@ -1595,7 +1595,7 @@ }, "FactionRep": { "type": "dword", - "value": 50 + "value": 100 } }, { @@ -3830,7 +3830,7 @@ }, "FactionRep": { "type": "dword", - "value": 50 + "value": 100 } }, { diff --git a/_module/git/hightopcity.git.json b/_module/git/hightopcity.git.json index 40cec580..8eb08257 100644 --- a/_module/git/hightopcity.git.json +++ b/_module/git/hightopcity.git.json @@ -624,7 +624,7 @@ }, "FactionID": { "type": "word", - "value": 4 + "value": 15 }, "FeatList": { "type": "list", @@ -699,7 +699,7 @@ }, "IsImmortal": { "type": "byte", - "value": 0 + "value": 1 }, "IsPC": { "type": "byte", @@ -739,7 +739,7 @@ }, "Plot": { "type": "byte", - "value": 0 + "value": 1 }, "PortraitId": { "type": "word", @@ -43146,7 +43146,7 @@ }, "XPosition": { "type": "float", - "value": 77.206787109375 + "value": 77.24542999267578 }, "YOrientation": { "type": "float", @@ -43154,11 +43154,11 @@ }, "YPosition": { "type": "float", - "value": 102.9355850219727 + "value": 102.8522262573242 }, "ZPosition": { "type": "float", - "value": -0.5900029540061951 + "value": -0.5899975299835205 } }, { @@ -81282,15 +81282,15 @@ }, "X": { "type": "float", - "value": 79.86756896972656 + "value": 79.08158111572266 }, "Y": { "type": "float", - "value": 120.5093231201172 + "value": 118.2999877929688 }, "Z": { "type": "float", - "value": 9.5367431640625e-006 + "value": -5.7220458984375e-006 } }, { diff --git a/_module/git/respawning.git.json b/_module/git/respawning.git.json index 78b952cb..d82979d5 100644 --- a/_module/git/respawning.git.json +++ b/_module/git/respawning.git.json @@ -798,7 +798,7 @@ }, "XPosition": { "type": "float", - "value": 13.00344657897949 + "value": 13.19540405273438 }, "YOrientation": { "type": "float", @@ -806,11 +806,11 @@ }, "YPosition": { "type": "float", - "value": 10.46471309661865 + "value": 8.502401351928711 }, "ZPosition": { "type": "float", - "value": 2.980232238769531e-008 + "value": -5.7220458984375e-006 } } ] diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index 720bfa62..fe56ca0b 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -956,11 +956,11 @@ }, "Mod_Entry_X": { "type": "float", - "value": 10.0 + "value": 9.0 }, "Mod_Entry_Y": { "type": "float", - "value": 7.0 + "value": 5.0 }, "Mod_Entry_Z": { "type": "float", diff --git a/_module/ncs/en3_death.ncs b/_module/ncs/en3_death.ncs index bdcb8126..efd5012c 100644 Binary files a/_module/ncs/en3_death.ncs and b/_module/ncs/en3_death.ncs differ diff --git a/_module/ncs/en3_respawn2.ncs b/_module/ncs/en3_respawn2.ncs index 2d3f941a..dc521733 100644 Binary files a/_module/ncs/en3_respawn2.ncs and b/_module/ncs/en3_respawn2.ncs differ diff --git a/_module/ncs/en3_scout_spawn.ncs b/_module/ncs/en3_scout_spawn.ncs index b0f5d13d..d925a359 100644 Binary files a/_module/ncs/en3_scout_spawn.ncs and b/_module/ncs/en3_scout_spawn.ncs differ diff --git a/_module/ncs/mod_enter.ncs b/_module/ncs/mod_enter.ncs index 59604fa0..0927c69c 100644 Binary files a/_module/ncs/mod_enter.ncs and b/_module/ncs/mod_enter.ncs differ diff --git a/_module/ncs/ms_name_inc.ncs b/_module/ncs/ms_name_inc.ncs new file mode 100644 index 00000000..ecb1c72d Binary files /dev/null and b/_module/ncs/ms_name_inc.ncs differ diff --git a/_module/ncs/old_mod_enter.ncs b/_module/ncs/old_mod_enter.ncs new file mode 100644 index 00000000..8c06e44c Binary files /dev/null and b/_module/ncs/old_mod_enter.ncs differ diff --git a/_module/ncs/prc_pwonspawn.ncs b/_module/ncs/prc_pwonspawn.ncs index 5273c999..cfccd91e 100644 Binary files a/_module/ncs/prc_pwonspawn.ncs and b/_module/ncs/prc_pwonspawn.ncs differ diff --git a/_module/ncs/x2_def_spawn.ncs b/_module/ncs/x2_def_spawn.ncs index 9dc757ec..cddc870c 100644 Binary files a/_module/ncs/x2_def_spawn.ncs and b/_module/ncs/x2_def_spawn.ncs differ diff --git a/_module/ncs/zep_drider_spawn.ncs b/_module/ncs/zep_drider_spawn.ncs index 2b9ed723..549fffd0 100644 Binary files a/_module/ncs/zep_drider_spawn.ncs and b/_module/ncs/zep_drider_spawn.ncs differ diff --git a/_module/ncs/zep_rust_spawn.ncs b/_module/ncs/zep_rust_spawn.ncs index 577de79a..3610b057 100644 Binary files a/_module/ncs/zep_rust_spawn.ncs and b/_module/ncs/zep_rust_spawn.ncs differ diff --git a/_module/nss/en3_death.nss b/_module/nss/en3_death.nss index ece1a6d2..03b8eb9c 100644 --- a/_module/nss/en3_death.nss +++ b/_module/nss/en3_death.nss @@ -1,10 +1,24 @@ #include "prc_inc_racial" #include "utl_i_sqluuid" #include "utl_i_sqlocals" +#include "nw_i0_plot" void GetKiller(); -void Raise(object oPlayer) +void ClearAllFactionMembers(object oMember, object oPlayer) +{ +// AssignCommand(oMember, SpeakString("here")); + AdjustReputation(oPlayer, oMember, 100); + SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad + object oClear = GetFirstFactionMember(oMember, FALSE); + while (GetIsObjectValid(oClear) == TRUE) + { + ClearPersonalReputation(oPlayer, oClear); + oClear = GetNextFactionMember(oMember, FALSE); + } +} + +/* void EN4_Raise(object oPlayer) { effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION); @@ -37,6 +51,7 @@ void Raise(object oPlayer) SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE)); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer); } + */ void main() { @@ -81,8 +96,25 @@ if (SQLocalsUUID_GetInt(oPlayer,"PCHardcore") == 0 && SQLocalsUUID_GetInt(oPlaye { SQLocalsUUID_SetInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer); } + + //:: Clears bad rep with Neutral faction. + ClearAllFactionMembers(GetObjectByTag("en4_evilstarter"), oPlayer); + + //:: Hopefully stops the melee in Hightop if a player respawns after attacking Defenders or Citizens. + object oGuard = GetObjectByTag("en4_cityguard4"); + object oCitizen = GetObjectByTag("en4_wcitizen"); + object oMerchant = GetObjectByTag("en4_merchant6"); + + AdjustFactionReputation(oGuard, oCitizen, 100); + AdjustFactionReputation(oCitizen, oGuard, 100); + + AdjustFactionReputation(oMerchant, oCitizen, 100); + AdjustFactionReputation(oCitizen, oMerchant, 100); + + AdjustFactionReputation(oGuard, oMerchant, 100); + AdjustFactionReputation(oMerchant, oGuard, 100); -DelayCommand(2.0, PopUpDeathGUIPanel(oPlayer,TRUE, TRUE,0,"Death has taken you.")); + DelayCommand(2.0, PopUpDeathGUIPanel(oPlayer,TRUE, TRUE,0,"You are dead.")); } void GetKiller() diff --git a/_module/nss/en3_respawn2.nss b/_module/nss/en3_respawn2.nss index df65d229..bf3ec2f7 100644 --- a/_module/nss/en3_respawn2.nss +++ b/_module/nss/en3_respawn2.nss @@ -1,29 +1,46 @@ void main() { - object oPC = GetEnteringObject(); + object oPC; + object oSpawnPoint; + string sDestTag; - if (GetIsPC(oPC)) - { - string sDestTag = GetLocalString(oPC, "Respawn"); - if (sDestTag == "") - { - sDestTag = "en3_respawning"; - } + oPC = GetEnteringObject(); - object oSpawnPoint = GetObjectByTag(sDestTag); + //SendMessageToPC(oPC,"en3_respawn2 >> entering."); + + if (GetIsPC(oPC)) + { + //SendMessageToPC(oPC,"en3_respawn2 >> PC found."); + + sDestTag = GetLocalString(oPC,"Respawn"); + + if (sDestTag == "") + { + //SendMessageToPC(oPC,"en3_respawn2 >> Destination variable was unset, setting."); + SetLocalString(oPC, "Respawn", "EN4_Respawn"); + } + + //SendMessageToPC(oPC,"en3_respawn2 >> Destination tag is: "+sDestTag+"."); + + oSpawnPoint = GetWaypointByTag(sDestTag); + if (GetIsObjectValid(oSpawnPoint)) { - AssignCommand(oPC, JumpToLocation(GetLocation(oSpawnPoint))); + //SendMessageToPC(oPC,"en3_respawn2 >> Destination is valid, jumping."); + // Teleport the PC. + AssignCommand(oPC, ClearAllActions()); + DelayCommand(0.3f,AssignCommand(oPC,JumpToObject(oSpawnPoint))); } else { // optional debug FloatingTextStringOnCreature("Invalid spawn point: " + sDestTag, oPC); - } - } + } + } } + /* void main() { object oPC; diff --git a/_module/nss/mod_enter.nss b/_module/nss/mod_enter.nss index 25ba2c97..d6a09209 100644 --- a/_module/nss/mod_enter.nss +++ b/_module/nss/mod_enter.nss @@ -53,31 +53,31 @@ void main() { //SQLocalsUUID_SetInt(oPC,"OverallQuest",132); - SQLocals_SetInt(GetModule(),"ClientEnter",1); + SetLocalInt(GetModule(),"ClientEnter",1); - DelayCommand(1.0f,SQLocals_SetInt(GetModule(),"ClientEnter",0)); + DelayCommand(1.0f,SetLocalInt(GetModule(),"ClientEnter",0)); - if (SQLocals_GetInt(GetModule(),"ModuleStart") == 0) + if (GetLocalInt(GetModule(),"ModuleStart") == 0) SetupModule(); - if (SQLocals_GetInt(GetModule(),"DynamicMerchant") == 0) + if (GetLocalInt(GetModule(),"DynamicMerchant") == 0) { SetupDynamicMerchant(); - SQLocals_SetInt(GetModule(),"DynamicMerchant",1); + SetLocalInt(GetModule(),"DynamicMerchant",1); SQLocalsUUID_SetInt(oPC,"DynamicMerchant",1); } else { - if (SQLocalsUUID_GetInt(oPC,"DynamicMerchant") == 0) + if (GetLocalInt(oPC,"DynamicMerchant") == 0) { AddToDynamicMerchant(); SQLocalsUUID_SetInt(oPC,"DynamicMerchant",1); } } - if (SQLocalsUUID_GetInt(oPC,"ModStart") == 0) + if (GetLocalInt(oPC,"ModStart") == 0) { - SQLocalsUUID_SetInt(oPC,"ModStart",1); - SQLocalsUUID_SetInt(oPC,"Entering",1); + SetLocalInt(oPC,"ModStart",1); + SetLocalInt(oPC,"Entering",1); if (iAnimal >= 1) { @@ -103,6 +103,7 @@ void main() SendMessageToPC(oPC,"Starting New Campaign..."); SetLocalString(oPC,"Respawn","EN4_Respawn"); + SendMessageToPC(oPC,"EN4_Respawn is set on the 'Respawn' string var."); if (GetXP(oPC) == 0) { @@ -144,10 +145,10 @@ void main() } } - if (SQLocalsUUID_GetInt(GetModule(),"ModStarted") == 0) + if (GetLocalInt(GetModule(),"ModStarted") == 0) { SetupRandomNPCs(); - SQLocalsUUID_SetInt(GetModule(),"ModStarted",1); + SetLocalInt(GetModule(),"ModStarted",1); } } @@ -187,7 +188,7 @@ void SetupCharacter(object oPC) oItem = CreateItemOnObject("Tunic",oPC); - AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)); + DelayCommand(0.0f, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)); CheckSpecialRace(oPC); @@ -789,14 +790,14 @@ if (iMod>0) string GetRace(object oPC) { - string sRace = GetSubRace(oPC); - - if (sRace == "") - { - sRace = GetStringByStrRef(StringToInt(Get2DAString("racialtypes", "Name", GetRacialType(oPC)))); - } - - return sRace; + string sRace = GetSubRace(oPC); + + if (sRace == "") + { + sRace = GetStringByStrRef(StringToInt(Get2DAString("racialtypes", "Name", GetRacialType(oPC)))); + } + + return sRace; } void SetupDynamicMerchant() @@ -861,43 +862,43 @@ GetNegativeItem(oStore); void AddToDynamicMerchant() { -object oStore; + object oStore; -oStore = GetObjectByTag("NH1_Dynamic"); + oStore = GetObjectByTag("NH1_Dynamic"); -GetMagicItem(oStore,TRUE,TRUE,5); -GetMagicItem(oStore,TRUE,TRUE,5); -GetMagicItem(oStore,TRUE,TRUE,5); -GetMagicItem(oStore,TRUE,TRUE,5); + GetMagicItem(oStore,TRUE,TRUE,5); + GetMagicItem(oStore,TRUE,TRUE,5); + GetMagicItem(oStore,TRUE,TRUE,5); + GetMagicItem(oStore,TRUE,TRUE,5); } void SetupModule() { -object oChest; -int iRandom; -int iAI; + object oChest; + int iRandom; + int iAI; -SQLocals_SetInt(GetModule(),"ModuleStart",1); -SQLocals_SetInt(GetModule(),MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR,FALSE); -SetMaxHenchmen(4); + SetLocalInt(GetModule(),"ModuleStart",1); + SetLocalInt(GetModule(),MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR,FALSE); + SetMaxHenchmen(4); -string sCampaign = "Endless Nights IV"; -if (GetCampaignInt(sCampaign,"MP") == 1) - sCampaign = "MP_Endless Nights IV"; -iAI = GetCampaignInt(sCampaign,"MP"); -SQLocals_SetInt(GetModule(),"NoAI",iAI); + string sCampaign = "Endless Nights IV"; + if (GetCampaignInt(sCampaign,"MP") == 1) sCampaign = "MP_Endless Nights IV"; -oChest = GetObjectByTag("EN4_SpecChest" + IntToString(Random(2)+1)); -SQLocals_SetInt(oChest,"Weapon",1); + iAI = GetCampaignInt(sCampaign,"MP"); + SetLocalInt(GetModule(),"NoAI",iAI); -iRandom = Random(4); -if (iRandom==0) - { - iRandom = Random(4)+1; - SQLocals_SetInt(GetModule(),"HTC_SpecialMerchant",iRandom); - } + oChest = GetObjectByTag("EN4_SpecChest" + IntToString(Random(2)+1)); + SetLocalInt(oChest,"Weapon",1); -WriteTimestampedLogEntry("*** Endless Night IV Loaded ***"); + iRandom = Random(4); + if (iRandom==0) + { + iRandom = Random(4)+1; + SetLocalInt(GetModule(),"HTC_SpecialMerchant",iRandom); + } + + WriteTimestampedLogEntry("*** Endless Night IV Loaded ***"); } void CheckSpecialRace(object oPC) @@ -1056,120 +1057,6 @@ void CheckSpecialRace(object oPC) else if (iRace == RACIAL_TYPE_ZAKYA_RAKSHASA) {iDeaths = 3; iMonstrous = 0;} -// if (iRace == RACIAL_TYPE_SHADOWSWYFT) {iDeaths = 2;} - -// else if (iRace == RACIAL_TYPE_NERAPHIM) {iDeaths = 1; iMonstrous = 1;} - -// else if (iRace == RACIAL_TYPE_TROLL) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_HALFOGRE) - // { - // iDeaths = 2; - // } -// else if (iRace == RACIAL_TYPE_AZER) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_PIXIE) - // { - // iDeaths = 2; - // } -// else if (iRace == RACIAL_TYPE_ILLITHID) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_RAKSHASA) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_GITHZERAI) - // { - // iDeaths = 2; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_GITHYANKI) - // { - // iDeaths = 2; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_PURE_YUAN) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_LIZARDFOLK) - // { - // iDeaths = 2; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_MINOTAUR) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_BUGBEAR) - // { - // iDeaths = 1; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_OGRE) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_TIEFLING) - // { - // iDeaths = 1; - // } -// else if (iRace == RACIAL_TYPE_TANARUKK) - // { - // iDeaths = 3; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_FEYRI) - // { - // iDeaths = 3; - // } -// else if (iRace == RACIAL_TYPE_AASIMAR) - // { - // iDeaths = 1; - // } -// else if (iRace == RACIAL_TYPE_OROG) - // { - // iDeaths = 2; - // iMonstrous = 1; - // } -// else if (iRace == RACIAL_TYPE_DEEP_GNOME) - // { - // iDeaths = 2; - // } -// else if (iRace == RACIAL_TYPE_DROW_FEMALE) - // { - // iDeaths = 2; - // } -// else if (iRace == RACIAL_TYPE_WILD_DWARF) - // { - // iDeaths = 1; - // } -// else if (iRace == RACIAL_TYPE_URDINNIR) - // { - // iDeaths = 2; - // } -// else if (iRace == RACIAL_TYPE_DUERGAR) - // { - // iDeaths = 1; - // } -// else if (iRace == RACIAL_TYPE_ARC_DWARF) - // { - // iDeaths = 2; - // } - if (iMonstrous == 1) { object oGood; diff --git a/_module/nss/old_mod_enter.nss b/_module/nss/old_mod_enter.nss new file mode 100644 index 00000000..5e204237 --- /dev/null +++ b/_module/nss/old_mod_enter.nss @@ -0,0 +1,1518 @@ +#include "nw_i0_tool" +#include "x2_inc_switches" +#include "rd_questinc" +#include "rd_treasure" +//#include "en4_racial_const" +#include "prc_inc_racial" +#include "inc_examine" +#include "inc_gennui" +#include "utl_i_sqluuid" +#include "utl_i_sqlocals" +#include "prc_inc_template" + +void SetupCharacter(object oPC); +void GetItems(object oPC); +void RemoveAllItems(object oPC); +void InitialEvent(object oPC); +int ValidStartingItem(string sTag); +string GetRace(object oPC); +void SetupDynamicMerchant(); +void AddToDynamicMerchant(); +void SetupModule(); +void CheckSpecialRace(object oPC); +void SetupRandomNPCs(); +void CheckImport(object oPC); + +void main() +{ + int iLevel; + int iRnd; + int iRnd2; + int iIndex; + object oPC = GetEnteringObject(); + object oAnimal; + + int iAnimal = GetLevelByClass(CLASS_TYPE_DRUID, oPC) + + GetLevelByClass(CLASS_TYPE_FACTOTUM, oPC) + + GetLevelByClass(CLASS_TYPE_HEALER, oPC) + + GetLevelByClass(CLASS_TYPE_RANGER, oPC) + + GetLevelByClass(CLASS_TYPE_SOULBORN, oPC) + + GetLevelByClass(CLASS_TYPE_TOTEMIST, oPC); + + AddJournalQuestEntry("JRNL_XPCHART", 1, oPC, FALSE, FALSE, FALSE); + AddJournalQuestEntry("JRNL_LA_BUYOFF", 1, oPC, FALSE, FALSE, FALSE); + AddJournalQuestEntry("JRNL_PRC8", 1, oPC, FALSE, FALSE, FALSE); + + Randomize(); + + //Examine_DisablePanels(oPC); + + //GNW_ShowMenuButton(oPC); + + if (GetIsPC(oPC)) + { + //SQLocalsUUID_SetInt(oPC,"OverallQuest",132); + + SQLocals_SetInt(GetModule(),"ClientEnter",1); + + DelayCommand(1.0f,SQLocals_SetInt(GetModule(),"ClientEnter",0)); + + if (GetLocalInt(GetModule(),"ModuleStart") == 0) + SetupModule(); + + if (GetLocalInt(GetModule(),"DynamicMerchant") == 0) + { + SetupDynamicMerchant(); + SetLocalInt(GetModule(),"DynamicMerchant",1); + SQLocalsUUID_SetInt(oPC,"DynamicMerchant",1); + } + else + { + if (GetLocalInt(oPC,"DynamicMerchant") == 0) + { + AddToDynamicMerchant(); + SetLocalInt(oPC,"DynamicMerchant",1); + } + } + if (GetLocalInt(oPC,"ModStart") == 0) + { + SetLocalInt(oPC,"ModStart",1); + SQLocalsUUID_SetInt(oPC,"Entering",1); + + if (iAnimal >= 1) + { + oAnimal = GetObjectByTag("en3_animal"); + AdjustReputation(oPC,oAnimal,30); + } + if (GetGoodEvilValue(oPC) < 40) //:: Probably need this after fixing evil path. + { + object oGood; + oGood = GetObjectByTag("en3_good"); + AdjustReputation(oPC,oGood,-100); + } + if (GetGoodEvilValue(oPC) > 60) + { + object oGood; + oGood = GetObjectByTag("en3_good"); + AdjustReputation(oPC,oGood,50); + } + + iLevel = GetHitDice(oPC); + SQLocalsUUID_SetInt(oPC,"PCEnterLevel",iLevel); + + SendMessageToPC(oPC,"Starting New Campaign..."); + + SetLocalString(oPC,"Respawn","EN4_Respawn"); + + if (GetXP(oPC) == 0) + { + SQLocalsUUID_SetInt(oPC,"ModRank",1); + SetupCharacter(oPC); + SendMessageToPC(oPC,"Character is eligible for Campaign Ranking."); + } + else + { + CheckImport(oPC); + } + } + else + { + SendMessageToPC(oPC,"Continuing Old Campaign..."); + + if (SQLocalsUUID_GetInt(oPC,"ModRank") == 1) + SendMessageToPC(oPC,"Character is eligible for Campaign Ranking."); + else + SendMessageToPC(oPC,"Character is ineligible for Campaign Ranking."); + + if (SQLocalsUUID_GetInt(oPC,"SpecialPowers") > 0) + CreateSpecialPowers(oPC); + + if (SQLocalsUUID_GetInt(oPC,"EvilPath") > 0) + CreateEvilPowers(oPC); + + object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC); + + if (!GetIsObjectValid(oItem) && GetLevelByClass(CLASS_TYPE_MONK,oPC) > 0) + oItem = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC); + + if (GetIsObjectValid(oItem)) + GetSpecialWeaponBonus(oPC,oItem); + + oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC); + if (GetIsObjectValid(oItem)) + GetSpecialWeaponBonus(oPC,oItem); + } + } + + if (SQLocalsUUID_GetInt(GetModule(),"ModStarted") == 0) + { + SetupRandomNPCs(); + SQLocalsUUID_SetInt(GetModule(),"ModStarted",1); + } +} + + +void GetItems(object oPC) +{ + object oObject = GetFirstItemInInventory(oPC); + + int iFlag = 0; + int iIndex = 0; + + while (iFlag == 0 && GetIsObjectValid(oObject)) + { + iIndex++; + SendMessageToPC(oPC,"Item = " + GetTag(oObject)); + oObject = GetNextItemInInventory(oPC); + if (iIndex > 100) + iFlag = 1; + } +} + +void SetupCharacter(object oPC) +{ + object oItem; + string sMessage; + + if (GetGold(oPC) < 200) + GiveGoldToCreature(oPC, 200 - GetGold(oPC)); + + RemoveAllItems(oPC); + + oItem = GetItemInSlot(INVENTORY_SLOT_CHEST,oPC); + + AssignCommand(oPC,ActionUnequipItem(oItem)); + + DestroyObject(oItem); + + oItem = CreateItemOnObject("Tunic",oPC); + + AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)); + + CheckSpecialRace(oPC); + + string sCampaign = "Endless Nights IV"; + + if (GetCampaignInt(sCampaign,"MP") == 1) + sCampaign = "MP_Endless Nights IV"; + + if (GetCampaignInt(sCampaign,"HardcoreSettings") == 1) + { + SQLocalsUUID_SetInt(oPC,"PCHardcore",1); + DelayCommand(0.3,SendMessageToPC(oPC,"You have been set to Hardcore mode.")); + } + + if (GetCampaignInt(sCampaign,"HardcoreSettings") == 2) + { + SQLocalsUUID_SetInt(oPC,"PCHardCorePNP",1); + DelayCommand(0.3,SendMessageToPC(oPC,"You have been set to PnP Hardcore mode.")); + } + + if (GetCampaignInt(sCampaign,"HardcoreSettings") == 3) + { + SQLocalsUUID_SetInt(oPC,"PCHardCoreSpecial",1); + DelayCommand(0.3,SendMessageToPC(oPC,"You have been set to Special experience/lives mode.")); + } + + if (SQLocalsUUID_GetInt(oPC,"PCDeaths") == 0) + { + InitialEvent(oPC); + } + else + { + if (SQLocalsUUID_GetInt(oPC,"PCHardCorePNP") == 0 && SQLocalsUUID_GetInt(oPC,"PCHardcore") == 0) + { + sMessage = "You have been given " + IntToString(SQLocalsUUID_GetInt(oPC,"PCDeaths")) + " deaths to compensate for your choice of races."; + DelayCommand(0.4,SendMessageToPC(oPC,sMessage)); + } + } + + if (SQLocalsUUID_GetInt(oPC,"Monstrous") == 0 || SQLocalsUUID_GetInt(oPC,"EvilPath") > 0) + { + SetLocalString(oPC,"Respawn","EN4_Respawn"); + } + else + { + if (SQLocalsUUID_GetInt(oPC,"Monstrous") > 0 && SQLocalsUUID_GetInt(oPC,"EvilPath") == 0) + SetLocalString(oPC,"Respawn","EN4_Monster"); + else + SetLocalString(oPC,"Respawn","EN4_MERespawn"); + } +} + +void RemoveAllItems(object oPC) +{ + int iFlag = 0; + int iIndex = 0; + + object oObject = GetFirstItemInInventory(oPC); + + while (iFlag == 0 && GetIsObjectValid(oObject)) + { + iIndex++; + + if (ValidStartingItem(GetTag(oObject)) == FALSE) + { + //SendMessageToPC(oPC,"Destroying " + GetTag(oObject)); + DestroyObject(oObject); + } + + oObject = GetNextItemInInventory(oPC); + + if (iIndex > 100) + iFlag = 1; + } +} + +int ValidStartingItem(string sTag) +{ + int iFlag; + + iFlag = FALSE; + + if (sTag == "NW_IT_MPOTION001") + iFlag = TRUE; + + return iFlag; +} + +void InitialEvent(object oPC) +{ + int iRandom; + int iRandom2; + int iArmor; + int iAdjust; + int iMod; + int iEvent; + string sMessage; + string sRace; + string sTag; + string sType; + itemproperty ip; + object oItem; + int iQuestPoints; + + string sCampaign = "Endless Nights IV"; + + if (GetCampaignInt(sCampaign,"MP") == 1) + sCampaign = "MP_Endless Nights IV"; + + iEvent = GetCampaignInt(sCampaign,"E4InitialEvent"); + + if (iEvent == 1 || iEvent == 2) + { + if (iEvent == 1) + iRandom = Random(100) + 1; + else + iRandom = Random(42) + 1; + + //iRandom = 41; + //SendMessageToPC(oPC,"Random = " + IntToString(iRandom)); + iMod = 0; + + if (iRandom < 2) //Found Magical Item + { + sMessage = "Tending your farm one day, you were suprised to find a myserious magical item beneath the corn stalks. Gathering up what gold you could, you left home in hopes of becoming a famous adventurer..."; + GetMagicItem(oPC,TRUE,TRUE); + } + else if (iRandom < 3) //Enchanted + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sRace = GetSubRace(oPC); + + if (sRace == "") + sRace = GetRace(oPC); + + sRace = "Enchanted " + sRace; + + SetSubRace(oPC, sRace); + + //sMessage = CreatePlayerSkin(oPC); //::: Use PRC skin instead. + + sMessage = "A mysterious old man visited your farm one day and granted you enhanced powers. This experience urged you to leave the farm and seek adventure in the lands."; + + iMod=1; + + SQLocalsUUID_SetInt(oPC,"SpecialPowers",1); + + CreateSpecialPowers(oPC); + + } + else if (iRandom < 4) // Undead + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + + sMessage = "You have little recollection of your death, but you well remember the beginning of your undeath. Whatever vile spells the necromancer cast went awry, though, leading to his death and to your conciousness remaining inside of your undead body."; + + sRace = GetSubRace(oPC); + + if (sRace == "") + sRace = GetRace(oPC); + + sRace = "Undead " + sRace; + + SetSubRace(oPC, sRace); + + //CreateUndeadPC(oPC); //:: Use PRC template instead. + + ApplyTemplateToObject(TEMPLATE_NECROPOLITAN, oPC); + + iMod = 1; + + SQLocalsUUID_SetInt(oPC,"SpecialPowers",2); + + CreateSpecialPowers(oPC); + } + else if (iRandom < 6) + { + GiveGoldToCreature(oPC,1800); + + sMessage = "Exploring the cavernous area near your farmhouse, you found a chest filled with treasure. Using these riches you decided to set out into the world and seek adventure."; + } + else if (iRandom < 7) + { + IE_MagicalRing(oPC); + + sMessage = "Exploring the cavernous area near your farmhouse, you found a strange magical ring. You decided to use its powers to seek adventure in the world."; + } + else if (iRandom < 8) + { + GetWeaponType(oPC); + + sTag = "en3_" + GetWeaponTag(oPC) + "1"; + + SendMessageToPC(oPC,sTag); + + oItem=CreateItemOnObject(sTag,oPC); + + ip=ItemPropertyEnhancementBonus(1); + + IPSafeAddItemProperty(oItem,ip); + + sMessage = "Your father was an adventurer in his youth and gave you an " + GetName(oItem) + " before you set out in the world to find your own fame."; + } + else if (iRandom < 9) + { + iArmor = ENGetArmorType(oPC); + + sTag = GetArmorTag(iArmor) + "1"; + + SendMessageToPC(oPC,sTag); + + oItem=CreateItemOnObject(sTag,oPC); + + ip=ItemPropertyACBonus(1); + + IPSafeAddItemProperty(oItem,ip); + + sMessage = "Your father was an adventurer in his youth and gave you an " + GetName(oItem) + " before you set out in the world to find your own fame."; + } + else if (iRandom < 10) + { + iAdjust = Random(20)+1; + DelayCommand(0.5f,EquipMob(oPC,1,iAdjust)); + + if (iAdjust < 5) + sMessage = "Your father was a minor adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else if (iAdjust <11) + sMessage = "Your father was a renown adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else if (iAdjust <16) + sMessage = "Your father was a very renown adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else + sMessage = "Your father was a famous adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + } + else if (iRandom < 11) + { + if (GetLevelByClass(CLASS_TYPE_CLERIC, oPC) >= 1 || GetLevelByClass(CLASS_TYPE_DRUID, oPC) >= 1) + GetMagicItem(oPC,TRUE,FALSE,2); + + else if (GetLevelByClass(CLASS_TYPE_SORCERER, oPC) >= 1 || GetLevelByClass(CLASS_TYPE_WIZARD, oPC) >= 1 || GetLevelByClass(CLASS_TYPE_MONK, oPC) >= 1) + GetMagicItem(oPC,TRUE,FALSE,3); + + else + GetMagicItem(oPC,TRUE,FALSE,1); + + sMessage = "Your father was a famous adventurer in his youth and upon his death passed you a powerful magical item. Armed with this item and resolve you decided to make a name for yourself in the world."; + } + else if (iRandom < 12) + { + CreateRandomItem(oPC); + + if (GetLevelByClass(CLASS_TYPE_ROGUE, oPC) >= 1) + sMessage = "After you left home you traveled to a strange city and found yourself in a shop of magical items. Seeing your oppurtunity, you grabbed one and ran but the shopkeeper alerted the guards. Fast on your feet, you escaped the city and kept running..."; + + else + sMessage = "Having left home to find adventure, you spotted an old man being attacked by a bandit. Rushing to his aid, you ran the bandit off and, in thanks, the old man gave you a magical item."; + } + else if (iRandom < 13) + { + SQLocalsUUID_SetInt(oPC,"Lucky",1); + + sMessage = "All of your life you have had the benefit of great luck. If you gambled, you invariably won. If danger was near, you invariably survived. You decided to go out into the world to make a name for yourself armed with the knowledge that your luck would protect you."; + } + else if (iRandom < 14) + { + MakeStatue(oPC); + sMessage = "On your father's deathbed he gave you a statue that would summon forth a companion to protect you in your adventures."; + } + else if (iRandom < 15) + { + GetArtifact(oPC); + iMod = Random(2)+2; + sMessage = "Exploring the caves outside your home you discovered an artifact of immense power. You decided to use this item to seek out fame and fortunes as an adventurer."; + } + else if (iRandom < 16) // Fiendish/Celestial + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + + sRace = GetSubRace(oPC); + + if (sRace == "") + sRace = GetRace(oPC); + + int iGoodEvil; + + iGoodEvil = GetGoodEvilValue(oPC); + + if (iGoodEvil < 40) + { + sMessage = "Your father was a demon from the deepest layers of the abyss. This parentage has gifted you with immense power in which you now use to make your mark in the world."; + ApplyTemplateToObject(TEMPLATE_HALF_FIEND, oPC); + sRace = "Fiendish " + sRace; + } + else + { + sMessage = "Your father was an angel who fell in love with your mother. This parentage has gifted you with immense power in which you now use to make your mark in the world."; + ApplyTemplateToObject(TEMPLATE_HALF_CELESTIAL, oPC); + sRace = "Celestial " + sRace; + } + + SetSubRace(oPC, sRace); + + //CreateGodlingPC(oPC); //:: Use PRC templates instead. + + SQLocalsUUID_SetInt(oPC,"SpecialPowers",3); + + CreateSpecialPowers(oPC); + + iMod = 1; + } + else if (iRandom < 17) + { + sMessage = "Tending your farm one day, you were suprised to find a myserious magical item beneath the corn stalks. Gathering up what gold you could, you left home in hopes of becoming a famous adventurer..."; + GetMagicItem(oPC,TRUE,TRUE); + } + else if (iRandom < 18) + { + iAdjust = Random(20)+1; + + DelayCommand(0.5f,EquipMob(oPC,1,iAdjust)); + + if (iAdjust < 5) + sMessage = "Your father was a minor adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else if (iAdjust <11) + sMessage = "Your father was a renown adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else if (iAdjust <16) + sMessage = "Your father was a very renown adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + + else + sMessage = "Your father was a famous adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + } + else if (iRandom < 19) + { + DelayCommand(0.5f,EquipMob(oPC,1,40)); + sMessage = "Your father was an extremely famous adventurer in his youth and made sure you were propertly equipped before you set out in the world to find your own fame."; + } + else if (iRandom < 20) + { + ItemOfPower(oPC); + sMessage = "Your father was an exiled king and gave you a great item of power before you went out to seek your fame."; + } + else if (iRandom < 21) + { + sMessage = "Tending your farm one day, you were suprised to find a myserious magical item beneath the corn stalks. Gathering up what gold you could, you left home in hopes of becoming a famous adventurer..."; + GetMagicItem(oPC,TRUE,TRUE); + } + else if (iRandom < 22) + { + SQLocalsUUID_SetInt(oPC,"PCXPBonus",25); + SQLocalsUUID_SetInt(oPC,"Unlucky",1); + + sMessage = "You have always been very unlucky and, deep in your heart, you know you will die an early death. You have, however, learned to adapt quickly."; + } + else if (iRandom < 24) + { + sMessage = "On your way to Hightop City, you spotted a small cave. Exploring, you found a minor magic item."; + GetMinorMagicItem(oPC); + } + else if (iRandom < 25) + { + IE_MagicalRing(oPC); + sMessage = "Exploring the cavernous area near your farmhouse, you found a strange magical ring. You decided to use its powers to seek adventure in the world."; + } + else if (iRandom < 26) + { + iQuestPoints = Random(40)+11; + //iQuestPoints = 24; + SQLocalsUUID_SetInt(oPC,"QuestPoints",iQuestPoints); + sMessage = "Your father is legendary. You start the game with " + IntToString(iQuestPoints) + " quest points."; + } + else if (iRandom < 27) + { + SetMaxHenchmen(5); + SetLocalString(GetModule(), "FriendlySpirit", GetName(oPC)); + SQLocalsUUID_SetInt(oPC,"Spirit",1); + sMessage = "When you were young you befriended a friendly spirit who has become your constant companion."; + } + else if (iRandom < 28) + { + GiveGoldToCreature(oPC,49800); + sMessage = "You come from an extremely wealthy family. On the day of your father's death, you took your inheretance and went out into the world."; + } + else if (iRandom < 29) + { + if (GetAbilityScore(oPC,ABILITY_CHARISMA)>9) + { + SQLocalsUUID_SetInt(oPC,"Charming",1); + sMessage = "You have an inherent spark that causes people to like you. As such, you gather fame easier."; + } + else + { + SQLocalsUUID_SetInt(oPC,"Lucky",1); + sMessage = "All of your life you have had the benefit of great luck. If you gambled, you invariably won. If danger was near, you invariably survived. You decided to go out into the world to make a name for yourself armed with the knowledge that your luck would protect you."; + } + } + else if (iRandom < 30) + { + iRandom2 = Random(4)+1; + + switch (iRandom2) + { + case 1: SQLocalsUUID_SetInt(oPC,"WeaponBonus",1); sType = "Fire"; break; + case 2: SQLocalsUUID_SetInt(oPC,"WeaponBonus",2); sType = "Lightning"; break; + case 3: SQLocalsUUID_SetInt(oPC,"WeaponBonus",3); sType = "Cold"; break; + case 4: SQLocalsUUID_SetInt(oPC,"WeaponBonus",4); sType = "Acid"; break; + } + SQLocalsUUID_SetInt(oPC, "WeaponBonus", 1); + sMessage = "You were born with amazing powers to control " + sType + " and have learned to enchant items to do more damage."; + } + else if (iRandom < 31) + { + SQLocalsUUID_SetInt(oPC, "Cursed", 1); + GetMagicItem(oPC); + sMessage = "When you were younger, you stole a magic item from a witch. In return, she cursed you and you have found life has been difficult ever since."; + } + else if (iRandom < 32) + { + iRandom2 = Random(3)+1; + + SQLocalsUUID_SetInt(oPC,"Enemy",iRandom2); + + switch (iRandom2) + { + case 1: sMessage = "A rich merchant gave you a magic item to cross the Red Wizards. You did so, but made a powerful enemy and have fled here hoping you will be safe from them."; + break; + case 2: sMessage = "You were instrumental in catching a theif and received a magic item as a reward, but the Thieves' Guild put a bounty on your head. You fled here hoping you will be safe from them."; + break; + case 3: sMessage = "You cheated a powerful merchant out of a magic item and he put a bounty on your head. You fled here hoping you will be safe from them."; + break; + } + + if (Random(3)==0) + GetRareItem(oPC); + else + GetMagicItem(oPC); + } + else if (iRandom < 33) + { + GetEN2Weapon(oPC,oPC); + + sMessage = "Your father is a hero, once saving the village of Nirra Hamlett. When you set out into the world he gave you a magical weapon from his days of adventuring."; + } + else if (iRandom < 34) + { + iRandom2 = (Random(4)+1) * 5; + SQLocalsUUID_SetInt(oPC,"PCXPBonus",iRandom2); + sMessage = "You are have always been a very quick learner and pick up new skills easily."; + } + else if (iRandom < 35) + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sRace = GetSubRace(oPC); + + if (sRace == "") + sRace = GetRace(oPC); + + sRace = "Shade " + sRace; + + sMessage = "You were born into shadow and from the shadows you gain power. You now use to make your mark in the world."; + + SetSubRace(oPC,sRace); + + //CreateGodlingPC(oPC); + + SQLocalsUUID_SetInt(oPC,"SpecialPowers",4); + + CreateSpecialPowers(oPC); + + iMod=1; + } + else if (iRandom < 36) + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sMessage = "You have always had great strength. You now arrive in hightop to make your mark in the world."; + SQLocalsUUID_SetInt(oPC,"SpecialPowers",5); + CreateSpecialPowers(oPC); + } + else if (iRandom < 37) + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sMessage = "You have always had been very hardy. You now arrive in hightop to make your mark in the world."; + SQLocalsUUID_SetInt(oPC,"SpecialPowers",6); + CreateSpecialPowers(oPC); + } + else if (iRandom < 38) + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sMessage = "You have always had been very nimble. You now arrive in hightop to make your mark in the world."; + SQLocalsUUID_SetInt(oPC,"SpecialPowers",7); + CreateSpecialPowers(oPC); + } + else if (iRandom < 39) + { + sMessage = "Upon your father's death, you inherited a rare item from him and set out in the world to seek fame and fortune."; + GetRareItem(oPC); + } + else if (iRandom < 40) + { + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sMessage = "You have always had an affinity with magic. This affinity helps you manipulate and resist it."; + SQLocalsUUID_SetInt(oPC,"SpecialPowers",8); + CreateSpecialPowers(oPC); + } + else if (iRandom < 41) + { + sMessage = "Your father was a powerful sorcerer and upon his death you inherited a rare artifact that imparted some of that power to you."; + GetInfiniteSpells(oPC); + } + else if (iRandom < 42) + { + //SuperPowers + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",1); + sMessage = "You are descended from an ancient race who wield special powers far beyond those of mortal man."; + iRandom2 = Random(10)+1; + //iRandom2 = 7; + + switch (iRandom2) + { + case 1: sMessage = sMessage + " You were born with the power to heal from wounds almost instantly."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",1); + break; + case 2: sMessage = sMessage + " You were born with super speed and dexterity."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",2); + break; + case 3: sMessage = sMessage + " You were born in a quasi-ethereal state which leaves you imperveous to physical damage."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",3); + break; + case 4: sMessage = sMessage + " You were born with complete immunity to magical spells."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",4); + break; + case 5: sMessage = sMessage + " You were born with great control over fire."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",5); + SQLocalsUUID_SetInt(oPC,"WeaponBonus",1); + break; + case 6: sMessage = sMessage + " You were born with super strength beyond that of mortal man."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",6); + break; + case 7: sMessage = sMessage + " You were born with the ability to assume multiple forms."; + oItem=CreateItemOnObject("en4_forms",oPC); + SetStolenFlag(oItem,TRUE); + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",0); + break; + case 8: sMessage = sMessage + " You were born with the knowledge of an ancestor who was a powerful wizard."; + oItem=CreateItemOnObject("en4_spells",oPC); + SetStolenFlag(oItem,TRUE); + SQLocalsUUID_SetInt(oPC,"HasCustomSkin",0); + break; + case 9: sMessage = sMessage + " You were born destined to become a hero of epic proportions. This destiny grants you speed, immunity to fear, death, and fatal blows, and great control over weapons."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",7); + break; + case 10: sMessage = sMessage + " You were born with vampiric powers which are channeled through your weapon."; + SQLocalsUUID_SetInt(oPC,"SuperPowers",8); + break; + } + + CreateSuperPowers(oPC); + + } + else if (iRandom < 43) + { + if (Random(2)==0) + { + sMessage = "You were met on the road by a stange gypsy who gave you a playing card and told you that great power could come from its use, as could great ruin, and its use is limited to once per day. You are unsure of whether or not you want to use the card."; + oItem=CreateItemOnObject("en4_card",oPC); + SetStolenFlag(oItem,TRUE); + } else { + if (Random(2) == 0) + { + sMessage = "Your father was a wizard who left you a magical helm containing great powers of domination upon his death."; + oItem = CreateItemOnObject("en4_eyes",oPC); + SetStolenFlag(oItem,TRUE); + } else { + if (GetAbilityScore(oPC,ABILITY_CHARISMA)>9) + { + SQLocalsUUID_SetInt(oPC,"Charming",1); + sMessage = "You have an inherent spark that causes people to like you. As such, you gather fame easier."; + } else { + SQLocalsUUID_SetInt(oPC,"Lucky",1); + sMessage = "All of your life you have had the benefit of great luck. If you gambled, you invariably won. If danger was near, you invariably survived. You decided to go out into the world to make a name for yourself armed with the knowledge that your luck would protect you."; + } + } + } + } + else + sMessage = "You arrive in Hightop City ready to make a name for yourself."; + } else { + sMessage = "After a long journey, you arrive in Hightop City ready to make a name for yourself."; + } + +DelayCommand(0.5,SendMessageToPC(oPC,sMessage)); +if (iMod>0) + SQLocalsUUID_SetInt(oPC,"Adjust",iMod); + +} + +string GetRace(object oPC) +{ + string sRace = GetSubRace(oPC); + + if (sRace == "") + { + sRace = GetStringByStrRef(StringToInt(Get2DAString("racialtypes", "Name", GetRacialType(oPC)))); + } + + return sRace; +} + +void SetupDynamicMerchant() +{ +int iCount; +int iRandom; +object oStore; + +oStore = GetObjectByTag("HTC_Dynamic"); + +iRandom=Random(3)+1; +iCount = 0; +while (iCount <= iRandom) + { + GetMagicItem(oStore,TRUE,TRUE,5); + iCount++; + } + +iRandom=Random(5)+6; +iCount = 0; +while (iCount <= iRandom) + { + GetMagicItem(oStore,TRUE,TRUE); + iCount++; + } + +iRandom=Random(3)+3; +iCount = 0; +while (iCount <= iRandom) + { + GetMiscMagic(oStore); + iCount++; + } + +iRandom=Random(4)+1; +iCount = 0; +while (iCount <= iRandom) + { + GetMinorMagicItem(oStore); + iCount++; + } + +iRandom=Random(8)+1; +iCount = 0; +while (iCount <= iRandom) + { + CreateRandomItem(oStore); + iCount++; + } + +iRandom=Random(3); +iCount = 0; +while (iCount <= iRandom) + { + GetRareItem(oStore); + iCount++; + } + +GetNegativeItem(oStore); + +} + +void AddToDynamicMerchant() +{ +object oStore; + +oStore = GetObjectByTag("NH1_Dynamic"); + +GetMagicItem(oStore,TRUE,TRUE,5); +GetMagicItem(oStore,TRUE,TRUE,5); +GetMagicItem(oStore,TRUE,TRUE,5); +GetMagicItem(oStore,TRUE,TRUE,5); +} + +void SetupModule() +{ +object oChest; +int iRandom; +int iAI; + +SetLocalInt(GetModule(),"ModuleStart",1); +SetLocalInt(GetModule(),MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR,FALSE); +SetMaxHenchmen(4); + +string sCampaign = "Endless Nights IV"; +if (GetCampaignInt(sCampaign,"MP") == 1) + sCampaign = "MP_Endless Nights IV"; +iAI = GetCampaignInt(sCampaign,"MP"); +SQLocals_SetInt(GetModule(),"NoAI",iAI); + +oChest = GetObjectByTag("EN4_SpecChest" + IntToString(Random(2)+1)); +SQLocals_SetInt(oChest,"Weapon",1); + +iRandom = Random(4); +if (iRandom==0) + { + iRandom = Random(4)+1; + SQLocals_SetInt(GetModule(),"HTC_SpecialMerchant",iRandom); + } + +WriteTimestampedLogEntry("*** Endless Night IV Loaded ***"); +} + +void CheckSpecialRace(object oPC) +{ + int iDeaths; + int iMonstrous; + int iRace; + string sRace; + + iDeaths = 0; + iMonstrous = 0; + iRace = GetRacialType(oPC); + sRace = GetRace(oPC); + + //SendMessageToPC(oPC,"Race = " + sRace); + //SendMessageToPC(oPC,"Sub-Race = " + GetSubRace(oPC)); + + if (iRace == RACIAL_TYPE_AASIMAR) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ABOM_YUAN) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_AIR_GEN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ARANEA) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_ARC_DWARF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ARKAMOI) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_ASHERATI) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_AVARIEL) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_AZER) {iDeaths = 3; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_AZURIN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_BARIAUR) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_BHUKA) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_BLUE_GOBLIN) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_BRALANI) {iDeaths = 3; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_BROWNIE) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_BUGBEAR) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_BUOMMANS) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_CATFOLK) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_CENTAUR) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_CHANGELING) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_CHITINE) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_CRUCIAN) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_DEEP_GNOME) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_DEEP_HALFLING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_DOPPELGANGER) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_DRIDER) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_DROMITE) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_DROW_FEMALE) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_DROW_MALE) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_DUERGAR) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_DUSKLING) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_EARTH_GEN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ELAN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_EXTAMINAAR) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_FERAL_GARGUN) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_FEYRI) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FIRE_GEN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FIREBLOOD_DWARF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FLIND) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_FOR_GNOME) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FORESTLORD_ELF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FROST_FOLK) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_FROSTBLOOD_ORC) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_GHOSTWISE_HALFLING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GITHYANKI) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_GITHZERAI) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GLIMMERSKIN_HALFING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GLOURA) {iDeaths = 3; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GNOLL) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_GOBLIN) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_GOLD_DWARF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GOLIATH) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_GRAYORC) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_HADOZEE) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_HADRIMOI) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_HAGSPAWN) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_HALFDROW) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_HALFOGRE) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_HOBGOBLIN) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_HOUND_ARCHON) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_HYBSIL) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ILLITHID) {iDeaths = 3; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_IMASKARI) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_KALASHTAR) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_KARSITE) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_KHAASTA) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_KILLOREN) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_KOBOLD) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_KRINTH) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_LASHEMOI) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_LIZARDFOLK) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MAENADS) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_MARRULURK) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MARRUSAULT) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MARRUTACT) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MEPHLING_AIR) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_MEPHLING_EARTH) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_MEPHLING_FIRE) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_MEPHLING_WATER) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_MINOTAUR) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MONGRELFOLK) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_MUCKDWELLER) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_NATHRI) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_NAZTHARUNE_RAKSHASA) {iDeaths = 3; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_NEANDERTHAL) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_NERAPHIM) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_OGRE) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_ORC) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_OROG) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_PH_HALFGIANT) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_PIXIE) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_POISON_DUSK) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_PURE_YUAN) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_RAKSHASA) {iDeaths = 3; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_REDSPAWN_ARCANISS) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_RETH_DEKALA) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_RILKAN) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ROCK_GNOME) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SHADOWSWYFT) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SHARAKIM) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SHIFTER) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SILVERBROW_HUMAN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SKARN) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SKULK) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_SNOW_ELF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SPIKER) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_SPIRETOPDRAGON) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SPIRIT_FOLK) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_STONECHILD) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_STONEHUNTER_GNOME) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_STRONGHEART_HALFLING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SUN_ELF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_SUNSCORCH_HOBGOBLIN) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TAER) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TALLFELLOW_HALFLING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_TANARUKK) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TASLOI) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TIEFLING) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_TROGLODYTE) {iDeaths = 0; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TROLL) {iDeaths = 3; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_TUNDRA_HALFLING) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_TURLEMOI) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_ULDRA) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_UNDERFOLK) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_URDINNIR) {iDeaths = 1; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_VARAG) {iDeaths = 2; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_VILETOOTH_LIZARDFOLK) {iDeaths = 1; iMonstrous = 1;} + else if (iRace == RACIAL_TYPE_VOLODNI) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WARFORGED) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WARFORGED_CHARGER) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WATER_GEN) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WEMIC) {iDeaths = 3; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WHISPER_GNOME) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WILD_DWARF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WILD_ELF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WILDREN) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_WOOD_ELF) {iDeaths = 0; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_XEPH) {iDeaths = 2; iMonstrous = 0;} + else if (iRace == RACIAL_TYPE_ZAKYA_RAKSHASA) {iDeaths = 3; iMonstrous = 0;} + + +// if (iRace == RACIAL_TYPE_SHADOWSWYFT) {iDeaths = 2;} + +// else if (iRace == RACIAL_TYPE_NERAPHIM) {iDeaths = 1; iMonstrous = 1;} + +// else if (iRace == RACIAL_TYPE_TROLL) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_HALFOGRE) + // { + // iDeaths = 2; + // } +// else if (iRace == RACIAL_TYPE_AZER) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_PIXIE) + // { + // iDeaths = 2; + // } +// else if (iRace == RACIAL_TYPE_ILLITHID) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_RAKSHASA) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_GITHZERAI) + // { + // iDeaths = 2; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_GITHYANKI) + // { + // iDeaths = 2; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_PURE_YUAN) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_LIZARDFOLK) + // { + // iDeaths = 2; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_MINOTAUR) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_BUGBEAR) + // { + // iDeaths = 1; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_OGRE) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_TIEFLING) + // { + // iDeaths = 1; + // } +// else if (iRace == RACIAL_TYPE_TANARUKK) + // { + // iDeaths = 3; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_FEYRI) + // { + // iDeaths = 3; + // } +// else if (iRace == RACIAL_TYPE_AASIMAR) + // { + // iDeaths = 1; + // } +// else if (iRace == RACIAL_TYPE_OROG) + // { + // iDeaths = 2; + // iMonstrous = 1; + // } +// else if (iRace == RACIAL_TYPE_DEEP_GNOME) + // { + // iDeaths = 2; + // } +// else if (iRace == RACIAL_TYPE_DROW_FEMALE) + // { + // iDeaths = 2; + // } +// else if (iRace == RACIAL_TYPE_WILD_DWARF) + // { + // iDeaths = 1; + // } +// else if (iRace == RACIAL_TYPE_URDINNIR) + // { + // iDeaths = 2; + // } +// else if (iRace == RACIAL_TYPE_DUERGAR) + // { + // iDeaths = 1; + // } +// else if (iRace == RACIAL_TYPE_ARC_DWARF) + // { + // iDeaths = 2; + // } + + if (iMonstrous == 1) + { + object oGood; + oGood = GetObjectByTag("en3_good"); + AdjustReputation(oPC,oGood,-100); + + object oDefender; + oDefender = GetObjectByTag("en4_cityguard0_1"); + AdjustReputation(oPC,oDefender,-100); + + object oEvil; + oEvil = GetObjectByTag("en4_evil"); + AdjustReputation(oPC,oEvil,50); + + if (GetGoodEvilValue(oPC) > 60) + { + SQLocalsUUID_SetInt(oPC,"Monstrous",2); + } + else + { + SQLocalsUUID_SetInt(oPC,"Monstrous",1); + } + + object oSpawnPoint; + + oSpawnPoint = GetObjectByTag("EN4_MERespawn"); + + DelayCommand(0.1f,AssignCommand(oPC,JumpToLocation(GetLocation(oSpawnPoint)))); + DelayCommand(1.0f,SendMessageToPC(oPC,"Your monstrous appearence renders guards, defenders, and citizens aggressive to you.")); + } + + if (iDeaths > 0) + { + SQLocalsUUID_SetInt(oPC,"PCDeaths",iDeaths); + SQLocalsUUID_SetInt(oPC,"PCLevelMod",iDeaths); + } +} + +void SetupRandomNPCs() +{ +string sLocation; +string sNPC; +string sNPCLoc; +int iRandomSpot; +int iRandom; +object oNPC; +location lLoc; + +if (Random(2)==0) + { + if (Random(2) == 0) + sLocation = "RP1"; + else + sLocation = "WG1"; + + + iRandom = Random(2)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4m1"; break; + case 2: sNPC = "en4_en4npc1"; break; + } + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } + +if (Random(2)==0) + { + sLocation = "SP1"; + + iRandom = Random(3)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4m2"; break; + case 2: sNPC = "en4_en4npc2"; break; + case 3: sNPC = "en4_en4f1"; break; + } + + if (Random(2) == 0) + sNPC = "en4_en4m2"; + else + sNPC = "en4_en4npc2"; + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } + +if (Random(2)==0) + { + sLocation = "RW1"; + + + iRandom = Random(2)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4m3"; break; + case 2: sNPC = "en4_en4npc3"; break; + } + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } + +if (Random(2)==0) + { + sLocation = "DW1"; + + iRandom = Random(3)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4m4"; break; + case 2: sNPC = "en4_en4npc4"; break; + case 3: sNPC = "en4_en4f2"; break; + } + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } + +if (Random(2)==0) + { + sLocation = "SP1"; + + iRandom = Random(3)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4m5"; break; + case 2: sNPC = "en4_en4npc5"; break; + case 3: sNPC = "en3_Ronus"; break; + } + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } + +if (Random(2)==0) + { + sLocation = "IP1"; + + iRandom = Random(2)+1; + switch (iRandom) + { + case 1: sNPC = "en4_en4f3"; break; + case 2: sNPC = "en4_en4npc6"; break; + } + + iRandomSpot = Random(4)+1; + sNPCLoc = sLocation + "_QuestGiver" + IntToString(iRandomSpot); + lLoc = RandomLoc(GetObjectByTag(sNPCLoc)); + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, lLoc); + if (!GetIsObjectValid(oNPC)) + oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPC, GetLocation(GetObjectByTag(sNPCLoc))); + } +} + +void CheckImport(object oPC) +{ +int iXP; +int iGold; +int iXPCheck; +int iGoldCheck; +int iOverallQuest; +int iHardcore; +int iHardcorePnP; +int iQuestPoints; +int iDeaths; +int iModRank; +int iMonstrous; +int iPCXPBonus; +int iPCLevelMod; +int iSpecialPowers; +int iSuperPowers; +int iSpirit; +int iLucky; +int iCharming; +int iWeaponBonus; +int iAdjust; +int iEnemy; +int iCursed; +int iPCEnterLevel; +int iEvilLevel; +int iEvilPowers; +int iEvilQuest; +int iHardcoreSpecial; +int iGuild; +int iGuildQuests; + +iXP = GetXP(oPC); +iGold = GetGold(oPC); + +iXPCheck = GetCampaignInt("Endless Nights IV","XP",oPC); +iGoldCheck = GetCampaignInt("Endless Nights IV","Gold",oPC); + +if (iXP == iXPCheck && iGold == iGoldCheck) + { + iOverallQuest = GetCampaignInt("Endless Nights IV","OverallQuest",oPC); + iHardcore = GetCampaignInt("Endless Nights IV","PCHardcore",oPC); + iHardcorePnP = GetCampaignInt("Endless Nights IV","PCHardCorePNP",oPC); + iHardcoreSpecial = GetCampaignInt("Endless Nights IV","PCHardCoreSpecial",oPC); + + iQuestPoints = GetCampaignInt("Endless Nights IV","QuestPoints",oPC); + iDeaths = GetCampaignInt("Endless Nights IV","PCDeaths",oPC); + iModRank = GetCampaignInt("Endless Nights IV","ModRank",oPC); + iMonstrous = GetCampaignInt("Endless Nights IV","Monstrous",oPC); + iPCXPBonus = GetCampaignInt("Endless Nights IV","PCXPBonus",oPC); + iPCLevelMod = GetCampaignInt("Endless Nights IV","PCLevelMod",oPC); + iEvilPowers = GetCampaignInt("Endless Nights IV","EvilPath",oPC); + iEvilLevel = GetCampaignInt("Endless Nights IV","EvilLevel",oPC); + iEvilQuest = GetCampaignInt("Endless Nights IV","EvilQuest",oPC); + + iSpecialPowers= GetCampaignInt("Endless Nights IV","SpecialPowers",oPC); + iSuperPowers= GetCampaignInt("Endless Nights IV","SuperPowers",oPC); + iSpirit= GetCampaignInt("Endless Nights IV","Spirit",oPC); + iLucky= GetCampaignInt("Endless Nights IV","Lucky",oPC); + iCharming= GetCampaignInt("Endless Nights IV","Charming",oPC); + iWeaponBonus= GetCampaignInt("Endless Nights IV","WeaponBonus",oPC); + iAdjust= GetCampaignInt("Endless Nights IV","Adjust",oPC); + iEnemy= GetCampaignInt("Endless Nights IV","Enemy",oPC); + iCursed= GetCampaignInt("Endless Nights IV","Cursed",oPC); + iPCEnterLevel = GetCampaignInt("Endless Nights IV","PCEnterLevel",oPC); + + iGuild= GetCampaignInt("Endless Nights IV","PCGuild",oPC); + iGuildQuests = GetCampaignInt("Endless Nights IV","GuildQuests",oPC); + + //Reset overall quest to the last major portion started + if (iOverallQuest <101) + iOverallQuest = 0; + else if (iOverallQuest <111) + iOverallQuest = 101; + else if (iOverallQuest <121) + iOverallQuest = 111; + else if (iOverallQuest <999) + iOverallQuest = 121; + + SQLocalsUUID_SetInt(oPC,"OverallQuest",iOverallQuest); + SQLocalsUUID_SetInt(oPC,"PCHardcore",iHardcore); + SQLocalsUUID_SetInt(oPC,"PCHardCorePNP",iHardcorePnP); + SQLocalsUUID_SetInt(oPC,"PCHardCoreSpecial",iHardcoreSpecial); + SQLocalsUUID_SetInt(oPC,"QuestPoints",iQuestPoints); + SQLocalsUUID_SetInt(oPC,"PCDeaths",iDeaths); + SQLocalsUUID_SetInt(oPC,"ModRank",iModRank); + SQLocalsUUID_SetInt(oPC,"Monstrous",iMonstrous); + SQLocalsUUID_SetInt(oPC,"PCXPBonus",iPCXPBonus); + SQLocalsUUID_SetInt(oPC,"PCLevelMod",iPCLevelMod); + + SQLocalsUUID_SetInt(oPC,"SpecialPowers",iSpecialPowers); + SQLocalsUUID_SetInt(oPC,"SuperPowers",iSuperPowers); + + SQLocalsUUID_SetInt(oPC,"Spirit",iSpirit); + SQLocalsUUID_SetInt(oPC,"Lucky",iLucky); + SQLocalsUUID_SetInt(oPC,"Charming",iCharming); + SQLocalsUUID_SetInt(oPC,"WeaponBonus",iWeaponBonus); + SQLocalsUUID_SetInt(oPC,"Adjust",iAdjust); + SQLocalsUUID_SetInt(oPC,"Enemy",iEnemy); + SQLocalsUUID_SetInt(oPC,"Cursed",iCursed); + SQLocalsUUID_SetInt(oPC,"EvilQuest",iEvilQuest); + SQLocalsUUID_SetInt(oPC,"EvilPath",iEvilPowers ); + SQLocalsUUID_SetInt(oPC,"EvilLevel",iEvilLevel); + + SQLocalsUUID_SetInt(oPC,"PCGuild",iGuild); + SQLocalsUUID_SetInt(oPC,"GuildQuests",iGuildQuests); + + if (iPCEnterLevel == 0) + iPCEnterLevel = 1; + SQLocalsUUID_SetInt(oPC,"PCEnterLevel",iPCEnterLevel); + + SQLocalsUUID_SetString(oPC,"QPWeaponTag",GetCampaignString("Endless Nights IV","QPWeaponTag",oPC)); + SQLocalsUUID_SetString(oPC,"QPTag",GetCampaignString("Endless Nights IV","QPTag",oPC)); + SQLocalsUUID_SetString(oPC,"QPRingTag",GetCampaignString("Endless Nights IV","QPRingTag",oPC)); + + if (iSpecialPowers > 0) + CreateSpecialPowers(oPC); + if (SQLocalsUUID_GetInt(oPC,"EvilPath") > 0) + CreateEvilPowers(oPC); + + if (iSpirit > 0) + SQLocals_SetString(GetModule(),"FriendlySpirit",GetName(oPC)); + + if (iMonstrous == 1 || iEvilPowers > 0) + { + object oGood; + oGood = GetObjectByTag("en3_good"); + AdjustReputation(oPC,oGood,-100); + object oDefender; + oDefender = GetObjectByTag("en4_cityguard0_1"); + AdjustReputation(oPC,oDefender,-100); + object oEvil; + oEvil = GetObjectByTag("en4_evil"); + AdjustReputation(oPC,oEvil,50); + + SetLocalString(oPC,"Respawn","EN4_MERespawn"); + + if (GetGoodEvilValue(oPC) > 60 && iMonstrous == 1) + { + SQLocalsUUID_SetInt(oPC,"Monstrous",2); + } else { + SQLocalsUUID_SetInt(oPC,"Monstrous",1); + } + } + + DelayCommand(0.1,SendMessageToPC(oPC,"Character imported with " + IntToString(iQuestPoints) + " quest points and " + IntToString(iDeaths) + " deaths.")); + if (SQLocalsUUID_GetInt(oPC,"ModRank") == 1) + DelayCommand(0.2,SendMessageToPC(oPC,"Character is eligible for Campaign Ranking.")); + else + DelayCommand(0.2,SendMessageToPC(oPC,"Character is ineligible for Campaign Ranking.")); + } else { + SQLocalsUUID_SetInt(oPC,"ModRank",0); + if (iXPCheck == 0) + DelayCommand(0.2,SendMessageToPC(oPC,"Character is ineligible for Campaign Ranking.")); + else + DelayCommand(0.2,SendMessageToPC(oPC,"Invalid Character Import: Character is ineligible for Campaign Ranking.")); + } + + object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC); + if (!GetIsObjectValid(oItem) && GetLevelByClass(CLASS_TYPE_MONK,oPC) > 0) + oItem = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC); + + if (GetIsObjectValid(oItem)) + GetSpecialWeaponBonus(oPC,oItem); + + oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC); + if (GetIsObjectValid(oItem)) + GetSpecialWeaponBonus(oPC,oItem); + +} diff --git a/_module/nss/r_trig.nss b/_module/nss/r_trig.nss index d1878c59..a321265c 100644 --- a/_module/nss/r_trig.nss +++ b/_module/nss/r_trig.nss @@ -9,4 +9,4 @@ if (GetIsPC(oPC) && GetLocalInt(oPC,"Monstrous") == 1) oSpawnPoint = GetObjectByTag("EN4_MERespawn"); DelayCommand(0.1f,AssignCommand(oPC,JumpToLocation(GetLocation(oSpawnPoint)))); } -} +} \ No newline at end of file diff --git a/_module/utc/en3_barghest.utc.json b/_module/utc/en3_barghest.utc.json index 824a912d..1ffefab2 100644 --- a/_module/utc/en3_barghest.utc.json +++ b/_module/utc/en3_barghest.utc.json @@ -1,13 +1,89 @@ { "__data_type": "UTC ", + "Appearance_Head": { + "type": "byte", + "value": 0 + }, "Appearance_Type": { "type": "word", "value": 1103 }, + "ArmorPart_RFoot": { + "type": "byte", + "value": 0 + }, "BodyBag": { "type": "byte", "value": 0 }, + "BodyPart_Belt": { + "type": "byte", + "value": 0 + }, + "BodyPart_LBicep": { + "type": "byte", + "value": 0 + }, + "BodyPart_LFArm": { + "type": "byte", + "value": 0 + }, + "BodyPart_LFoot": { + "type": "byte", + "value": 0 + }, + "BodyPart_LHand": { + "type": "byte", + "value": 0 + }, + "BodyPart_LShin": { + "type": "byte", + "value": 0 + }, + "BodyPart_LShoul": { + "type": "byte", + "value": 0 + }, + "BodyPart_LThigh": { + "type": "byte", + "value": 0 + }, + "BodyPart_Neck": { + "type": "byte", + "value": 0 + }, + "BodyPart_Pelvis": { + "type": "byte", + "value": 0 + }, + "BodyPart_RBicep": { + "type": "byte", + "value": 0 + }, + "BodyPart_RFArm": { + "type": "byte", + "value": 0 + }, + "BodyPart_RHand": { + "type": "byte", + "value": 0 + }, + "BodyPart_RShin": { + "type": "byte", + "value": 0 + }, + "BodyPart_RShoul": { + "type": "byte", + "value": 0 + }, + "BodyPart_RThigh": { + "type": "byte", + "value": 0 + }, + "BodyPart_Torso": { + "type": "byte", + "value": 0 + }, "Cha": { "type": "byte", "value": 14 @@ -32,6 +108,22 @@ } ] }, + "Color_Hair": { + "type": "byte", + "value": 0 + }, + "Color_Skin": { + "type": "byte", + "value": 0 + }, + "Color_Tattoo1": { + "type": "byte", + "value": 0 + }, + "Color_Tattoo2": { + "type": "byte", + "value": 0 + }, "Comment": { "type": "cexostring", "value": "" @@ -657,5 +749,81 @@ "Wis": { "type": "byte", "value": 14 + }, + "xAppearance_Head": { + "type": "word", + "value": 0 + }, + "xArmorPart_RFoot": { + "type": "word", + "value": 0 + }, + "xBodyPart_Belt": { + "type": "word", + "value": 0 + }, + "xBodyPart_LBicep": { + "type": "word", + "value": 0 + }, + "xBodyPart_LFArm": { + "type": "word", + "value": 0 + }, + "xBodyPart_LFoot": { + "type": "word", + "value": 0 + }, + "xBodyPart_LHand": { + "type": "word", + "value": 0 + }, + "xBodyPart_LShin": { + "type": "word", + "value": 0 + }, + "xBodyPart_LShoul": { + "type": "word", + "value": 0 + }, + "xBodyPart_LThigh": { + "type": "word", + "value": 0 + }, + "xBodyPart_Neck": { + "type": "word", + "value": 0 + }, + "xBodyPart_Pelvis": { + "type": "word", + "value": 0 + }, + "xBodyPart_RBicep": { + "type": "word", + "value": 0 + }, + "xBodyPart_RFArm": { + "type": "word", + "value": 0 + }, + "xBodyPart_RHand": { + "type": "word", + "value": 0 + }, + "xBodyPart_RShin": { + "type": "word", + "value": 0 + }, + "xBodyPart_RShoul": { + "type": "word", + "value": 0 + }, + "xBodyPart_RThigh": { + "type": "word", + "value": 0 + }, + "xBodyPart_Torso": { + "type": "word", + "value": 0 } }