├── LICENSE ├── README.md ├── bossfights ├── ee_area_onenter.nss ├── ee_area_onexit.nss ├── ee_cfg.nss ├── ee_enc_end.nss ├── ee_enc_init.nss ├── ee_enc_onex.nss ├── ee_enc_reset.nss ├── ee_enc_start.nss ├── ee_enc_wipe.nss ├── ee_ent_ondeath.nss ├── ee_ent_ondmg.nss ├── ee_ent_onperc.nss ├── ee_ent_onspawn.nss ├── ee_evt_execute.nss ├── ee_evt_onex.nss ├── ee_evtg_onex.nss ├── ee_inc.nss ├── ee_inc_const.nss ├── ee_trig_init.nss ├── ee_trig_onenter.nss ├── ee_trig_onexit.nss └── encounters │ ├── enc_banditchief.nss │ ├── enc_constructor.nss │ ├── enc_crypt_01.nss │ └── enc_spiderqueen.nss ├── core ├── chr_cfg.nss ├── chr_death_inc.nss ├── chr_inc.nss ├── chr_update_all.nss ├── datetime_cfg.nss ├── datetime_inc.nss ├── datetime_ini.nss ├── events │ ├── anph_area_enter.nss │ ├── anph_area_exit.nss │ ├── anph_area_hb.nss │ ├── mod_onacquire.nss │ ├── mod_onactivate.nss │ ├── mod_onchat.nss │ ├── mod_onclenter.nss │ ├── mod_onclleave.nss │ ├── mod_oncutabort.nss │ ├── mod_ondeath.nss │ ├── mod_ondying.nss │ ├── mod_onequip.nss │ ├── mod_onheart.nss │ ├── mod_onlevelup.nss │ ├── mod_onload.nss │ ├── mod_onrespawn.nss │ ├── mod_onrest.nss │ ├── mod_onunacquir.nss │ ├── mod_onunequip.nss │ ├── mod_onuserdef.nss │ ├── pc_onheart.nss │ ├── xevent_examine_a.nss │ ├── xevent_examine_b.nss │ ├── xevent_joinparty.nss │ └── xevent_stealth.nss ├── mod_cfg.nss ├── sql_inc.nss ├── sql_init.nss ├── sql_update_pc.nss └── subrace_inc.nss ├── creature ├── creature_cfg.nss ├── creature_inc.nss ├── lycan_cfg.nss ├── lycan_heartbeat.nss ├── lycan_inc.nss ├── lycan_onspawn.nss ├── npc_randomize.nss ├── nw_c2_default1.nss ├── nw_c2_default6.nss ├── nw_c2_default7.nss ├── nw_c2_default9.nss └── nw_c2_defaultb.nss ├── dialog ├── dlg_act_back.nss ├── dlg_act_exit.nss ├── dlg_act_next.nss ├── dlg_act_pc01.nss ├── dlg_act_pc02.nss ├── dlg_act_pc03.nss ├── dlg_act_pc04.nss ├── dlg_act_pc05.nss ├── dlg_act_pc06.nss ├── dlg_act_prev.nss ├── dlg_cfg.nss ├── dlg_gettexts.nss ├── dlg_inc.nss ├── dlg_ini.nss ├── dlg_start.nss ├── dlgx_mark_select.nss ├── intro │ ├── intro_deity.nss │ ├── intro_enter.nss │ ├── intro_faction.nss │ ├── intro_scale.nss │ └── intro_subrace.nss ├── lootgen │ ├── dlg_lgs.nss │ └── dlg_lgs_ini.nss ├── model │ ├── dlg_model.nss │ ├── dlg_model_const.nss │ └── dlg_model_ini.nss ├── store │ ├── dlg_store.nss │ └── dlg_store_ini.nss └── wand │ ├── dlg_wand.nss │ ├── dlg_wand_const.nss │ └── dlg_wand_ini.nss ├── factions ├── anph_go_field.nss ├── anph_payout.nss ├── anph_team_cnt.nss ├── faction_donate.nss ├── faction_inc.nss ├── faction_init.nss └── faction_join.nss ├── loot ├── egs_cfg.nss ├── egs_inc.nss ├── egs_ini.nss ├── egs_tst.nss ├── ip_cfg.nss ├── ip_inc.nss ├── ip_ini.nss ├── ip_ini_b.nss ├── ip_names_cfg.nss ├── ip_names_inc.nss ├── ip_names_ini.nss ├── ip_rnd_inc.nss ├── ip_tst.nss ├── lgs_cfg.nss ├── lgs_chest_check.nss ├── lgs_chest_ondmg.nss ├── lgs_inc.nss └── lgs_ini.nss ├── persistentchests ├── psc_chest_distur.nss ├── psc_chest_open.nss ├── psc_pvt_clenter.nss ├── psc_pvt_close.nss ├── psc_pvt_disturb.nss └── psc_pvt_open.nss ├── placeables ├── plc_archery_attk.nss ├── plc_detbarrdeath.nss ├── plc_dummy_ondmg.nss ├── plc_inf_ondistur.nss ├── plc_link_onheart.nss └── plc_link_onused.nss ├── pveautotune ├── pat_cfg.nss ├── pat_inc.nss ├── pat_ini.nss ├── pat_ini_areas.nss ├── pat_ini_base.nss ├── pat_ini_class.nss ├── pat_ini_featpack.nss ├── pat_ini_skillset.nss ├── pat_ini_spells.nss └── pat_tst.nss ├── spells ├── esm_cfg.nss ├── esm_inc.nss ├── esm_spuserdef.nss ├── nw_s0_knock.nss ├── nw_s0_truesee.nss ├── nw_s2_familiar.nss ├── spell_hook.nss ├── spell_inc.nss ├── spell_missile.nss ├── spell_weapon.nss └── x2_s3_onhitcast.nss ├── store ├── store_cfg.nss ├── store_cleaven.nss ├── store_folinus.nss ├── store_hrtbeat.nss ├── store_inc.nss ├── store_ini.nss ├── store_onclosed.nss └── store_open.nss ├── tools ├── chat_commands.nss ├── dev_commands.nss ├── note.nss ├── server_restart.nss ├── x3_dm_tool01.nss ├── x3_dm_tool02.nss ├── x3_dm_tool08.nss ├── x3_dm_tool09.nss ├── x3_dm_tool10.nss ├── x3_pl_tool08.nss ├── x3_pl_tool09.nss └── x3_pl_tool10.nss ├── utils ├── anph_gate_closed.nss ├── anph_gate_ondmg.nss ├── color_inc.nss ├── dbg_inc.nss ├── dev_inc.nss ├── eas_inc.nss ├── flavor_enter.nss ├── terrain_enter.nss ├── terrain_exit.nss ├── util_inc.nss └── util_names_inc.nss └── xp ├── xp_apply.nss ├── xp_cfg.nss ├── xp_inc.nss └── xp_reload.nss /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Milos Tijanic 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Anphillia 2 | NWN Scripts for the Anphillia PW 3 | 4 | This is a small section of the Anphillia (EE version) script set, curated stuff that might be interesting to others. Many of the includes are missing, and likely some of the functions used as well, so this is not usable as-is, but will hopefully be educational at least. 5 | 6 | These scripts were written by eyesolated and myself for the EE incarnation of Anphillia. 7 | -------------------------------------------------------------------------------- /bossfights/ee_area_onenter.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_OnAreaEnter 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : eE's OnAreaEnter Script keeps track of current players 7 | * in the Area. 8 | * 9 | * changes : 2010/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | #include "ee_inc" 12 | 13 | void main() 14 | { 15 | object oArea = OBJECT_SELF; 16 | object oPC = GetEnteringObject(); 17 | 18 | // If the entering object is not a PC, exit 19 | if (!GetIsPC(oPC)) 20 | return; 21 | 22 | // If the entering object is a DM, exit 23 | if (GetIsDM(oPC)) 24 | return; 25 | 26 | int n = 1; 27 | object oEncounter = GetNearestObject(OBJECT_TYPE_STORE, oPC, n); 28 | 29 | while (GetIsObjectValid(oEncounter)) 30 | { 31 | if (GetLocalInt(oEncounter, eE_VAR_ENCOUNTER_AUTOINI) == eE_ENCOUNTER_AUTOINI_ENABLED) 32 | { 33 | // Initialize this Encounter 34 | ExecuteScript(eE_SCRIPT_ENCOUNTER_INITIALIZE, oEncounter); 35 | } 36 | n++; 37 | oEncounter = GetNearestObject(OBJECT_TYPE_STORE, oPC, n); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bossfights/ee_area_onexit.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_OnAreaExit 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : eE's OnAreaExit Script keeps track of current players 7 | * in the Area and resets encounters as necessary when no more 8 | * players are in the Area 9 | * 10 | * changes : 2010/6/1 - eyesolated - Initial creation 11 | ************************************************************************/ 12 | #include "ee_inc" 13 | 14 | void main() 15 | { 16 | object oArea = OBJECT_SELF; 17 | object oPC = GetExitingObject(); 18 | 19 | // If the exiting object is not a PC, exit 20 | if (!GetIsPC(oPC)) 21 | return; 22 | 23 | // If the exiting object is a DM, exit 24 | if (GetIsDM(oPC)) 25 | return; 26 | 27 | int nPlayerCount = GetLocalInt(oArea, "AREA_PLAYER_COUNT"); 28 | 29 | //SendMessageToPC(oPC, "Exiting Area... there are now " + IntToString(nPlayerCount) + " players left."); 30 | 31 | // If the player count reached 0, reset all initialized encounters 32 | if (nPlayerCount == 0) 33 | { 34 | // We need to get all Encounters in the Area Encounter Array and reset those 35 | object oEncounter; 36 | while (eas_Array_GetSize(oArea, eE_VAR_AREA_ENCOUNTERARRAY_INI) > 0) 37 | { 38 | eE_DebugMSG(oEncounter, "no more players in Area, resetting encounter"); 39 | oEncounter = eas_OArray_Entry_Get(oArea, eE_VAR_AREA_ENCOUNTERARRAY_INI, 0); 40 | ExecuteScript(eE_SCRIPT_ENCOUNTER_RESET, oEncounter); 41 | } 42 | 43 | // Then, we need to do silent wipe checks for all encounters that are in Progress 44 | int nEncountersInProgress = eas_Array_GetSize(oArea, eE_VAR_AREA_ENCOUNTERARRAY_PROG); 45 | int n; 46 | for (n = 0; n < nEncountersInProgress; n++) 47 | { 48 | eE_DebugMSG(oEncounter, "no more players in Area, initiating wipe check"); 49 | oEncounter = eas_OArray_Entry_Get(oArea, eE_VAR_AREA_ENCOUNTERARRAY_PROG, n); 50 | float fDespawn = GetLocalFloat(oEncounter, eE_VAR_DESPAWNINTERVAL); 51 | 52 | /* Area sized encounters don't give a wipe warning 53 | SendMessageToPC(oPC, "You have " + FloatToString(fDespawn, 0, 2) + " seconds to return to the encounter area and prevent a wipe."); 54 | */ 55 | AssignCommand(GetModule(), DelayCommand(fDespawn, ExecuteScript(eE_SCRIPT_ENCOUNTER_WIPE, oEncounter))); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /bossfights/ee_cfg.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_cfg 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Configuration file for eyesolated Encounters 7 | * 8 | * changes : 2011/6/1 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | // Script settings. 12 | // Set these to the OnDeath and OnPerception Scripts that 13 | // you use for your creatures. Set these two to "" if you don't want eE 14 | // to call these scripts 15 | // 16 | // Note: this needs to be empty for NWN: Enhanced Edition as eE sets references to the original scripts itself 17 | const string eE_SCRIPT_CREATURE_ONDEATH = ""; // "nw_c2_default7"; 18 | const string eE_SCRIPT_CREATURE_ONPERCEPTION = ""; // "nw_c2_default2"; 19 | const string eE_SCRIPT_CREATURE_ONDAMAGED = ""; 20 | 21 | // Set the following variable on a Creature / Placeable to restrict the range a player has to be in to deal damage to the entity 22 | const string eE_VAR_RESTRICT_DAMAGERANGE = "eE_RestrictDamageRange"; 23 | const int eE_RESTRICT_DAMAGERANGE_MELEE = 1; 24 | const int eE_RESTRICT_DAMAGERANGE_RANGE = 2; 25 | 26 | // Don't touch anything below this 27 | 28 | // These are the various eE Scripts 29 | const string eE_SCRIPT_ENCOUNTER_INITIALIZE = "ee_enc_init"; 30 | const string eE_SCRIPT_ENCOUNTER_ONEXHAUSTED = "ee_enc_onex"; 31 | const string eE_SCRIPT_ENCOUNTER_RESET = "ee_enc_reset"; 32 | const string eE_SCRIPT_ENCOUNTER_END = "ee_enc_end"; 33 | const string eE_SCRIPT_ENCOUNTER_START = "ee_enc_start"; 34 | const string eE_SCRIPT_ENTITY_ONDEATH = "ee_ent_ondeath"; 35 | const string eE_SCRIPT_ENTITY_ONSPAWN = "ee_ent_onspawn"; 36 | const string eE_SCRIPT_ENTITY_ONDAMAGED = "ee_ent_ondmg"; 37 | const string eE_SCRIPT_ENTITY_ONPERCEPTION = "ee_ent_onperc"; 38 | const string eE_SCRIPT_EVENT_EXECUTE = "ee_evt_execute"; 39 | const string eE_SCRIPT_EVENT_ONEXHAUSTED = "ee_evt_onex"; 40 | const string eE_SCRIPT_EVENTGROUP_ONEXHAUSTED = "ee_evtg_onex"; 41 | const string eE_SCRIPT_ENCOUNTER_WIPE = "ee_enc_wipe"; 42 | 43 | // Don't touch this 44 | const float eE_CFG_DELAY_CREATUREDESTROY = 0.1f; // a 0.1f delay should be enough 45 | 46 | // ResRefs 47 | const string eE_BLUEPRINT_STORE = "ee_encounter_str"; 48 | const string eE_BLUEPRINT_BOOK = "ee_event"; 49 | -------------------------------------------------------------------------------- /bossfights/ee_enc_end.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_end 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Ends an eE encounter. 7 | * The encounter object must be the script executor. 8 | * 9 | * changes : 2010/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | 12 | #include "ee_inc" 13 | 14 | void main() 15 | { 16 | object oEncounter = OBJECT_SELF; 17 | 18 | // An encounter can enter a cooldown if it's either Initialized or InProgress 19 | int iStatus = eE_GetEncounterStatus(oEncounter); 20 | if ((iStatus == eE_ENCOUNTER_STATUS_INITIALIZED) || 21 | (iStatus == eE_ENCOUNTER_STATUS_INPROGRESS)) 22 | { 23 | // End an Encounter and activate it's cooldown 24 | eE_StartCooldown(oEncounter); 25 | 26 | // Reset the Encounter too, undoing all create events registered 27 | eE_ResetEncounter(oEncounter); 28 | } 29 | else 30 | { 31 | eE_DebugMSG(oEncounter, "Couldn't set on cooldown"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bossfights/ee_enc_init.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_initialize 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Initializes an eE encounter. The encounter object must be 7 | * the script executor. 8 | * 9 | * changes : 2010/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | 12 | #include "ee_inc" 13 | 14 | void main() 15 | { 16 | object oEncounter = OBJECT_SELF; 17 | 18 | // Check if our Encounter object has the variable Event Tag set. 19 | if (GetLocalString(oEncounter, eE_VAR_INITIALIZETAG) == "") 20 | { 21 | eE_DebugMSG(oEncounter, "Invalid Encounter Object"); 22 | return; 23 | } 24 | 25 | // Only enabled encounters can be initialized 26 | int iDisabled = GetLocalInt(oEncounter, eE_VAR_ENCOUNTER_DISABLED); 27 | if (iDisabled != 0) 28 | { 29 | eE_DebugMSG(oEncounter, "Initialize failed - Encounter Disabled"); 30 | return; 31 | } 32 | 33 | // Only initialize oEncounter if it meets the set Condition(s) 34 | if (!eE_CheckConditions(oEncounter)) 35 | { 36 | eE_DebugMSG(oEncounter, "Initialize failed - Condition check failed"); 37 | return; 38 | } 39 | 40 | // Only initialize oEncounter if it's ready to start, i.e. not already in 41 | // progress or on cooldown 42 | int nEncounterStatus = eE_GetEncounterStatus(oEncounter); 43 | if (nEncounterStatus != eE_ENCOUNTER_STATUS_IDLE) 44 | { 45 | string sStatus; 46 | switch (nEncounterStatus) 47 | { 48 | case eE_ENCOUNTER_STATUS_INITIALIZING: sStatus = "Initializing"; break; 49 | case eE_ENCOUNTER_STATUS_INITIALIZED: sStatus = "Initialized"; break; 50 | case eE_ENCOUNTER_STATUS_INPROGRESS: sStatus = "In Progress"; break; 51 | case eE_ENCOUNTER_STATUS_ONCOOLDOWN: sStatus = "On Cooldown"; break; 52 | case eE_ENCOUNTER_STATUS_RESETTING: sStatus = "Resetting"; break; 53 | } 54 | eE_DebugMSG(oEncounter, "Initialize failed - Encounter not [" + sStatus + "]!"); 55 | return; 56 | } 57 | // Set Encounter Status to Initializing 58 | eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_INITIALIZING); 59 | 60 | string sTag = GetLocalString(oEncounter, eE_VAR_INITIALIZETAG); 61 | eE_HandleEvents(oEncounter, sTag, eE_ENCOUNTER_STATUS_INITIALIZING); 62 | 63 | // Set the encounter as Initialized 64 | eE_DebugMSG(oEncounter, "Initialized..."); 65 | eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_INITIALIZED); 66 | 67 | // we need to tell the area oEncounter is in that this encounter has entered the 68 | // initialized state and should despawn if all players left. 69 | // The encounter is removed from this Array as soon as it is started or all 70 | // players left the area. The Array in the area always knows which encounters it 71 | // has to manage 72 | eE_Encounter_AddToArea(oEncounter, GetArea(oEncounter), eE_VAR_AREA_ENCOUNTERARRAY_INI); 73 | } 74 | -------------------------------------------------------------------------------- /bossfights/ee_enc_onex.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_encounter_onexhausted 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : OnExhausted script for eyesolated Encounters. 7 | * 8 | * notes : This script is called by eyesolated Encounters, do NOT 9 | * add it anywhere yourself! 10 | * 11 | * changes : 2011/6/1 - eyesolated - Initial creation 12 | ************************************************************************/ 13 | 14 | #include "ee_inc" 15 | 16 | void Undo(object oEncounter) 17 | { 18 | // Try to Soft-Undo all Events 19 | int iRegisteredEvents = eE_GetRegisteredEvents(oEncounter); 20 | int i; 21 | object oEvent; 22 | string sTag; 23 | string sCheck = ""; 24 | //float fDelay = 0.0f; 25 | //float fInterval = 0.0f; 26 | for (i = 1; i <= iRegisteredEvents; i++) 27 | { 28 | oEvent = eE_GetEvent(oEncounter, i); 29 | eE_SetActiveKeyEvents(oEncounter, GetTag(oEvent), 0); 30 | 31 | eE_HandleEvent(oEncounter, oEvent, eE_ENCOUNTER_STATUS_ONCOOLDOWN, eE_EVENTMODE_UNDO); 32 | 33 | // Find out the hightest Interval of all Events 34 | //fInterval = GetLocalFloat(oEvent, eE_VAR_ENTITY_INTERVAL); 35 | //if (fInterval > fDelay) 36 | // fDelay = fInterval; 37 | 38 | // Reset all important event variables 39 | eE_SetEventStatus(oEvent, eE_EVENTSTATUS_INACTIVE); 40 | DeleteLocalInt(oEvent, eE_VAR_EVENTCREATURECOUNT); 41 | DeleteLocalInt(oEvent, eE_VAR_ENTITY_MAXDYNAMICQUANTITY); 42 | } 43 | 44 | // Reset all important encounter variables 45 | eE_SetRegisteredEvents(oEncounter, 0); 46 | } 47 | 48 | void main() 49 | { 50 | object oEncounter = OBJECT_SELF; 51 | string sMessage = "Encounter exhausted"; 52 | 53 | float fEncounterCD = GetLocalFloat(oEncounter, eE_VAR_COOLDOWN); 54 | 55 | // if respawn CD is 0, this is a one-time encounter 56 | if (fEncounterCD != 0.0f) 57 | { 58 | sMessage += "\nCooldown finished in " + FloatToString(fEncounterCD, 0, 2) + " Seconds"; 59 | eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_ONCOOLDOWN); 60 | AssignCommand(GetModule(), DelayCommand(fEncounterCD, eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_IDLE))); 61 | } 62 | 63 | // Shortly before the encounter is active again, undo it's stuff 64 | AssignCommand(GetModule(), DelayCommand(fEncounterCD - 5.0f, Undo(oEncounter))); 65 | 66 | // Remove the encounter from the In Progress Area Array 67 | eE_Encounter_RemoveFromArea(oEncounter, GetArea(oEncounter), eE_VAR_AREA_ENCOUNTERARRAY_PROG); 68 | 69 | // Debug MSG 70 | eE_DebugMSG(oEncounter, sMessage); 71 | 72 | // Send a victory message to players 73 | eE_SendMessageToActivePlayers(oEncounter, "Congratulations, you defeated [" + eE_GetEncounterName(oEncounter) + "]"); 74 | } 75 | -------------------------------------------------------------------------------- /bossfights/ee_enc_reset.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_encounter_reset 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Resets an eE Encounter. 7 | * 8 | * notes : The caller of this script must be an eE Object. 9 | * 10 | * changes : 2011/6/1 - eyesolated - Initial creation 11 | ************************************************************************/ 12 | 13 | #include "ee_inc" 14 | 15 | void main() 16 | { 17 | object oEncounter = OBJECT_SELF; 18 | 19 | int nEncounterStatus = eE_GetEncounterStatus(oEncounter); 20 | 21 | if ( 22 | (nEncounterStatus != eE_ENCOUNTER_STATUS_INITIALIZED) && 23 | (nEncounterStatus != eE_ENCOUNTER_STATUS_INPROGRESS) && 24 | (nEncounterStatus != eE_ENCOUNTER_STATUS_ONCOOLDOWN) 25 | ) 26 | { 27 | eE_DebugMSG(oEncounter, "Reset aborted - wrong Encounter Status"); 28 | return; 29 | } 30 | 31 | // This is a hard-reset of an encounter. Destroy everything and set 32 | // The encounter status back to idle 33 | eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_RESETTING); 34 | 35 | int nRegisteredEvents = eE_GetRegisteredEvents(oEncounter); 36 | int n; 37 | object oEvent; 38 | string sTag; 39 | string sCheck = ""; 40 | float fDelay = 0.0f; 41 | float fInterval = 0.0f; 42 | for (n = 1; n <= nRegisteredEvents; n++) 43 | { 44 | oEvent = eE_GetEvent(oEncounter, n); 45 | eE_SetActiveKeyEvents(oEncounter, GetTag(oEvent), 0); 46 | 47 | // Undo the event 48 | eE_HandleEvent(oEncounter, oEvent, eE_ENCOUNTER_STATUS_RESETTING, eE_EVENTMODE_UNDO); 49 | 50 | // Destroy all Event Entities (Once per unique Tag) 51 | /*sTag = GetLocalString(oEvent, eE_VAR_ENTITY_TAG); 52 | if (FindSubString(sCheck, "[" + sTag + "]") == -1) 53 | { 54 | sCheck += "[" + sTag + "]"; 55 | eE_DestroyEncounterEntity(oEncounter, sTag); 56 | }*/ 57 | 58 | // Find out the hightest Interval of all Events 59 | fInterval = GetLocalFloat(oEvent, eE_VAR_ENTITY_INTERVAL); 60 | if (fInterval > fDelay) 61 | fDelay = fInterval; 62 | 63 | // Reset all important event variables 64 | eE_SetEventStatus(oEvent, eE_EVENTSTATUS_INACTIVE); 65 | DeleteLocalInt(oEvent, eE_VAR_EVENTCREATURECOUNT); 66 | DeleteLocalInt(oEvent, eE_VAR_ENTITY_MAXDYNAMICQUANTITY); 67 | } 68 | 69 | // Reset all important encounter variables 70 | eE_SetRegisteredEvents(oEncounter, 0); 71 | 72 | // eE_ReportRegisteredEvents(oEncounter); 73 | 74 | // Add a second to our Delay to be sure 75 | fDelay += 1.0f; 76 | AssignCommand(GetModule(), DelayCommand(0.1f, eE_DebugMSG(oEncounter, "Encounter will be Reset in " + FloatToString(fDelay, 0, 1) + " Seconds"))); 77 | // If the Encounter isn't on Cooldown, set it's status to IDLE after the reset 78 | if (nEncounterStatus != eE_ENCOUNTER_STATUS_ONCOOLDOWN) 79 | { 80 | AssignCommand(GetModule(), DelayCommand(fDelay, eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_IDLE))); 81 | } 82 | AssignCommand(GetModule(), DelayCommand(fDelay + 0.1f, eE_DebugMSG(oEncounter, "Reset Finished"))); 83 | 84 | // Remove the Encounter from the Area Arrays 85 | eE_Encounter_RemoveFromArea(oEncounter, GetArea(oEncounter), eE_VAR_AREA_ENCOUNTERARRAY_INI); 86 | eE_Encounter_RemoveFromArea(oEncounter, GetArea(oEncounter), eE_VAR_AREA_ENCOUNTERARRAY_PROG); 87 | } 88 | -------------------------------------------------------------------------------- /bossfights/ee_enc_start.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_start 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Starts an eE encounter (activates associated events). 7 | * The encounter object must be the script executor. 8 | * 9 | * changes : 2010/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | 12 | #include "ee_inc" 13 | 14 | void main() 15 | { 16 | object oEncounter = OBJECT_SELF; 17 | 18 | // Only start oEncounter if it's ready to start, i.e. not already in 19 | // progress or on cooldown 20 | if (eE_GetEncounterStatus(oEncounter) != eE_ENCOUNTER_STATUS_INITIALIZED) 21 | { 22 | eE_DebugMSG(oEncounter, "Encounter Status not [Initialized]!"); 23 | return; 24 | } 25 | // Set the encounter as being in progress 26 | eE_SetEncounterStatus(oEncounter, eE_ENCOUNTER_STATUS_INPROGRESS); 27 | 28 | // Inform DMs on an encounter with MessageLevel of at least 1 29 | int iEncounterMessageLevel = GetLocalInt(oEncounter, eE_VAR_ENCOUNTER_MESSAGELEVEL); 30 | if (iEncounterMessageLevel >= eE_MESSAGELEVEL_LOW) 31 | SendMessageToAllDMs(eE_GetEncounterName(oEncounter) + " started in " + GetName(GetArea(oEncounter))); 32 | 33 | // If the EventTag is empty, there no events associated with this encounters Activation 34 | if (GetLocalString(oEncounter, eE_VAR_EVENTTAG) != "") 35 | { 36 | string sTag = GetLocalString(oEncounter, eE_VAR_EVENTTAG); 37 | eE_HandleEvents(oEncounter, sTag); 38 | } 39 | 40 | // Get the encounter's Area 41 | object oArea = GetArea(oEncounter); 42 | 43 | // Remove the encounter from the Area Array of initialized encounters 44 | eE_Encounter_RemoveFromArea(oEncounter, oArea, eE_VAR_AREA_ENCOUNTERARRAY_INI); 45 | 46 | // Add the encounter to the Area Array of inprogress encounters 47 | eE_Encounter_AddToArea(oEncounter, oArea, eE_VAR_AREA_ENCOUNTERARRAY_PROG); 48 | } 49 | -------------------------------------------------------------------------------- /bossfights/ee_enc_wipe.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_enc_wipe 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : This script checks wheter the encounter wiped and initiates 7 | * appropriate actions. 8 | * 9 | * changes : 2010/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | 12 | // Includes 13 | #include "eE_inc" 14 | 15 | void main() 16 | { 17 | // This script self-checks every 15 seconds as long as the encounter 18 | // is in Progress. 19 | object oEncounter = OBJECT_SELF; 20 | 21 | if (eE_GetEncounterStatus(oEncounter) == eE_ENCOUNTER_STATUS_INPROGRESS) 22 | { 23 | // Get the player count again 24 | if (eE_GetEncounterPlayerCount(oEncounter) > 0) 25 | { 26 | eE_DebugMSG(oEncounter, "Wipe prevented."); 27 | return; 28 | } 29 | 30 | if (GetLocalInt(oEncounter, eE_VAR_CDAFTERWIPE) == eE_VAR_CDAFTERWIPE_ENABLED) 31 | { 32 | // End the encounter 33 | eE_DebugMSG(oEncounter, "Wipe, initiating reset and cooldown..."); 34 | ExecuteScript(eE_SCRIPT_ENCOUNTER_END, oEncounter); 35 | } 36 | else 37 | { 38 | // Reset the encounter 39 | eE_DebugMSG(oEncounter, "Wipe, initiating reset..."); 40 | eE_ResetEncounter(oEncounter); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bossfights/ee_ent_onperc.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_ent_OnSpawn 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : OnPerceived script for entities (creatures/placeables) spawned 7 | * using eyesolated Encounters. 8 | * 9 | * changes : 2011/6/1 - eyesolated - Initial creation 10 | ************************************************************************/ 11 | #include "ee_inc" 12 | 13 | void main() 14 | { 15 | // Retrieve necessary eE Variables for this creature 16 | object oEncounter = eE_GetEntityEncounter(OBJECT_SELF); 17 | object oPerceived = GetLastPerceived(); 18 | // if the encounter object is invalid or 19 | // if the perceived object is not a PC able to activate the encounter, 20 | // execute the default script and exit immediately 21 | if ( 22 | !GetIsObjectValid(oEncounter) || 23 | !GetIsPC(oPerceived) || 24 | GetIsDM(oPerceived) 25 | ) 26 | { 27 | if (eE_SCRIPT_CREATURE_ONPERCEPTION != "") 28 | ExecuteScript(eE_SCRIPT_CREATURE_ONPERCEPTION, OBJECT_SELF); 29 | else 30 | ExecuteScript(GetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONPERCEPTION), OBJECT_SELF); 31 | return; 32 | } 33 | 34 | // Activate the encounter if it is Initialized 35 | if (eE_GetEncounterStatus(oEncounter) == eE_ENCOUNTER_STATUS_INITIALIZED) 36 | { 37 | ExecuteScript(eE_SCRIPT_ENCOUNTER_START, oEncounter); 38 | } 39 | 40 | // Now execute the standard NWN thingie if this is a creature 41 | if (GetObjectType(OBJECT_SELF) == OBJECT_TYPE_CREATURE) 42 | { 43 | ExecuteScript(GetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONPERCEPTION), OBJECT_SELF); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bossfights/ee_ent_onspawn.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_mob_OnSpawn 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : OnSpawn script for creature entities spawned using 7 | * eyesolated Encounters. 8 | * 9 | * notes : This script is called by eyesolated Encounters, do NOT 10 | * add it to a creatures OnSpawn Event yourself! Calling it 11 | * from a creature's OnSpawn script wouldn't work because 12 | * eE_GetEntityEncounter wouldn't return anything. 13 | * 14 | * changes : 2011/6/1 - eyesolated - Initial creation 15 | ************************************************************************/ 16 | #include "ee_inc" 17 | 18 | void main() 19 | { 20 | // Retrieve necessary eE Variables for this creature 21 | object oEncounter = eE_GetEntityEncounter(OBJECT_SELF); 22 | 23 | // If anyone called this from the wrong place, oEncounter is not a valid 24 | // object and therefor we exit this function. 25 | if (!GetIsObjectValid(oEncounter)) 26 | { 27 | return; 28 | } 29 | 30 | // Set the entity's AI Scripts to eE while remembering their current scripts 31 | if (GetObjectType(OBJECT_SELF) == OBJECT_TYPE_CREATURE) 32 | { 33 | SetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONDEATH, GetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_DEATH)); 34 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_DEATH, eE_SCRIPT_ENTITY_ONDEATH); 35 | 36 | SetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONDAMAGED, GetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_DAMAGED)); 37 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_DAMAGED, eE_SCRIPT_ENTITY_ONDAMAGED); 38 | 39 | SetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONPERCEPTION, GetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_NOTICE)); 40 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_CREATURE_ON_NOTICE, eE_SCRIPT_ENTITY_ONPERCEPTION); 41 | } 42 | else if (GetObjectType(OBJECT_SELF) == OBJECT_TYPE_PLACEABLE) 43 | { 44 | SetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONDEATH, GetEventScript(OBJECT_SELF, EVENT_SCRIPT_PLACEABLE_ON_DEATH)); 45 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_PLACEABLE_ON_DEATH, eE_SCRIPT_ENTITY_ONDEATH); 46 | 47 | SetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONDAMAGED, GetEventScript(OBJECT_SELF, EVENT_SCRIPT_PLACEABLE_ON_DAMAGED)); 48 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_PLACEABLE_ON_DAMAGED, eE_SCRIPT_ENTITY_ONDAMAGED); 49 | } 50 | 51 | // Rename the mob if there's a variable on the encounter object or an associated waypoint object 52 | string sNewName = GetLocalString(oEncounter, GetTag(OBJECT_SELF)); 53 | if (sNewName == "") 54 | { 55 | // Try to find an associated waypoint 56 | object oWaypoint = GetLocalObject(oEncounter, eE_VAR_WAYPOINT); 57 | if (GetIsObjectValid(oWaypoint)) 58 | { 59 | sNewName = GetLocalString(oWaypoint, GetTag(OBJECT_SELF)); 60 | } 61 | } 62 | if (sNewName != "") 63 | SetName(OBJECT_SELF, sNewName); 64 | 65 | // Retrieve the eE Event Object Tag for this creatures OnSpawn 66 | string sEventTag = eE_GetEntityEventTag(OBJECT_SELF, eE_VAR_ENTITY_ONSPAWN); 67 | 68 | // If the EventTag is empty, there no events associated with this creature's OnSpawn 69 | if (sEventTag != "") 70 | { 71 | eE_HandleEvents(oEncounter, sEventTag); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /bossfights/ee_evt_onex.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_event_onexhausted 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : OnExhausted script for eyesolated Encounters Events. 7 | * 8 | * notes : This script is called by eyesolated Encounters, do NOT 9 | * add it anywhere yourself! 10 | * 11 | * changes : 2011/6/1 - eyesolated - Initial creation 12 | ************************************************************************/ 13 | 14 | #include "ee_inc" 15 | 16 | void main() 17 | { 18 | object oEncounter = eE_GetEventEncounter(OBJECT_SELF); 19 | 20 | eE_DebugMSG(oEncounter, GetName(OBJECT_SELF) + " exhausted"); 21 | // Retrieve the eE Event Object Tag for this Events OnExhaust 22 | string sEventTag = GetLocalString(OBJECT_SELF, eE_VAR_EVENT_ONEXHAUST); 23 | 24 | // If the EventTag is empty, there no events associated with this creature's OnSpawn 25 | if (sEventTag != "") 26 | { 27 | eE_HandleEvents(oEncounter, sEventTag); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bossfights/ee_evtg_onex.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_eventgroup_onexhausted 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : OnExhausted script for eyesolated Encounters Event Groups. 7 | * 8 | * notes : This script is called by eyesolated Encounters, do NOT 9 | * add it anywhere yourself! 10 | * 11 | * changes : 2011/6/1 - eyesolated - Initial creation 12 | ************************************************************************/ 13 | 14 | #include "ee_inc" 15 | 16 | void main() 17 | { 18 | string sEventGroup = GetTag(OBJECT_SELF); 19 | object oEncounter = eE_GetEventEncounter(OBJECT_SELF); 20 | eE_DebugMSG(oEncounter, "Event Group " + sEventGroup + " exhausted"); 21 | // Retrieve the eE Event Object Tag for this Event Group's OnExhaust 22 | string sEventTag = GetLocalString(oEncounter, sEventGroup + "_OnExhaust"); 23 | 24 | // If the EventTag is empty, there no events associated with this creature's OnSpawn 25 | if (sEventTag != "") 26 | { 27 | eE_HandleEvents(oEncounter, sEventTag); 28 | } 29 | } -------------------------------------------------------------------------------- /bossfights/ee_inc.nss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtijanic/anphillia/937f2ada171c11f0ce24f004282faa5e579cdb95/bossfights/ee_inc.nss -------------------------------------------------------------------------------- /bossfights/ee_trig_init.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_trig_init 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Initializes the linked eE Encounter upon a PC entering 7 | * 8 | * changes : 2010/6/1 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | // Includes 12 | #include "eE_inc" 13 | 14 | void main() 15 | { 16 | object oPC = GetEnteringObject(); 17 | if (!GetIsPC(oPC)) 18 | return; 19 | if (GetIsDM(oPC)) 20 | return; 21 | 22 | string sTriggerTag = GetTag(OBJECT_SELF); 23 | string sEncounterTag = GetStringRight(sTriggerTag, GetStringLength(sTriggerTag) - 3); 24 | object oEncounter = GetNearestObjectByTag(sEncounterTag, OBJECT_SELF); 25 | 26 | // Initialize this Encounter 27 | ExecuteScript(eE_SCRIPT_ENCOUNTER_INITIALIZE, oEncounter); 28 | } 29 | -------------------------------------------------------------------------------- /bossfights/ee_trig_onenter.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_trig_onenter 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Adds the entering object (PC) to the Active Players 7 | * 8 | * changes : 2010/6/1 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | // Includes 12 | #include "eE_inc" 13 | 14 | void main() 15 | { 16 | object oPC = GetEnteringObject(); 17 | if (!GetIsPC(oPC)) 18 | return; 19 | if (GetIsDM(oPC)) 20 | return; 21 | 22 | string sTriggerTag = GetTag(OBJECT_SELF); 23 | string sEncounterTag = GetStringRight(sTriggerTag, GetStringLength(sTriggerTag) - 3); 24 | object oEncounter = GetNearestObjectByTag(sEncounterTag, OBJECT_SELF); 25 | 26 | // Set this encounter to be trigger-size driven 27 | SetLocalInt(oEncounter, eE_VAR_SIZE, eE_ENCOUNTER_SIZE_TRIGGER); 28 | 29 | // Create the player Array 30 | eE_AddPlayerToArray(oEncounter, oPC); 31 | 32 | //SendMessageToPC(oPC, "You entered the area of [" + eE_GetEncounterName(oEncounter) + "]. There now are " + IntToString(eE_GetPlayerCountFromArray(oEncounter)) + " active players."); 33 | } 34 | -------------------------------------------------------------------------------- /bossfights/ee_trig_onexit.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : eE_trig_onexit 3 | * created by : eyesolated 4 | * date : 2011/6/1 5 | * 6 | * description : Removes the exiting object (PC) to the Active Players 7 | * 8 | * changes : 2010/6/1 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | // Includes 12 | #include "eE_inc" 13 | 14 | void main() 15 | { 16 | object oPC = GetExitingObject(); 17 | if (!GetIsPC(oPC)) 18 | return; 19 | if (GetIsDM(oPC)) 20 | return; 21 | 22 | string sTriggerTag = GetTag(OBJECT_SELF); 23 | string sEncounterTag = GetStringRight(sTriggerTag, GetStringLength(sTriggerTag) - 3); 24 | object oEncounter = GetNearestObjectByTag(sEncounterTag, OBJECT_SELF); 25 | 26 | eE_RemovePlayerFromArray(oEncounter, oPC); 27 | 28 | //SendMessageToPC(oPC, "You left the area of [" + eE_GetEncounterName(oEncounter) + "]. There are " + IntToString(eE_GetPlayerCountFromArray(oEncounter)) + " active players left."); 29 | 30 | // When there are no more players left and the encounter is in progress, this is a wipe 31 | if ((eE_GetPlayerCountFromArray(oEncounter) == 0) && (eE_GetEncounterStatus(oEncounter) == eE_ENCOUNTER_STATUS_INPROGRESS)) 32 | { 33 | float fDespawn = GetLocalFloat(oEncounter, eE_VAR_DESPAWNINTERVAL); 34 | SendMessageToPC(oPC, "You are the last player that left the encounter area. You have " + FloatToString(fDespawn, 0, 2) + " seconds to return to the encounter area and prevent a wipe."); 35 | AssignCommand(GetModule(), DelayCommand(fDespawn, ExecuteScript(eE_SCRIPT_ENCOUNTER_WIPE, oEncounter))); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/chr_cfg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // chr_cfg 3 | // written by: eyesolated 4 | // written at: April 13, 2018 5 | // 6 | // Notes: Configuration Script for XP related stuff 7 | 8 | ///////////////////// 9 | // Drop Configuration 10 | ///////////////////// 11 | 12 | // Defines the maximum amount of gold to drop in a backpack, surplus is destroyed 13 | const int CHR_DROP_GOLDMAXIMUM = 30000; 14 | 15 | // Define if inventory items should drop 16 | const int CHR_DROP_ITEMS = TRUE; // Filter on which items in chr_inc 17 | 18 | // Only Items with the following Variable set to 1 will be dropped 19 | const string CHR_DROP_VARIABLE = "DropOnDying"; 20 | 21 | //////////////////////// 22 | // OnDying Configuration 23 | //////////////////////// 24 | 25 | // The base chance to recover 26 | const int CHR_RECOVERY_CHANCE_BASE = 5; 27 | 28 | // Enable Constitution Bonus extending OnDying beyond -10 29 | // This works only if the base game is changed via NWNX!!! 30 | const int CHR_DEATH_CONSTITUTION_BONUS_ENABLED = FALSE; 31 | 32 | // The multiplier for CON Ability Bonus that is added to the base Chance 33 | // If this is 2 and CON Bonus is 3, the resuling modifier = +6 34 | const int CHR_RECOVERY_CHANCE_MODIFIER_CONSTITUTION = 1; 35 | 36 | const float CHR_BLEED_INTERVAL = 12.0f; 37 | 38 | const string CHR_RECOVERY_MESSAGE = "You have recovered from your wounds."; 39 | const string CHR_DYING_MESSAGE = "You slip closer to death..."; 40 | 41 | ////////////////////////////// 42 | // Rest Surprise Configuration 43 | ////////////////////////////// 44 | 45 | const int CHR_REST_SURPRISE_CHANCE = 66; // Chance to be surprised - set to 0 to deactivate 46 | const int CHR_REST_SURPRISE_MONSTERS_MAX = 3; 47 | const int CHR_REST_SURPRISE_GUARDS_NEEDED = 1; 48 | 49 | const int CHR_REST_INTERVAL_HOURS = 6; 50 | 51 | //////////////////////////////////// 52 | // Internal Constants, do not touch! 53 | //////////////////////////////////// 54 | const string CHR_AFK_VAR_STATUS = "chr_AFK"; 55 | const string CHR_AFK_VAR_PLACEABLE = "chr_AFKPlac"; 56 | const string CHR_AFK_EFFECTTAG = "chr_Effect"; 57 | 58 | const string CHR_ROLL_VAR_CURRENTLYCHECKING = "chr_CheckActive"; 59 | 60 | const string CS_ROLLS_VAR_PRIVACY = "chr_RollPrivacy"; 61 | const int CHR_ROLL_PRIVACY_PUBLIC = 0; 62 | const int CHR_ROLL_PRIVACY_PRIVATE = 1; 63 | 64 | const string CHR_NEARDEATH_VAR_MESSAGE = "chr_ndmessage"; 65 | const string CHR_NEARDEATH_MESSAGE = "You are near death and cannot run."; 66 | 67 | const string CHR_REST_VAR_NEARBYHEALER = "chr_Rest_NearbyHealer"; 68 | const string CHR_REST_VAR_HITPOINTS_BEFORE_REST = "chr_Rest_HPBeforeRest"; 69 | const string CHR_REST_VAR_REST_CANCELLED_BY_SCRIPT = "chr_Rest_CancelledScript"; 70 | const string CHR_REST_VAR_REST_TIME = "chr_Rest_Time"; 71 | const string CHR_REST_VAR_REST_YEAR = "chr_Rest_Year"; 72 | const string CHR_REST_VAR_REST_MONTH = "chr_Rest_Month"; 73 | const string CHR_REST_VAR_REST_DAY = "chr_Rest_Day"; 74 | const string CHR_REST_VAR_REST_HOUR = "chr_Rest_Hour"; 75 | const string CHR_REST_VAR_FOOD_TAG = "chr_Rest_FoodEaten"; 76 | const string CHR_REST_VAR_FOOD_QUEUE = "chr_Rest_FoodQueue"; 77 | 78 | const string CHR_PCITEM_RESREF = "pc_actionwand"; 79 | const string CHR_PCITEM_TAG = "pc_actionwand"; 80 | 81 | /////////////////////////// 82 | // Chat related config 83 | /////////////////////////// 84 | 85 | // How many last messages to track 86 | const int CHR_CHAT_MESSAGE_BUFFER_SIZE = 10; 87 | -------------------------------------------------------------------------------- /core/chr_update_all.nss: -------------------------------------------------------------------------------- 1 | #include "chr_inc" 2 | #include "sql_inc" 3 | #include "xp_inc" 4 | 5 | void main() 6 | { 7 | object oPC = GetFirstPC(); 8 | while (oPC != OBJECT_INVALID) 9 | { 10 | if (GetIsDM(oPC)) 11 | { 12 | oPC = GetNextPC(); 13 | continue; 14 | } 15 | // Skip players that just logged in 16 | if (!GetLocalInt(oPC, "SANITY_CHECK_AREA_ENTER")) 17 | { 18 | RemoveFromParty(oPC); 19 | string sArea = GetTag(GetArea(oPC)); 20 | if (sArea != "ADream" && !(FindSubString(sArea, "Fugue") >= 0)) 21 | sql_UpdatePC(chr_GetPCID(oPC), GetLocation(oPC), GetCurrentHitPoints(oPC), GetXP(oPC)); 22 | } 23 | 24 | // if (!GetLocalInt(oPC, CHR_AFK_VAR_STATUS)) // AFK players don't get XP 25 | { 26 | int nAFKTimer = GetLocalInt(oPC, "XP_AFK_TIMER"); 27 | int bAFK = TRUE; 28 | 29 | location loc = GetLocation(oPC); 30 | location locOld = GetLocalLocation(oPC, "XP_LAST_LOCATION"); 31 | if (loc != locOld) 32 | { 33 | SetLocalLocation(oPC, "XP_LAST_LOCATION", loc); 34 | bAFK = FALSE; 35 | } 36 | 37 | string sLastMsg = chr_GetPlayerChatMessage(oPC); 38 | string sLastStoredMsg = GetLocalString(oPC, "XP_LAST_CHAT_MESSAGE"); 39 | if (sLastMsg != sLastStoredMsg) 40 | { 41 | bAFK = FALSE; 42 | SetLocalString(oPC, "XP_LAST_CHAT_MESSAGE", sLastMsg); 43 | } 44 | 45 | if (bAFK) 46 | { 47 | if (--nAFKTimer <= 0) 48 | { 49 | SendMessageToPC(oPC, "You are AFK and no longer gain XP."); 50 | nAFKTimer = 0; 51 | } 52 | } 53 | else 54 | { 55 | nAFKTimer = 10; 56 | SendMessageToPC(oPC, "Thank you for roleplaying"); 57 | xp_GiveXP(oPC, nAFKTimer, XP_TYPE_TIMED); 58 | } 59 | SetLocalInt(oPC, "XP_AFK_TIMER", nAFKTimer); 60 | } 61 | xp_SyncToDatabase(oPC); 62 | oPC = GetNextPC(); 63 | } 64 | WriteTimestampedLogEntry("Character update complete"); 65 | } 66 | -------------------------------------------------------------------------------- /core/datetime_cfg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // datetime_cfg 3 | // written by: eyesolated 4 | // written at: July 29, 2004 5 | // 6 | // Notes: 7 | 8 | const string CS_DATETIME_TABLE = "DateTime"; 9 | 10 | const string CS_DATETIME_ID = "DTC"; 11 | 12 | const string CS_DATETIME_YEAR = "Year"; 13 | const string CS_DATETIME_MONTH = "Month"; 14 | const string CS_DATETIME_DAY = "Day"; 15 | 16 | const string CS_DATETIME_HOUR = "Hour"; 17 | const string CS_DATETIME_MINUTE = "Minute"; 18 | const string CS_DATETIME_SECOND = "Second"; 19 | const string CS_DATETIME_MILLISECOND = "Millisecond"; 20 | 21 | struct STRUCT_DATETIME 22 | { 23 | int Year; 24 | int Month; 25 | int Day; 26 | int Hour; 27 | int Minute; 28 | int Second; 29 | int Millisecond; 30 | }; 31 | 32 | // Variables for local setting of dates 33 | const string CS_VAR_DATETIME_YEAR = "datetime_yea"; 34 | const string CS_VAR_DATETIME_MONTH = "datetime_mon"; 35 | const string CS_VAR_DATETIME_DAY = "datetime_day"; 36 | const string CS_VAR_DATETIME_HOUR = "datetime_hou"; 37 | const string CS_VAR_DATETIME_MINUTE = "datetime_min"; 38 | const string CS_VAR_DATETIME_SECOND = "datetime_ses"; 39 | const string CS_VAR_DATETIME_MILLISECOND = "datetime_mil"; 40 | -------------------------------------------------------------------------------- /core/datetime_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // datetime_ini 3 | // written by: eyesolated 4 | // written at: July 29, 2004 5 | // 6 | // Notes: The initialization script for the Date/Time System 7 | 8 | ///////////// 9 | // Includes 10 | // 11 | #include "datetime_inc" 12 | 13 | //////////// 14 | // Functions 15 | // 16 | void main() 17 | { 18 | if (!datetime_LoadDateTime()) 19 | { 20 | datetime_CreateTable(); 21 | datetime_SaveCurrentDateTime(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/events/anph_area_enter.nss: -------------------------------------------------------------------------------- 1 | #include "dbg_inc" 2 | #include "faction_inc" 3 | 4 | void main() 5 | { 6 | object oArea = OBJECT_SELF; 7 | object oPC = GetEnteringObject(); 8 | if (!GetIsPC(oPC)) 9 | { 10 | if (GetLocalInt(oArea, "AREA_NO_MONSTERS")) 11 | { 12 | if (GetLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS") && GetIsEncounterCreature(oPC) && !GetIsDMPossessed(oPC)) 13 | DestroyObject(oPC); 14 | } 15 | return; 16 | } 17 | 18 | int bDM = GetIsDM(oPC); 19 | if (!bDM) 20 | { 21 | int nPlayersInArea = GetLocalInt(oArea, "AREA_PLAYER_COUNT"); 22 | SetLocalInt(oArea, "AREA_PLAYER_COUNT", ++nPlayersInArea); 23 | 24 | if (GetLocalInt(oArea, "AREA_EXPLORED")) 25 | ExploreAreaForPlayer(oArea, oPC); 26 | 27 | 28 | if (nPlayersInArea == 1) // first one in, reset AIs for non-despawned creatures 29 | { 30 | if (GetLocalInt(oArea, "AREA_AI_LOWERED")) 31 | { 32 | object oCreature = GetFirstObjectInArea(oArea); 33 | while (oCreature != OBJECT_INVALID) 34 | { 35 | if (GetIsEncounterCreature(oCreature) && !GetIsDMPossessed(oCreature) && !GetPlotFlag(oCreature)) 36 | { 37 | SetAILevel(oCreature, AI_LEVEL_DEFAULT); 38 | } 39 | oCreature = GetNextObjectInArea(oArea); 40 | } 41 | DeleteLocalInt(oArea, "AREA_AI_LOWERED"); 42 | } 43 | } 44 | 45 | if (nPlayersInArea > 1) 46 | { 47 | if (GetLocalInt(oArea, "AREA_NEUTRAL_ZONE")) 48 | { 49 | object oOtherPC = GetFirstPC(); 50 | while (oOtherPC != OBJECT_INVALID) 51 | { 52 | if (oPC != oOtherPC && GetArea(oOtherPC) == OBJECT_SELF && !GetIsDM(oOtherPC)) 53 | { 54 | SetPCLike(oPC, oOtherPC); 55 | SetPCLike(oOtherPC, oPC); 56 | } 57 | oOtherPC = GetNextPC(); 58 | } 59 | } 60 | } 61 | } 62 | 63 | 64 | // Update PC in database after every transition 65 | if (!bDM) 66 | { 67 | DelayCommand(0.2, ExecuteScript("sql_update_pc", oPC)); 68 | ExportSingleCharacter(oPC); 69 | } 70 | 71 | // Execute eE's OnAreaEnter Script 72 | ExecuteScript("ee_area_onenter", oArea); 73 | 74 | // Does nothing, but let's keep for now.. 75 | DeleteLocalInt(oPC, "FromFugue"); 76 | DeleteLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS"); 77 | } 78 | -------------------------------------------------------------------------------- /core/events/anph_area_exit.nss: -------------------------------------------------------------------------------- 1 | #include "faction_inc" 2 | void main() 3 | { 4 | object oArea = OBJECT_SELF; 5 | object oPC = GetExitingObject(); 6 | SetLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS", 1); 7 | 8 | if (!GetIsPC(oPC)) 9 | return; 10 | 11 | if (!GetIsDM(oPC)) 12 | { 13 | int nPlayerCount = GetLocalInt(oArea, "AREA_PLAYER_COUNT"); 14 | SetLocalInt(oArea, "AREA_PLAYER_COUNT", --nPlayerCount); 15 | if (nPlayerCount == 0) 16 | { 17 | string sOldScript = GetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT); 18 | if (sOldScript != "") 19 | SetLocalString(oArea, "AREA_HEARTBEAT_SCRIPT", sOldScript); 20 | SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, "anph_area_hb"); 21 | } 22 | } 23 | 24 | if (GetLocalInt(oArea, "AREA_NEUTRAL_ZONE")) 25 | { 26 | int nFaction = fctn_GetFaction(oPC); 27 | object oOtherPC = GetFirstPC(); 28 | while (oOtherPC != OBJECT_INVALID) 29 | { 30 | if (oPC != oOtherPC && GetArea(oOtherPC) == OBJECT_SELF && !GetIsDM(oOtherPC)) 31 | { 32 | if (fctn_GetIsFactionHostile(nFaction, fctn_GetFaction(oOtherPC))) 33 | { 34 | SetPCDislike(oPC, oOtherPC); 35 | SetPCDislike(oOtherPC, oPC); 36 | } 37 | } 38 | oOtherPC = GetNextPC(); 39 | } 40 | } 41 | 42 | // Execute eE's OnAreaExit Script 43 | ExecuteScript("ee_area_onexit", oArea); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/events/anph_area_hb.nss: -------------------------------------------------------------------------------- 1 | #include "faction_inc" 2 | void main() 3 | { 4 | object oArea = OBJECT_SELF; 5 | string sOldScript = GetLocalString(oArea, "AREA_HEARTBEAT_SCRIPT"); 6 | 7 | int nPlayerCount = GetLocalInt(oArea, "AREA_PLAYER_COUNT"); 8 | if (nPlayerCount == 0) 9 | { 10 | int nHB = GetLocalInt(oArea, "AREA_HEARTBEAT_COUNT"); 11 | if (nHB >= 50) // 5 minutes till depop 12 | { 13 | SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, sOldScript); 14 | object oCreature = GetFirstObjectInArea(oArea); 15 | while (oCreature != OBJECT_INVALID) 16 | { 17 | if (GetIsEncounterCreature(oCreature) && !GetIsDMPossessed(oCreature) && !GetPlotFlag(oCreature)) 18 | { 19 | if ((GetStandardFactionReputation(STANDARD_FACTION_HOSTILE, oCreature) >= 90) || 20 | fctn_GetFaction(oCreature) == ANPH_FACTION_NONE) 21 | { 22 | DestroyObject(oCreature); 23 | } 24 | else 25 | { 26 | SetLocalInt(oArea, "AREA_AI_LOWERED", 1); 27 | SetAILevel(oCreature, AI_LEVEL_VERY_LOW); 28 | } 29 | } 30 | oCreature = GetNextObjectInArea(oArea); 31 | } 32 | } 33 | else 34 | { 35 | SetLocalInt(oArea, "AREA_HEARTBEAT_COUNT", nHB+1); 36 | } 37 | } 38 | else 39 | { 40 | SetLocalInt(oArea, "AREA_HEARTBEAT_COUNT", 0); 41 | SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, sOldScript); 42 | } 43 | ExecuteScript(sOldScript, oArea); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/events/mod_onactivate.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onactivate 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnActivate Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "datetime_inc" 13 | #include "dlg_inc" 14 | #include "eas_inc" 15 | #include "color_inc" 16 | #include "chr_inc" 17 | #include "esm_inc" 18 | 19 | /////////////////////// 20 | // Function Declaration 21 | // 22 | 23 | //////////////// 24 | // Function Code 25 | // 26 | 27 | void main() 28 | { 29 | SetLocalInt(OBJECT_SELF, "CURRENT_SCRIPT", EVENT_SCRIPT_MODULE_ON_ACTIVATE_ITEM); 30 | // Call the current script 31 | ExecuteScript("hc_on_act_item", OBJECT_SELF); 32 | 33 | object oActivated = GetItemActivated(); 34 | object oActivator = GetItemActivator(); 35 | object oTarget = GetItemActivatedTarget(); 36 | location lTargetLocation = GetItemActivatedTargetLocation(); 37 | 38 | string sTag = GetTag(oActivated); 39 | 40 | if (sTag == "pc_actionwand") 41 | dlg_StartConversation("dlg_wand", oActivator, oActivator, oActivated); 42 | 43 | // Check if Food should be queued 44 | chr_QueueFood(oActivator, oActivated); 45 | 46 | // Call ESM 47 | esm_OnActivateItem(oActivator, oActivated, oTarget, lTargetLocation); 48 | 49 | // Tag based scripting if available 50 | string sExtraScript = GetLocalString(oActivated, "ON_ACTIVATE_ITEM_SCRIPT"); 51 | if (sExtraScript != "") 52 | ExecuteScript(sExtraScript, OBJECT_SELF); 53 | 54 | DeleteLocalInt(OBJECT_SELF, "CURRENT_SCRIPT"); 55 | } 56 | -------------------------------------------------------------------------------- /core/events/mod_onchat.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onchat 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnPlayerChat Event 7 | #include "eas_inc" 8 | #include "color_inc" 9 | #include "esm_inc" 10 | #include "dbg_inc" 11 | #include "chr_inc" 12 | #include "nwnx_webhook" 13 | #include "dev_inc" 14 | 15 | const string WEBHOOK_DM = "/api/webhooks/451344020606812161/th1si5n0tar43lAPiK3y-n3v3rPuTaPiKEY5inS0urceRep0_Y_amIap0tat0lalalaF/slack"; 16 | 17 | void main() 18 | { 19 | SetLocalInt(OBJECT_SELF, "CURRENT_SCRIPT", EVENT_SCRIPT_MODULE_ON_PLAYER_CHAT); 20 | object oPC = GetPCChatSpeaker(); 21 | string sMessage = GetPCChatMessage(); 22 | int nVolume = GetPCChatVolume(); 23 | int bTeam = dev_IsTeamMember(oPC); 24 | 25 | // Call esm OnPlayerChat 26 | esm_OnPlayerChat(oPC, sMessage); 27 | 28 | if (nVolume == TALKVOLUME_SHOUT && !bTeam) 29 | { 30 | SetPCChatMessage(""); 31 | } 32 | string sParam; 33 | 34 | // OOC talk 35 | if (GetStringLeft(sMessage, 2) == "//" || GetStringLeft(sMessage, 2) == "((") 36 | { 37 | SetPCChatMessage(COLOR_CODE_ORANGE + sMessage + COLOR_CODE_END); 38 | } 39 | else if (GetStringLeft(sMessage, 1) == "/") 40 | { 41 | ExecuteScript("chat_commands", OBJECT_SELF); 42 | } 43 | 44 | chr_LogPlayerChatMessage(oPC, sMessage); 45 | if (nVolume == TALKVOLUME_TALK || nVolume == TALKVOLUME_WHISPER) 46 | if (!chr_GetPlayerCanSpeak(oPC)) 47 | SetPCChatMessage(""); 48 | 49 | // DM commands start with # (to match ## builtins) 50 | if (GetStringLeft(sMessage, 1) == "#" && bTeam) 51 | ExecuteScript("dev_commands", OBJECT_SELF); 52 | 53 | 54 | if (nVolume == TALKVOLUME_PARTY && !bTeam) 55 | { 56 | SendMessageToPC(oPC, "Party chat has been disabled"); 57 | SetPCChatMessage(""); 58 | } 59 | 60 | if (nVolume == TALKVOLUME_SILENT_SHOUT) 61 | { 62 | NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_DM, sMessage, GetSubString(GetName(oPC), 0, 20)); 63 | } 64 | 65 | object oOther = GetLocalObject(oPC, "SPEAK_THROUGH_OTHER"); 66 | if (GetIsObjectValid(oOther)) 67 | { 68 | AssignCommand(oOther, SpeakString(sMessage, nVolume)); 69 | SetPCChatMessage(""); 70 | } 71 | 72 | string sExtraScript = GetLocalString(oPC, "ON_PLAYER_CHAT_SCRIPT"); 73 | if (sExtraScript != "") 74 | ExecuteScript(sExtraScript, OBJECT_SELF); 75 | 76 | DeleteLocalInt(OBJECT_SELF, "CURRENT_SCRIPT"); 77 | } 78 | -------------------------------------------------------------------------------- /core/events/mod_onclleave.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onclleave 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnClientLeave Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "color_inc" 13 | #include "chr_inc" 14 | #include "nwnx_time" 15 | #include "sql_inc" 16 | #include "anph_inc" 17 | /////////////////////// 18 | // Function Declaration 19 | // 20 | 21 | 22 | 23 | //////////////// 24 | // Function Code 25 | // 26 | 27 | void main() 28 | { 29 | object oPC = GetExitingObject(); 30 | 31 | // NWNX will handle the DB update, but need to update playtime 32 | int jointime = GetLocalInt(oPC, "CLIENT_ENTER_TIME"); 33 | int playtime = jointime ? (NWNX_Time_GetTimeStamp() - jointime) : 0; 34 | sql_SetPCOnline(chr_GetPCID(oPC), FALSE, playtime); 35 | 36 | chr_OnPlayerExit(oPC); 37 | 38 | string sExitMsg = color_ConvertString("PLAYER EXIT", COLOR_RED) + ": " + anph_DescribePC(oPC); 39 | sExitMsg += " - Played for " + IntToString(playtime) + " seconds"; 40 | WriteTimestampedLogEntry(sExitMsg); 41 | SendMessageToAllDMs(sExitMsg); 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /core/events/mod_oncutabort.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_oncutabot 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnCutsceneAbort Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | 13 | 14 | 15 | 16 | /////////////////////// 17 | // Function Declaration 18 | // 19 | 20 | 21 | 22 | //////////////// 23 | // Function Code 24 | // 25 | 26 | void main() 27 | { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/events/mod_ondeath.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_ondeath 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnPlayerDeath Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "datetime_inc" 13 | #include "chr_inc" 14 | #include "chr_death_inc" 15 | #include "nwnx_object" 16 | /////////////////////// 17 | // Function Declaration 18 | // 19 | 20 | //////////////// 21 | // Function Code 22 | // 23 | 24 | void main() 25 | { 26 | object oPC = GetLastPlayerDied(); 27 | object oLastHostileActor = GetLastHostileActor(); 28 | 29 | if (GetLocalInt(oLastHostileActor, "FACTION_SPARRING_MODE")) 30 | { 31 | ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPC); 32 | NWNX_Object_SetCurrentHitPoints(oPC, 1); 33 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY,SupernaturalEffect(EffectKnockdown()),oPC,RoundsToSeconds(2)); 34 | return; 35 | } 36 | 37 | // Drop the player's backpack if he isn't in a safe location 38 | object oNoFugue = GetNearestObjectByTag("noFugue", oPC); 39 | if (!GetIsObjectValid(oNoFugue)) 40 | chr_Drop_Backpack(oPC); 41 | 42 | // Call Death 43 | chr_Death_OnDeath(oPC, oLastHostileActor); 44 | } 45 | -------------------------------------------------------------------------------- /core/events/mod_ondying.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_ondying 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnPlayerDying Event 7 | 8 | /////////// 9 | // Constants 10 | // 11 | 12 | /////////// 13 | // Includes 14 | // 15 | #include "anph_inc" 16 | #include "chr_death_inc" 17 | 18 | /////////////////////// 19 | // Function Declaration 20 | // 21 | 22 | // 23 | 24 | //////////////// 25 | // Function Code 26 | // 27 | 28 | 29 | void main() 30 | { 31 | object oPC = GetLastPlayerDying(); 32 | 33 | // Get the hostile entity that killed oPC 34 | object oHostile = GetLastHostileActor(oPC); 35 | if (GetIsObjectValid(GetMaster(oHostile))) 36 | oHostile = GetMaster(oHostile); 37 | 38 | if (GetLocalInt(oHostile, "FACTION_SPARRING_MODE")) 39 | { 40 | ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(1 - GetCurrentHitPoints(oPC)),oPC); 41 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY,SupernaturalEffect(EffectKnockdown()),oPC,RoundsToSeconds(2)); 42 | return; 43 | } 44 | 45 | // Remember the hostile actor 46 | SetLocalObject(oPC, "LastHostileActor", oHostile); 47 | if ((GetIsPC(oHostile) || 48 | GetIsPC(GetMaster(oHostile)) || 49 | !GetIsObjectValid(oHostile) || 50 | GetName(oHostile) == "" 51 | ) 52 | ) 53 | { 54 | if (AnphGetPlayerTeam(oPC) != AnphGetPlayerTeam(oHostile)) 55 | SetLocalInt(oPC, "PvPDeath", 1); 56 | else if (AnphGetPlayerTeam(oPC) != AnphGetPlayerTeam(GetMaster(oHostile)) && 57 | GetIsPC(GetMaster(oHostile))) 58 | SetLocalInt(oPC, "PvPDeath", 1); 59 | } 60 | 61 | // Unsummon a possible Associate of oPC 62 | object oFam = GetAssociate (ASSOCIATE_TYPE_FAMILIAR, oPC); 63 | if (GetIsObjectValid (oFam)) 64 | RemoveSummonedAssociate (oPC, oFam); 65 | 66 | // Drop the player's backpack if he isn't in a safe location 67 | object oNoFugue = GetNearestObjectByTag("noFugue", oPC); 68 | if (!GetIsObjectValid(oNoFugue)) 69 | chr_Drop_Backpack(oPC); 70 | 71 | int nth = 1; 72 | object oOther = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPC, nth, 73 | CREATURE_TYPE_IS_ALIVE, TRUE); 74 | while (oOther != OBJECT_INVALID) 75 | { 76 | if (oOther != oPC) 77 | { 78 | if (GetDistanceBetween(oPC, oOther) <= 100.0) 79 | { 80 | effect eDR = EffectDamageReduction(10, DAMAGE_POWER_PLUS_ONE, 50); 81 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDR, oPC, 30.0); 82 | } 83 | break; 84 | } 85 | oOther = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPC, ++nth, 86 | CREATURE_TYPE_IS_ALIVE, TRUE); 87 | } 88 | 89 | // Start bleeding 90 | DelayCommand(CHR_BLEED_INTERVAL, chr_Death_OnDying_Bleed(oPC)); 91 | } 92 | -------------------------------------------------------------------------------- /core/events/mod_onequip.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onequip 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnEquip Event 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "x2_inc_itemprop" 12 | 13 | /////////////////////// 14 | // Function Declaration 15 | // 16 | 17 | //////////////// 18 | // Function Code 19 | // 20 | #include "nwnx_player" 21 | #include "color_inc" 22 | 23 | void main() 24 | { 25 | object oItem = GetPCItemLastEquipped(); 26 | object oPC = GetPCItemLastEquippedBy(); 27 | 28 | if (GetIsInCombat(oPC)) 29 | { 30 | int i; 31 | for (i = 0; i <= INVENTORY_SLOT_BOLTS; i++) 32 | { 33 | if (GetItemInSlot(i, oPC) == oItem) 34 | { 35 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY,SupernaturalEffect(EffectSlow()),oPC,1.5); 36 | NWNX_Player_StartGuiTimingBar(oPC, 1.5, ""); 37 | } 38 | } 39 | } 40 | 41 | // Does the item have class restrictions and the PCs UMD score is below 15? 42 | int nUMD = GetSkillRank(SKILL_USE_MAGIC_DEVICE, oPC); 43 | if (!GetIsDM(oPC) && 44 | nUMD < 15 && 45 | GetItemHasItemProperty(oItem, ITEM_PROPERTY_USE_LIMITATION_CLASS)) 46 | { 47 | // How many classes does oPC have? 48 | int nClassCount = 1; 49 | if (GetLevelByPosition(3, oPC) != 0) 50 | nClassCount = 3; 51 | else if (GetLevelByPosition(2, oPC) != 0) 52 | nClassCount = 2; 53 | 54 | // The coming checks are only needed if the player has levels in more 55 | // than one class 56 | if (nClassCount > 1) 57 | { 58 | itemproperty ip = GetFirstItemProperty(oItem); 59 | int nClass; 60 | int nLevels_Total = GetHitDice(oPC); 61 | int nLevels_Class; 62 | int nAllowUse = 0; 63 | int nHighestClassMatch = FALSE; 64 | int nClass_Restrictions = 0; 65 | 66 | while (GetIsItemPropertyValid(ip)) 67 | { 68 | if (GetItemPropertyType(ip) == ITEM_PROPERTY_USE_LIMITATION_CLASS) 69 | { 70 | nClass_Restrictions++; 71 | 72 | // What class is this item restricted for? 73 | nClass = GetItemPropertySubType(ip); 74 | 75 | // Retrieve the Levels the player has in the given class 76 | nLevels_Class = GetLevelByClass(nClass, oPC); 77 | 78 | // If the character has no levels in nClass, he must be using UMD 79 | // OR have another class that is restricted on the item, so this 80 | // restriction gets an OK! 81 | if (nLevels_Class == 0) 82 | nAllowUse++; 83 | // If nClass is the highest Class of the player, 84 | // this item gets an OK immediately! 85 | else if (IntToFloat(nLevels_Total) / IntToFloat(nClassCount) <= IntToFloat(nLevels_Class)) 86 | { 87 | nHighestClassMatch = TRUE; 88 | break; 89 | } 90 | } 91 | ip = GetNextItemProperty(oItem); 92 | } 93 | 94 | if (!nHighestClassMatch && 95 | nAllowUse < nClass_Restrictions) 96 | { 97 | AssignCommand(oPC, ClearAllActions(TRUE)); 98 | AssignCommand(oPC, ActionUnequipItem(oItem)); 99 | SendMessageToPC(oPC, "You cannot equip [" + color_Item(GetName(oItem)) + "] due to class restrictions."); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /core/events/mod_onheart.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onheart 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnHeartbeat Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "datetime_inc" 13 | 14 | void main() 15 | { 16 | int hb = GetLocalInt(OBJECT_SELF, "MOD_HEARTBEAT"); 17 | 18 | if (hb % 100 == 0) 19 | datetime_SaveCurrentDateTime(); 20 | 21 | if (hb % 20 == 0) 22 | ExecuteScript("chr_update_all", OBJECT_SELF); 23 | 24 | if (hb % 70 == 0) 25 | ExportAllCharacters(); 26 | 27 | SetLocalInt(OBJECT_SELF, "MOD_HEARTBEAT", hb+1); 28 | } 29 | -------------------------------------------------------------------------------- /core/events/mod_onlevelup.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onlevelup 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnLevelUp Event 7 | 8 | /////////// 9 | // Includes 10 | // 11 | 12 | /////////////////////// 13 | // Function Declaration 14 | // 15 | 16 | //////////////// 17 | // Function Code 18 | // 19 | 20 | #include "sql_inc" 21 | #include "dbg_inc" 22 | #include "chr_inc" 23 | #include "util_inc" 24 | #include "nwnx_creature" 25 | /* 26 | int GetLevelUpClass(object oPC) 27 | { 28 | int level = util_GetLevel(oPC); 29 | int nClass1 = GetClassByPosition(1, oPC); 30 | int nClass2 = GetClassByPosition(2, oPC); 31 | int nClass3 = GetClassByPosition(3, oPC); 32 | int nLevel1 = GetLevelByPosition(1, oPC); 33 | int nLevel2 = GetLevelByPosition(2, oPC); 34 | int nLevel3 = GetLevelByPosition(3, oPC); 35 | 36 | if (level == 2) 37 | return nClass2 == CLASS_TYPE_INVALID ? nClass1 : nClass2; 38 | 39 | if (level == 3) 40 | { 41 | if (nClass3 != CLASS_TYPE_INVALID) 42 | return nClass3; 43 | return (nLevel2 > nLevel1) ? nClass2 : nClass1; 44 | } 45 | 46 | string sQuery = "SELECT COUNT(*) FROM "+SQL_TABLE_LEVELUPS+" WHERE PCID="+IntToString(chr_GetPCID(oPC))+" AND ClassTaken="; 47 | 48 | if ((nLevel1-1) > SQLExecAndFetchInt(sQuery+IntToString(nClass1))) 49 | return nClass1; 50 | 51 | if (nClass2 != CLASS_TYPE_INVALID && nLevel2 > SQLExecAndFetchInt(sQuery+IntToString(nClass2))) 52 | return nClass2; 53 | 54 | if (nClass3 != CLASS_TYPE_INVALID && nLevel3 > SQLExecAndFetchInt(sQuery+IntToString(nClass3))) 55 | return nClass3; 56 | 57 | dbg_ReportBug("PC leveled in unknown class?", oPC); 58 | return CLASS_TYPE_INVALID; 59 | } 60 | 61 | */ 62 | void main() 63 | { 64 | object oPC = GetPCLevellingUp(); 65 | int nLevel = util_GetLevel(oPC); 66 | 67 | int nINT = GetAbilityScore(oPC, ABILITY_INTELLIGENCE, TRUE); 68 | int nMaxBankedSkillPoints = max(1, 1+(nINT - 10)/2); 69 | if (NWNX_Creature_GetSkillPointsRemaining(oPC) > nMaxBankedSkillPoints) 70 | { 71 | int nXP = GetXP(oPC); 72 | SetXP(oPC, util_GetXPByLevel(nLevel) - 1); 73 | DelayCommand(0.5, SetXP(oPC, nXP)); 74 | SendMessageToPC(oPC, "You can only leave " + IntToString(nMaxBankedSkillPoints) + " skill points unspent at level up."); 75 | return; 76 | } 77 | 78 | NWNX_SQL_ExecuteQuery("INSERT INTO "+SQL_TABLE_LEVELUPS+" (PCID, Level, ClassTaken) VALUES("+ 79 | IntToString(chr_GetPCID(oPC)) +","+ IntToString(nLevel) +","+IntToString(NWNX_Creature_GetClassByLevel(oPC, nLevel)) + ")"); 80 | 81 | 82 | if (GetCreatureWingType(oPC) != CREATURE_WING_TYPE_NONE) 83 | SetCreatureWingType(CREATURE_WING_TYPE_NONE, oPC); 84 | 85 | if (GetHasFeat(FEAT_DRAGON_IMMUNE_FIRE, oPC)) 86 | { 87 | NWNX_Creature_RemoveFeat(oPC, FEAT_DRAGON_IMMUNE_FIRE); 88 | NWNX_Creature_AddFeatByLevel(oPC, FEAT_EPIC_ENERGY_RESISTANCE_ELECTRICAL_10, nLevel); 89 | } 90 | NWNX_Creature_RemoveFeat(oPC, FEAT_PALADIN_SUMMON_MOUNT); 91 | 92 | } 93 | -------------------------------------------------------------------------------- /core/events/mod_onrespawn.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onrespawn 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnRespawn Event 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "nw_i0_plot" 13 | 14 | /////////////////////// 15 | // Function Declaration 16 | // 17 | 18 | 19 | 20 | //////////////// 21 | // Function Code 22 | // 23 | 24 | void main() 25 | { 26 | object oRespawner = GetLastRespawnButtonPresser(); 27 | } 28 | -------------------------------------------------------------------------------- /core/events/mod_onrest.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onrest 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnRest Event 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "datetime_inc" 12 | #include "dlg_inc" 13 | #include "chr_inc" 14 | /////////////////////// 15 | // Function Declaration 16 | // 17 | 18 | //////////////// 19 | // Function Code 20 | // 21 | 22 | void main() 23 | { 24 | object oPC = GetLastPCRested(); 25 | int nRestEvent = GetLastRestEventType(); 26 | 27 | // Call the OnRest function in chr_inc 28 | chr_OnRest(oPC, nRestEvent); 29 | } 30 | -------------------------------------------------------------------------------- /core/events/mod_onunequip.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onunequip 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Placeholder for the module-wide OnUnEquip Event 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "x2_inc_itemprop" 12 | 13 | /////////////////////// 14 | // Function Declaration 15 | // 16 | 17 | //////////////// 18 | // Function Code 19 | // 20 | 21 | void main() 22 | { 23 | object oItem = GetPCItemLastUnequipped(); 24 | object oPC = GetPCItemLastUnequippedBy(); 25 | string tag = GetTag(oItem); 26 | } 27 | -------------------------------------------------------------------------------- /core/events/mod_onuserdef.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // mod_onuserdef 3 | // written by: eyesolated 4 | // written at: March 31, 2015 5 | // 6 | // Notes: This script handles all UserDefined Events of the Module 7 | void main() 8 | { 9 | /* 10 | object oMod = GetModule(); 11 | int iEvent = GetUserDefinedEventNumber(); 12 | switch (iEvent) 13 | { 14 | default: 15 | return; 16 | break; 17 | } 18 | SignalEvent(oMod, EventUserDefined(iEvent + 1));*/ 19 | } 20 | -------------------------------------------------------------------------------- /core/events/pc_onheart.nss: -------------------------------------------------------------------------------- 1 | #include "util_inc" 2 | #include "nwnx_creature" 3 | 4 | void main() 5 | { 6 | object oPC = OBJECT_SELF; 7 | int nMovementType = NWNX_Creature_GetMovementType(oPC); 8 | 9 | int nRunCounter = GetLocalInt(oPC, "PC_RUN_COUNTER"); 10 | if (nMovementType == NWNX_CREATURE_MOVEMENT_TYPE_RUN) 11 | { 12 | nRunCounter++; 13 | if (nRunCounter > 4) 14 | { 15 | SendMessageToPC(oPC, "You've been running for a while now. Please don't run without reason."); 16 | if (nRunCounter % 10 == 0) 17 | { 18 | SendMessageToAllDMs(GetName(oPC) + " has been running for " + IntToString(nRunCounter) + " ticks."); 19 | } 20 | } 21 | SetLocalInt(oPC, "PC_RUN_COUNTER", nRunCounter); 22 | return; // Bail early since you can't run if encumbered. 23 | } 24 | else if (nRunCounter > 0) 25 | { 26 | SetLocalInt(oPC, "PC_RUN_COUNTER", --nRunCounter); 27 | } 28 | 29 | // Not moving at all nor fighting, carry on.. 30 | int bInCombat = GetIsInCombat(oPC); 31 | if (nMovementType == NWNX_CREATURE_MOVEMENT_TYPE_STATIONARY && !bInCombat) 32 | return; 33 | 34 | int nWeight = GetWeight(oPC); 35 | int nSTR = GetAbilityScore(oPC, ABILITY_STRENGTH); 36 | int nLightEnc = StringToInt(Get2DAString("encumbrance", "Normal", nSTR)); 37 | 38 | // Not running, not encumbered, carry on.. 39 | if (nWeight < nLightEnc) 40 | return; 41 | 42 | int nFallChance = 0; 43 | int nHeavyEnc = StringToInt(Get2DAString("encumbrance", "Heavy", nSTR)); 44 | 45 | int bSidestep = nMovementType == NWNX_CREATURE_MOVEMENT_TYPE_SIDESTEP; 46 | if (bSidestep) 47 | nFallChance += 15; 48 | 49 | int nExtra = nWeight - nHeavyEnc - 30; 50 | if (nExtra > 0) 51 | { 52 | int nPercent = (nExtra*100) / nHeavyEnc; 53 | nPercent = min(99, nPercent); 54 | 55 | nFallChance += nPercent/2; 56 | if (bSidestep) 57 | nFallChance += 25; 58 | if (bInCombat) 59 | nFallChance += 10; 60 | } 61 | 62 | if (nFallChance > 0) 63 | { 64 | int nRoll = Random(100); 65 | if (nRoll < nFallChance) 66 | { 67 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY, SupernaturalEffect(EffectKnockdown()), oPC, 3.0); 68 | string sMessage = "Due to your heavy load"; 69 | if (bInCombat) sMessage += " and combat"; 70 | if (bSidestep) sMessage += " and sidestepping"; 71 | sMessage += " you slip and fall to the ground."; 72 | SendMessageToPC(oPC, sMessage); 73 | } 74 | else if (nRoll + 20 < nFallChance) 75 | { 76 | SendMessageToPC(oPC, "You slip but manage to keep your balance."); 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /core/events/xevent_examine_a.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_events" 2 | #include "nwnx_object" 3 | #include "color_inc" 4 | 5 | // OnExamine BEFORE event 6 | void main() 7 | { 8 | object oPC = OBJECT_SELF; 9 | if (!GetIsPC(oPC)) 10 | return; 11 | 12 | object oExamined = NWNX_Object_StringToObject(NWNX_Events_GetEventData("EXAMINEE_OBJECT_ID")); 13 | if (!GetIsObjectValid(oExamined)) 14 | return; 15 | 16 | string sOldDesc = GetLocalString(oExamined, "XEVENT_EXAMINE_DESC"); 17 | SetDescription(oExamined, sOldDesc); 18 | } 19 | -------------------------------------------------------------------------------- /core/events/xevent_examine_b.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_events" 2 | #include "nwnx_object" 3 | #include "color_inc" 4 | 5 | // OnExamine BEFORE event 6 | void main() 7 | { 8 | object oPC = OBJECT_SELF; 9 | if (!GetIsPC(oPC)) 10 | return; 11 | 12 | object oExamined = NWNX_Object_StringToObject(NWNX_Events_GetEventData("EXAMINEE_OBJECT_ID")); 13 | if (!GetIsObjectValid(oExamined)) 14 | return; 15 | 16 | string sOldDesc = GetDescription(oExamined); 17 | SetLocalString(oExamined, "XEVENT_EXAMINE_DESC", sOldDesc); 18 | 19 | string sEffects = "\n\n" + COLOR_CODE_VIOLET + "Magical effects:\n"; 20 | 21 | sEffects += "You are unable to spot any magical effects on this object"; 22 | 23 | sEffects += COLOR_CODE_END; 24 | SetDescription(oExamined, sOldDesc + sEffects); 25 | } 26 | -------------------------------------------------------------------------------- /core/events/xevent_joinparty.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_events" 2 | #include "nwnx_time" 3 | #include "nwnx_object" 4 | #include "sql_inc" 5 | #include "faction_inc" 6 | 7 | 8 | const int TELEPORT_INTERVAL_SECONDS = 300; // 5 minute teleport cooldown 9 | void main() 10 | { 11 | object oPC = OBJECT_SELF; 12 | if (!GetIsPC(oPC)) 13 | return; 14 | 15 | DelayCommand(3.0, RemoveFromParty(oPC)); 16 | 17 | object oJumpTo = NWNX_Object_StringToObject(NWNX_Events_GetEventData("INVITED_BY")); 18 | if (!GetIsObjectValid(oJumpTo)) 19 | { 20 | oJumpTo = GetFactionLeader(oPC); 21 | if (!GetIsObjectValid(oJumpTo)) 22 | return; 23 | } 24 | 25 | string sDisabled = sql_GetVar("PARTY_TELEPORT_DISABLE"); 26 | if (sDisabled != "") 27 | { 28 | FloatingTextStringOnCreature("Party teleporting is temporarily disabled: " + sDisabled, oPC); 29 | return; 30 | } 31 | if (sql_GetPCDead(chr_GetPCID(oPC)) || GetCurrentHitPoints(oPC) <= 0) 32 | { 33 | FloatingTextStringOnCreature("*You cannot teleport to your party while dead or dying*", oPC); 34 | return; 35 | } 36 | if (GetIsInCombat(oPC)) 37 | { 38 | FloatingTextStringOnCreature("*You cannot teleport to your party while in combat*", oPC); 39 | return; 40 | } 41 | if (fctn_GetFaction(oPC) != fctn_GetFaction(oJumpTo)) 42 | { 43 | FloatingTextStringOnCreature("*You cannot teleport to someone from a different faction*", oPC); 44 | return; 45 | } 46 | 47 | int nTimestamp = NWNX_Time_GetTimeStamp(); 48 | int nTimeTillNextJump = TELEPORT_INTERVAL_SECONDS - (nTimestamp - GetLocalInt(oPC, "LAST_PARTY_JUMP_TIME")); 49 | if (nTimeTillNextJump > 0) 50 | { 51 | FloatingTextStringOnCreature("*You can teleport to a party member again in "+IntToString(nTimeTillNextJump)+" seconds*", oPC, FALSE); 52 | return; 53 | } 54 | 55 | SetLocalInt(oPC, "LAST_PARTY_JUMP_TIME", nTimestamp); 56 | AssignCommand(oPC, ClearAllActions()); 57 | AssignCommand(oPC, JumpToObject(oJumpTo)); 58 | FloatingTextStringOnCreature("*The party teleport is an OOC tool, please use common sense*", oPC); 59 | 60 | WriteTimestampedLogEntry(GetName(oPC) + " has joined the party of " + GetName(oJumpTo) + " and has jumped from " + GetName(GetArea(oPC)) + " to " + GetName(GetArea(oJumpTo))); 61 | } 62 | -------------------------------------------------------------------------------- /core/events/xevent_stealth.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_events" 2 | #include "nwnx_time" 3 | 4 | const int STEALTH_INTERVAL_SECONDS = 12; 5 | void main() 6 | { 7 | object oPC = OBJECT_SELF; 8 | if (!GetIsPC(oPC)) 9 | return; 10 | 11 | int nTimestamp = NWNX_Time_GetTimeStamp(); 12 | int nTimeTillNextStealth = STEALTH_INTERVAL_SECONDS - (nTimestamp - GetLocalInt(oPC, "LAST_STEALTH_TIME")); 13 | if (nTimeTillNextStealth > 0) 14 | { 15 | SetActionMode(oPC, ACTION_MODE_STEALTH, FALSE); 16 | FloatingTextStringOnCreature("*You can enter stealth again in "+IntToString(nTimeTillNextStealth)+" seconds*", oPC, FALSE); 17 | } 18 | else 19 | { 20 | SetLocalInt(oPC, "LAST_STEALTH_TIME", nTimestamp); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/sql_init.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "nwnx_events" 3 | 4 | void main() 5 | { 6 | sql_CreateTables(); 7 | NWNX_Events_SubscribeEvent("NWNX_ON_CLIENT_DISCONNECT_BEFORE", "sql_update_pc"); 8 | } 9 | -------------------------------------------------------------------------------- /core/sql_update_pc.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_events" 2 | #include "sql_inc" 3 | #include "chr_inc" 4 | #include "xp_inc" 5 | 6 | void main() 7 | { 8 | object oPC = OBJECT_SELF; 9 | string sArea = GetTag(GetArea(oPC)); 10 | int nPCID = chr_GetPCID(oPC); 11 | 12 | xp_SyncToDatabase(oPC); 13 | if (sArea != "ADream") // Don't fuck up their location if they're in the dream. 14 | sql_UpdatePC(nPCID, GetLocation(oPC), GetCurrentHitPoints(oPC), GetXP(oPC)); 15 | } 16 | -------------------------------------------------------------------------------- /creature/creature_cfg.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : creature_cfg 3 | * created by : eyesolated 4 | * date : 2018/8/28 5 | * 6 | * description : central configuration file for creature related functions 7 | * 8 | * changes : 2018/8/28 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | const string CREATURE_VAR_LAST_HEALTH_PERCENTAGE_SET = "creature_LastHS"; 12 | 13 | // Bitmask for displaying the various types 14 | const int CREATURE_NAME_DISPLAY_ORIGINAL = 1; 15 | const int CREATURE_NAME_DISPLAY_HEALTH = 2; 16 | const int CREATURE_NAME_DISPLAY_ORIGINAL_HEALTH = 3; 17 | -------------------------------------------------------------------------------- /creature/creature_inc.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : creature_inc 3 | * created by : eyesolated 4 | * date : 2018/8/28 5 | * 6 | * description : central include file for creature related functions 7 | * 8 | * changes : 2018/8/28 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | #include "creature_cfg" 12 | #include "color_inc" 13 | 14 | string creature_GetOriginalName(object oCreature); 15 | 16 | void creature_SetName(object oCreature, int nDisplay = CREATURE_NAME_DISPLAY_ORIGINAL_HEALTH); 17 | 18 | // Retrieves the original Name of oCreature 19 | string creature_GetOriginalName(object oCreature) 20 | { 21 | return GetName(oCreature, TRUE); 22 | } 23 | 24 | void creature_SetName(object oCreature, int nDisplay = CREATURE_NAME_DISPLAY_ORIGINAL_HEALTH) 25 | { 26 | string sName = ""; 27 | 28 | // Original Name 29 | if ((nDisplay & CREATURE_NAME_DISPLAY_ORIGINAL) != 0) 30 | { 31 | sName += creature_GetOriginalName(oCreature); 32 | } 33 | 34 | // Health Percentage 35 | if ((nDisplay & CREATURE_NAME_DISPLAY_HEALTH) != 0) 36 | { 37 | int nMaxHitPoints = GetMaxHitPoints(oCreature); 38 | int nCurrentHitPoints = GetCurrentHitPoints(oCreature); 39 | 40 | float fPercentage = IntToFloat(nCurrentHitPoints) / IntToFloat(nMaxHitPoints) * 100; 41 | int nPercentage = FloatToInt(fPercentage); 42 | if (IntToFloat(nPercentage) < fPercentage) 43 | nPercentage++; 44 | 45 | // If the calculated Percentage is the same as before, return 46 | if (nPercentage != GetLocalInt(oCreature, CREATURE_VAR_LAST_HEALTH_PERCENTAGE_SET)) 47 | { 48 | if (nCurrentHitPoints > 0 && 49 | nPercentage > 0) 50 | { 51 | int nGreen; 52 | int nRed; 53 | 54 | if (nPercentage >= 50) 55 | { 56 | nGreen = 7; 57 | nRed = FloatToInt(IntToFloat(100 - nPercentage) / 7); 58 | } 59 | else 60 | { 61 | nRed = 7; 62 | nGreen = FloatToInt(IntToFloat(nPercentage) / 7); 63 | } 64 | string sColor = IntToString(nRed) + IntToString(nGreen) + "0"; 65 | 66 | if (sName != "") 67 | sName += " - "; 68 | 69 | sName += color_ConvertString(IntToString(nPercentage) + "%", sColor); 70 | SetLocalInt(oCreature, CREATURE_VAR_LAST_HEALTH_PERCENTAGE_SET, nPercentage); 71 | } 72 | } 73 | } 74 | 75 | SetName(oCreature, sName); 76 | } 77 | -------------------------------------------------------------------------------- /creature/lycan_cfg.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : lycan_cfg 3 | * created by : eyesolated 4 | * date : 2018/7/10 5 | * 6 | * description : Central configuration file for Lycanthropy system 7 | ************************************************************************/ 8 | 9 | const string LYCAN_VAR_NIGHT_TURNINTO = "lycan_night_resref"; 10 | const string LYCAN_VAR_DAY_TURNINTO = "lycan_day_resref"; 11 | 12 | const int LYCAN_TURNINTO_NIGHT = 0; 13 | const int LYCAN_TURNINTO_DAY = 1; 14 | -------------------------------------------------------------------------------- /creature/lycan_heartbeat.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : lycan_heartbeat 3 | * created by : eyesolated 4 | * date : 2018/7/10 5 | * 6 | * description : Heartbeat script for Lycanthropes 7 | ************************************************************************/ 8 | #include "lycan_inc" 9 | void main() 10 | { 11 | // Check for Lycanthropy Change 12 | int nTurned = lycan_Check(OBJECT_SELF); 13 | 14 | // Execute standard Heartbeat script if we haven't turned 15 | if (!nTurned) 16 | ExecuteScript("nw_c2_default1", OBJECT_SELF); 17 | } 18 | -------------------------------------------------------------------------------- /creature/lycan_onspawn.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : lycan_onspawn 3 | * created by : eyesolated 4 | * date : 2018/7/10 5 | * 6 | * description : OnSpawn script for Lycanthropes 7 | ************************************************************************/ 8 | #include "lycan_inc" 9 | void main() 10 | { 11 | // Check for Lycanthropy Change 12 | int nTurned = lycan_Check(OBJECT_SELF); 13 | 14 | // Execute standard Heartbeat script 15 | if (!nTurned) 16 | ExecuteScript("nw_c2_default9", OBJECT_SELF); 17 | } 18 | -------------------------------------------------------------------------------- /creature/nw_c2_default1.nss: -------------------------------------------------------------------------------- 1 | //::////////////////////////////////////////////////// 2 | //:: NW_C2_DEFAULT1 3 | /* 4 | Default OnHeartbeat script for NPCs. 5 | 6 | This script causes NPCs to perform default animations 7 | while not otherwise engaged. 8 | 9 | This script duplicates the behavior of the default 10 | script and just cleans up the code and removes 11 | redundant conditional checks. 12 | 13 | */ 14 | //::////////////////////////////////////////////////// 15 | //:: Copyright (c) 2002 Floodgate Entertainment 16 | //:: Created By: Naomi Novik 17 | //:: Created On: 12/22/2002 18 | //::////////////////////////////////////////////////// 19 | 20 | #include "nw_i0_generic" 21 | #include "creature_inc" 22 | 23 | void main() 24 | { 25 | // * if not runnning normal or better Ai then exit for performance reasons 26 | if (GetAILevel() == AI_LEVEL_VERY_LOW) return; 27 | 28 | // Set correct name of creature 29 | creature_SetName(OBJECT_SELF); 30 | 31 | // Buff ourselves up right away if we should 32 | if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY)) 33 | { 34 | // This will return TRUE if an enemy was within 40.0 m 35 | // and we buffed ourselves up instantly to respond -- 36 | // simulates a spellcaster with protections enabled 37 | // already. 38 | if(TalentAdvancedBuff(40.0)) 39 | { 40 | // This is a one-shot deal 41 | SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE); 42 | 43 | // This return means we skip sending the user-defined 44 | // heartbeat signal in this one case. 45 | return; 46 | } 47 | } 48 | 49 | 50 | if(GetHasEffect(EFFECT_TYPE_SLEEP)) 51 | { 52 | // If we're asleep and this is the result of sleeping 53 | // at night, apply the floating 'z's visual effect 54 | // every so often 55 | 56 | if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT)) 57 | { 58 | effect eVis = EffectVisualEffect(VFX_IMP_SLEEP); 59 | if(d10() > 6) 60 | { 61 | ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF); 62 | } 63 | } 64 | } 65 | 66 | // If we have the 'constant' waypoints flag set, walk to the next 67 | // waypoint. 68 | else if ( GetWalkCondition(NW_WALK_FLAG_CONSTANT) ) 69 | { 70 | WalkWayPoints(); 71 | } 72 | 73 | // Check to see if we should be playing default animations 74 | // - make sure we don't have any current targets 75 | else if ( !GetIsObjectValid(GetAttemptedAttackTarget()) 76 | && !GetIsObjectValid(GetAttemptedSpellTarget()) 77 | // && !GetIsPostOrWalking()) 78 | && !GetIsObjectValid(GetNearestSeenEnemy())) 79 | { 80 | if (GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) || GetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE) || 81 | GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE)) 82 | { 83 | // This handles special attacking/fleeing behavior 84 | // for omnivores & herbivores. 85 | DetermineSpecialBehavior(); 86 | } 87 | else if (!IsInConversation(OBJECT_SELF)) 88 | { 89 | if (GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) 90 | || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN) 91 | || GetIsEncounterCreature()) 92 | { 93 | PlayMobileAmbientAnimations(); 94 | } 95 | else if (GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS)) 96 | { 97 | PlayImmobileAmbientAnimations(); 98 | } 99 | } 100 | } 101 | 102 | // Send the user-defined event signal if specified 103 | if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT)) 104 | { 105 | SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT)); 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /dialog/dlg_act_back.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_back 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script fires when the player hits the "Back" button 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | int iOption = 1; 17 | // Get our PC object 18 | object oPC = GetPCSpeaker(); 19 | // What dialog are we using? 20 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 21 | // Get the dialog script 22 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 23 | // What node are we at? 24 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 25 | // Reset the current page? 26 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 27 | // Reset the counter for the evaluation script 28 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 29 | 30 | // Execute the Action Script 31 | struct STRUCT_DLG_NODEINFO strInfo; 32 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + CS_DLG_PREFIX_BACK, iOption); 33 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 34 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 35 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 36 | ExecuteScript(sScript, oPC); 37 | 38 | // Set the new Node we're at 39 | SetLocalString(oPC, CS_DLG_PC_NODE, strInfo.Target); 40 | 41 | // Reset the page 42 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 43 | 44 | // Reset Options 45 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 46 | } 47 | -------------------------------------------------------------------------------- /dialog/dlg_act_exit.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_exit 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script fires when the player hits the "exit" button 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // Delete all variables we used 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // Reset the counter for the evaluation script 27 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 28 | 29 | // Execute the Action Script 30 | struct STRUCT_DLG_NODEINFO strInfo; 31 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + CS_DLG_PREFIX_EXIT, 1); 32 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 33 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 34 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 35 | ExecuteScript(sScript, oPC); 36 | } 37 | -------------------------------------------------------------------------------- /dialog/dlg_act_next.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_next 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script fire when the player hits the "next" option 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "7_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | int iPCOptions = dlg_GetNumberOfPCOptions(iDialogID, sNode); 34 | if (iPCOptions > 8) 35 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + CS_DLG_PREFIX_NEXT, 1); 36 | else 37 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 38 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 39 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 40 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 41 | ExecuteScript(sScript, oPC); 42 | 43 | if (iPCOptions > 8) 44 | { 45 | // Increase Page Count 46 | SetLocalInt(oPC, CS_DLG_PC_PAGE, iPage + 1); 47 | 48 | // Reset the Node 49 | SetLocalString(oPC, CS_DLG_PC_NODE, GetLocalString(oPC, CS_DLG_PC_PARENTNODE)); 50 | } 51 | else 52 | { 53 | // What node did the player click? 54 | if (strInfo.Target != "0") 55 | { 56 | if (strInfo.Target != sNode) 57 | { 58 | sNode = strInfo.Target; 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | if (strInfo.RememberPage) 63 | { 64 | // Remember the current Page 65 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 66 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 67 | } 68 | } 69 | else 70 | { 71 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 72 | 73 | // Remember to reset page number 74 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 75 | } 76 | 77 | // Set the new Node we're at 78 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 79 | 80 | // Reset Options 81 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc01.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_actPC01 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "first" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + IntToString(iPage)); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | // Reset Options 66 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 67 | } 68 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc02.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_actPC02 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "second" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "2_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | // Reset Options 66 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 67 | } 68 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc03.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_actPC03 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "third" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "3_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | 66 | // Reset Options 67 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 68 | } 69 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc04.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_PC04 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "fourth" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "4_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | // Reset Options 66 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 67 | } 68 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc05.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_PC05 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "fifth" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "5_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | // Reset Options 66 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 67 | } 68 | -------------------------------------------------------------------------------- /dialog/dlg_act_pc06.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_PC06 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script is fired when the player selects the "sixth" option in a dialogue 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTION6); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 34 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 35 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 36 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 37 | ExecuteScript(sScript, oPC); 38 | 39 | // What node did the player click? 40 | if (strInfo.Target != "0") 41 | { 42 | if (strInfo.Target != sNode) 43 | { 44 | sNode = strInfo.Target; 45 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 46 | } 47 | 48 | if (strInfo.RememberPage) 49 | { 50 | // Remember the current Page 51 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 52 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 53 | } 54 | } 55 | else 56 | { 57 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 58 | // Remember to reset page number 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | // Set the new Node we're at 63 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 64 | 65 | // Reset Options 66 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 67 | } 68 | -------------------------------------------------------------------------------- /dialog/dlg_act_prev.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_act_prev 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: This script fires when the player hits the "Previous" option 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get our PC object 17 | object oPC = GetPCSpeaker(); 18 | // What dialog are we using? 19 | int iDialogID = GetLocalInt(oPC, CS_DLG_PC_DIALOGID); 20 | // Get the dialog script 21 | string sScript = GetLocalString(oPC, CS_DLG_PC_SCRIPT); 22 | // What node are we at? 23 | string sNode = GetLocalString(oPC, CS_DLG_PC_NODE); 24 | // What's the current page? 25 | int iPage = GetLocalInt(oPC, CS_DLG_PC_PAGE); 26 | // What's this option? 27 | int iOption = GetLocalInt(oPC, CS_DLG_PC_OPTIONX + "8_"); 28 | // Reset the counter for the evaluation script 29 | SetLocalInt(oPC, CS_DLG_PC_TOKEN, 0); 30 | 31 | // Execute the Action Script 32 | struct STRUCT_DLG_NODEINFO strInfo; 33 | int iPCOptions = dlg_GetNumberOfPCOptions(iDialogID, sNode); 34 | if (iPCOptions > 8) 35 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + CS_DLG_PREFIX_PREVIOUS, 1); 36 | else 37 | strInfo = dlg_GetNodeInfo(iDialogID, sNode + "P", iOption); 38 | SetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID, -1); 39 | SetLocalInt(oPC, CS_DLG_PC_ACTION_ID, strInfo.Action); 40 | SetLocalString(oPC, CS_DLG_PC_NODETEXT, strInfo.Text); 41 | ExecuteScript(sScript, oPC); 42 | 43 | if (iPCOptions > 8) 44 | { 45 | // Decrease Page Count 46 | SetLocalInt(oPC, CS_DLG_PC_PAGE, iPage - 1); 47 | 48 | // Reset the Node 49 | SetLocalString(oPC, CS_DLG_PC_NODE, GetLocalString(oPC, CS_DLG_PC_PARENTNODE)); 50 | } 51 | else 52 | { 53 | // What node did the player click? 54 | if (strInfo.Target != "0") 55 | { 56 | if (strInfo.Target != sNode) 57 | { 58 | sNode = strInfo.Target; 59 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 60 | } 61 | 62 | if (strInfo.RememberPage) 63 | { 64 | // Remember the current Page 65 | SetLocalString(oPC, CS_DLG_PC_NODE_BACKUP, sNode); 66 | SetLocalInt(oPC, CS_DLG_PC_PAGE_BACKUP, iPage); 67 | } 68 | } 69 | else 70 | { 71 | sNode = sNode + CS_DLG_PREFIX_PC + IntToString (iOption); 72 | // Remember to reset page number 73 | SetLocalInt(oPC, CS_DLG_PC_PAGE, 0); 74 | } 75 | 76 | // Set the new Node we're at 77 | SetLocalString(oPC, CS_DLG_PC_NODE, sNode); 78 | 79 | // Reset Options 80 | SetLocalInt(oPC, CS_DLG_PC_FIRSTOPTIONFORPAGE + "0", 1); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /dialog/dlg_cfg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_cfg 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Configuration File for the Dialogue System 7 | 8 | // Use NWNX? 9 | const int CI_DLG_USE_NWNX = TRUE; 10 | 11 | const string CS_DLG_INI_USERDEFINEDEVENTNUMBER = "DLG_EVENTID"; 12 | const int CI_DLG_NUMBEROFDIALOGOBJECTS = 5; 13 | const string CS_DLG_MAINTABLE = "dlg_Dialogs"; 14 | const string CS_DLG_CONTENTTABLE = "dlg_DialogContents"; 15 | const string CS_DLG_DIALOGOBJECT = "dlg_DialogObject"; 16 | 17 | // Variables stored on the PC 18 | const string CS_DLG_PC_DIALOGID = "dlg_PC_ID"; 19 | const string CS_DLG_PC_OVERRIDE = "dlg_PC_Override"; 20 | const string CS_DLG_OVERRIDETEXT = "dlg_OverrideText"; 21 | const string CS_DLG_PC_NODE = "dlg_PC_Node"; 22 | const string CS_DLG_PC_NODE_BACKUP = "dlg_PC_Node_Backup"; 23 | const string CS_DLG_PC_PAGE = "dlg_PC_Page"; 24 | const string CS_DLG_PC_PAGE_BACKUP = "dlg_PC_Page_Backup"; 25 | const string CS_DLG_PC_DIALOGOBJECT = "dlg_PC_Object"; 26 | const string CS_DLG_PC_TOKEN = "dlg_PC_Token"; 27 | const string CS_DLG_PC_SCRIPT = "dlg_PC_Script"; 28 | const string CS_DLG_PC_CONDITIONAL_ID = "dlg_PC_Conditional"; 29 | const string CS_DLG_PC_ACTION_ID = "dlg_PC_Action"; 30 | const string CS_DLG_PC_RESULT = "dlg_PC_Result"; 31 | const string CS_DLG_PC_PARENTNODE = "dlg_PC_ParentNode"; 32 | const string CS_DLG_PC_FIRSTOPTIONFORPAGE = "dlg_PC_fopt_"; 33 | const string CS_DLG_PC_CURRENTOPTIONFORPAGE = "dlg_PC_lopt_"; 34 | const string CS_DLG_PC_OPTION1 = "dlg_PC_opt1_"; 35 | const string CS_DLG_PC_OPTIONX = "dlg_PC_opt"; 36 | const string CS_DLG_PC_OPTION6 = "dlg_PC_opt6_"; 37 | const string CS_DLG_PC_NODETEXT = "dlg_PC_NodeText"; 38 | const string CS_DLG_PC_CONVERSATIONNPC = "dlg_PC_NPC"; 39 | const string CS_DLG_PC_ADDITIONALOBJECT = "dlg_PC_addObject"; 40 | 41 | // Dialog Structure 42 | struct STRUCT_DLG_INFO 43 | { 44 | int ID; 45 | string Tag; 46 | string Description; 47 | }; 48 | 49 | struct STRUCT_DLG_NODEINFO 50 | { 51 | string Text; 52 | int Condition; 53 | int Action; 54 | string Target; 55 | int RememberPage; 56 | }; 57 | 58 | // Main Table 59 | const string CS_DLG_ID = "DLG_ID"; 60 | const string CS_DLG_TAG = "TAG"; 61 | const string CS_DLG_DESCRIPTION = "Description"; 62 | 63 | // Dialog Content Table 64 | const string CS_DLG_INDEX = "Node"; 65 | const string CS_DLG_OPTION = "OptionID"; 66 | const string CS_DLG_TEXT = "Textstring"; 67 | const string CS_DLG_CONDITIONAL_ID = "Conditional"; 68 | const string CS_DLG_ACTION_ID = "ActionTaken"; 69 | const string CS_DLG_TARGETNODE = "TargetNode"; 70 | const string CS_DLG_REMEMBERPAGE = "RememberPage"; 71 | 72 | // Some various variables 73 | const string CS_DLG_PREFIX_NPC = "N"; 74 | const string CS_DLG_PREFIX_PC = "P"; 75 | const string CS_DLG_PREFIX_NEXT = "NE"; 76 | const string CS_DLG_PREFIX_PREVIOUS = "PR"; 77 | const string CS_DLG_PREFIX_BACK = "B"; 78 | const string CS_DLG_PREFIX_EXIT = "E"; 79 | 80 | const int CI_DLG_FIRSTTOKEN = 17000; 81 | 82 | // Variables stored on the module in case we don't use NWNX 83 | const string CS_DLG_MOD_DIALOGCOUNT = "dlg_Count"; 84 | const string CS_DLG_MOD_PREFIX = "dlg_DLG_"; // This will be the Identifier of the Dialogue 85 | const string CS_DLG_MOD_ID = "dlg_ID_"; 86 | const string CS_DLG_MOD_TAG = "dlg_TAG_"; 87 | const string CS_DLG_MOD_DESCRIPTION = "dlg_DESC_"; 88 | const string CS_DLG_MOD_NODE = "dlg_NODE_"; 89 | -------------------------------------------------------------------------------- /dialog/dlg_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_ini 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: Initialization File for the Dialogue System 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "dlg_inc" 12 | #include "x3_inc_string" 13 | 14 | //#include "god_inc" 15 | 16 | //////////////// 17 | // Function Code 18 | // 19 | 20 | void Log(object oLog, string sDialog) 21 | { 22 | SetDescription(oLog, GetDescription(oLog) + "\nDLG_ - inserted '" + sDialog + "'"); 23 | WriteTimestampedLogEntry("DLG - '" + sDialog + "' inserted to DB"); 24 | } 25 | 26 | void Init(object oMod, object oLog, string sDialogScript) 27 | { 28 | ExecuteScript(sDialogScript, oMod); 29 | Log(oLog, sDialogScript); 30 | } 31 | 32 | void InitAll(object oLog) 33 | { 34 | object oMod = GetModule(); 35 | 36 | DelayCommand(0.1, Init(oMod, oLog, "dlg_lgs_ini")); 37 | DelayCommand(0.1, Init(oMod, oLog, "dlg_store_ini")); 38 | DelayCommand(0.1, Init(oMod, oLog, "dlg_wand_ini")); 39 | DelayCommand(0.1, Init(oMod, oLog, "dlg_model_ini")); 40 | } 41 | 42 | void main() 43 | { 44 | // If all tables exist, do not (re)initialize 45 | object oLog = GetObjectByTag("LOG"); 46 | if (dlg_GetTablesExist()) 47 | { 48 | SetDescription(oLog, GetDescription(oLog) + "\nDLG - database already exists."); 49 | WriteTimestampedLogEntry("DLG - database already exists - skipping initialization."); 50 | return; 51 | } 52 | 53 | // Drop any existing tables 54 | dlg_DropTables(); 55 | 56 | // Create Tables 57 | dlg_CreateTables(); 58 | 59 | // Initialize table content 60 | DelayCommand(0.1, InitAll(oLog)); 61 | } 62 | -------------------------------------------------------------------------------- /dialog/dlg_start.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_start 3 | // written by: eyesolated 4 | // written at: March 31, 2015 5 | // 6 | // Notes: Starts a conersation between the PC and the object calling this script 7 | // If the caller is an NPC, this will be a normal conversation. 8 | // If the caller is an object, the PC will talk to himself. 9 | // 10 | // The conversation that will be started needs to be saved on the 11 | // calling object as a string variable named "DLG" 12 | #include "dlg_inc" 13 | 14 | void main() 15 | { 16 | // Get the type of the calling instance 17 | object oPC; 18 | object oConversationPartner; 19 | int Caller_Type = GetObjectType(OBJECT_SELF); 20 | if (Caller_Type == OBJECT_TYPE_CREATURE) 21 | { 22 | oPC = GetLastSpeaker(); 23 | oConversationPartner = OBJECT_SELF; 24 | } 25 | else 26 | { 27 | oPC = GetLastUsedBy(); 28 | oConversationPartner = oPC; 29 | } 30 | 31 | string sDialog = GetLocalString(OBJECT_SELF, "DLG"); 32 | dlg_StartConversation(sDialog, oConversationPartner, oPC); 33 | } 34 | -------------------------------------------------------------------------------- /dialog/dlgx_mark_select.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_dialog" 2 | void main() 3 | { 4 | object oPC = GetPCSpeaker(); 5 | SetLocalString(oPC, "DLGX_LAST_SELECTION", NWNX_Dialog_GetCurrentNodeText()); 6 | SetLocalInt(oPC, "DLGX_LAST_SELECTION_INDEX", NWNX_Dialog_GetCurrentNodeIndex()); 7 | // save current text in some local 8 | } 9 | -------------------------------------------------------------------------------- /dialog/intro/intro_deity.nss: -------------------------------------------------------------------------------- 1 | #include "chr_inc" 2 | // [Change Deity] 3 | void main() 4 | { 5 | object oPC = GetPCSpeaker(); 6 | string sMsg = chr_GetPlayerChatMessage(oPC); 7 | SendMessageToPC(oPC, "Old Deity:" + GetDeity(oPC) + "; New Deity:" + sMsg); 8 | SetDeity(oPC, sMsg); 9 | } 10 | -------------------------------------------------------------------------------- /dialog/intro/intro_enter.nss: -------------------------------------------------------------------------------- 1 | #include "faction_inc" 2 | #include "subrace_inc" 3 | 4 | 5 | int checkAlignment(object oPC, int faction) 6 | { 7 | int goodevil = GetAlignmentGoodEvil (oPC); 8 | int lawchaos = GetAlignmentLawChaos (oPC); 9 | if (faction == ANPH_FACTION_AXFELL) 10 | { 11 | if (goodevil == ALIGNMENT_GOOD && lawchaos == ALIGNMENT_LAWFUL) 12 | { 13 | SendMessageToPC(oPC, "Lawful good characters are not allowed in Axfell"); 14 | return FALSE; 15 | } 16 | } 17 | 18 | if (faction == ANPH_FACTION_CLEAVEN) 19 | { 20 | if (goodevil == ALIGNMENT_EVIL && lawchaos == ALIGNMENT_CHAOTIC) 21 | { 22 | SendMessageToPC(oPC, "Chaotic Evil characters are not allowed in Cleaven"); 23 | return FALSE; 24 | } 25 | } 26 | return TRUE; 27 | } 28 | 29 | int checkClass(object oPC, int faction) 30 | { 31 | return TRUE; 32 | } 33 | 34 | int checkRace(object oPC, int faction) 35 | { 36 | int race = GetRacialType(oPC); 37 | string subrace = GetSubRace(oPC); 38 | 39 | if (faction == ANPH_FACTION_CLEAVEN) 40 | { 41 | if (FindSubString("Drow###Duergar###Dark Elf###Gray Dwarf###Grey Dwarf###Deep Gnome###Svirfneblin", subrace) > 0) 42 | { 43 | SendMessageToPC(oPC, "Underdark race characters are not allowed in Cleaven"); 44 | return FALSE; 45 | } 46 | } 47 | return TRUE; 48 | } 49 | 50 | void giveStartingGear(object oPC, int faction) 51 | { 52 | CreateItemOnObject("FoodRation", oPC); 53 | CreateItemOnObject("FoodRation", oPC); 54 | CreateItemOnObject("FoodRation", oPC); 55 | CreateItemOnObject("FoodRation", oPC); 56 | CreateItemOnObject("FoodRation", oPC); 57 | CreateItemOnObject("FoodRation", oPC); 58 | GiveGoldToCreature(oPC, 140); 59 | 60 | // Give druids Ear of the Druid 61 | /* if(GetLevelByClass(CLASS_TYPE_DRUID, oPC) > 0 && !GetIsObjectValid(GetItemPossessedBy(oPC, "DruidEar"))) 62 | { 63 | CreateItemOnObject("DruidEar", oPC); 64 | }*/ 65 | /* 66 | if (GetXP(oPC) < 3000) 67 | GiveXPToCreature(oPC, 3001 - GetXP(oPC));*/ 68 | 69 | } 70 | void main() 71 | { 72 | object oPC = GetPCSpeaker(); 73 | string sSubrace = GetSubRace(oPC); 74 | 75 | string sFaction = GetLocalString(oPC, "INTRO_FACTION"); 76 | int faction = fctn_GetFactionIdFromName(sFaction); 77 | if (faction == 0) 78 | { 79 | dbg_ReportBug("No faction found with name " + sFaction); 80 | return; 81 | } 82 | 83 | if (!checkAlignment(oPC, faction)) 84 | return; 85 | if (!checkClass(oPC, faction)) 86 | return; 87 | if (!checkRace(oPC, faction)) 88 | return; 89 | 90 | giveStartingGear(oPC, faction); 91 | 92 | fctn_JoinFaction(oPC, faction); 93 | 94 | if (sSubrace != "") 95 | { 96 | // No return statements after this. 97 | if (subrace_Apply(oPC, sSubrace)) 98 | { 99 | SendMessageToPC(oPC, "Subrace bonuses applied"); 100 | } 101 | else 102 | { 103 | dbg_ReportBug("No subrace stats found for " + sSubrace, oPC); 104 | } 105 | } 106 | 107 | ExportSingleCharacter(oPC); 108 | location loc = fctn_GetFactionStartingLocation(faction); 109 | AssignCommand (oPC, JumpToLocation(loc)); 110 | } 111 | -------------------------------------------------------------------------------- /dialog/intro/intro_faction.nss: -------------------------------------------------------------------------------- 1 | #include "faction_inc" 2 | #include "sql_inc" 3 | #include "nwnx_dialog" 4 | // [Select] or "Select faction" 5 | void main() 6 | { 7 | object oPC = GetPCSpeaker(); 8 | 9 | if (NWNX_Dialog_GetCurrentNodeText() == "[Select]") 10 | { 11 | SetLocalString(oPC, "INTRO_FACTION", GetLocalString(oPC, "DLGX_LAST_SELECTION")); 12 | } 13 | SetCustomToken(5552, GetLocalString(oPC, "INTRO_FACTION")); 14 | 15 | NWNX_SQL_ExecuteQuery("SELECT Faction, COUNT(*) FROM " + SQL_TABLE_CHARDATA + " WHERE IsOnline=1 GROUP BY Faction"); 16 | 17 | string sMessage = "There are currently\n"; 18 | while (NWNX_SQL_ReadyToReadNextRow()) 19 | { 20 | NWNX_SQL_ReadNextRow(); 21 | 22 | string faction = fctn_GetFactionName(StringToInt(NWNX_SQL_ReadDataInActiveRow(0))); 23 | if (faction == "None") continue; 24 | 25 | string count = NWNX_SQL_ReadDataInActiveRow(1); 26 | sMessage += ".) " + count + " " + faction + "\n"; 27 | } 28 | 29 | sMessage = sMessage + "\nonline. If you have any doubts on which side to join, it is best to pick the one with fewer warriors"; 30 | SetCustomToken(5550, sMessage); 31 | } 32 | -------------------------------------------------------------------------------- /dialog/intro/intro_scale.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_dialog" 2 | // +1% or something 3 | // "Scaling" 4 | void main() 5 | { 6 | object oPC = GetPCSpeaker(); 7 | string sText = NWNX_Dialog_GetCurrentNodeText(); 8 | 9 | float fScale = GetObjectVisualTransform(oPC, OBJECT_VISUAL_TRANSFORM_SCALE); 10 | if (GetStringRight(sText, 1) == "%") 11 | { 12 | float fMod = StringToFloat(GetStringLeft(sText, 2)); 13 | fScale += fMod * 0.01; 14 | if (fScale > 1.2) fScale = 1.2; 15 | else if (fScale < 0.8) fScale = 0.8; 16 | 17 | SetObjectVisualTransform(oPC, OBJECT_VISUAL_TRANSFORM_SCALE, fScale); 18 | } 19 | SetCustomToken(5551, FloatToString(fScale * 100.0, 3, 0) + "%"); 20 | } 21 | -------------------------------------------------------------------------------- /dialog/intro/intro_subrace.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "nwnx_dialog" 3 | // [Select] or "Select faction" 4 | void main() 5 | { 6 | object oPC = GetPCSpeaker(); 7 | string sSubrace = GetLocalString(oPC, "DLGX_LAST_SELECTION"); 8 | 9 | SendMessageToPC(oPC, "Old SubRace:" + GetSubRace(oPC) + "; New SubRace:" + sSubrace); 10 | SetSubRace(oPC, sSubrace); 11 | } 12 | -------------------------------------------------------------------------------- /dialog/store/dlg_store.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_example 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: the conditional/action script for the example dialog 7 | 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "eas_inc" 13 | #include "color_inc" 14 | #include "egs_inc" 15 | #include "ip_inc" 16 | #include "dlg_inc" 17 | #include "store_inc" 18 | 19 | /////////////////////// 20 | // Function Declaration 21 | // 22 | 23 | //////////////// 24 | // Function Code 25 | // 26 | 27 | void main() 28 | { 29 | object oPC = OBJECT_SELF; 30 | object oNPC = GetLocalObject(oPC, CS_DLG_PC_CONVERSATIONNPC); 31 | int iConditional = GetLocalInt(oPC, CS_DLG_PC_CONDITIONAL_ID); 32 | int iAction = GetLocalInt(oPC, CS_DLG_PC_ACTION_ID); 33 | string sNodeText = GetLocalString(oPC, CS_DLG_PC_NODETEXT); 34 | 35 | 36 | switch (iConditional) 37 | { 38 | case -1: SetLocalInt(oPC, CS_DLG_PC_RESULT, TRUE); break; 39 | } 40 | 41 | switch (iAction) 42 | { 43 | case -1: break; 44 | case 1: ExecuteScript(CS_STORE_SCRIPT_OPEN, oNPC); 45 | break; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /dialog/store/dlg_store_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // dlg_lgs_ini 3 | // written by: eyesolated 4 | // written at: Mar. 16, 2018 5 | // 6 | // Notes: Initialization File for the LGS Dialog 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "dlg_inc" 12 | #include "x3_inc_string" 13 | 14 | //////////////// 15 | // Function Code 16 | // 17 | void main() 18 | { 19 | int iDialog; 20 | int iCount; 21 | string sTopNode; 22 | 23 | iDialog = dlg_CreateDialog("dlg_store", "Generic Store Dialog"); 24 | sTopNode = dlg_AddNPCNode(iDialog, "T", "Welcome.\nWhat can i do for you today?."); 25 | dlg_AddPCNode(iDialog, sTopNode, "Show me your wares.", -1, 1); 26 | dlg_AddExitOption(iDialog, sTopNode, "Nothing"); 27 | } 28 | -------------------------------------------------------------------------------- /factions/anph_go_field.nss: -------------------------------------------------------------------------------- 1 | #include "hc_inc" 2 | #include "anph_inc" 3 | #include "sql_inc" 4 | #include "chr_inc" 5 | #include "faction_inc" 6 | 7 | void main() 8 | { 9 | object oPC = GetLastUsedBy(); 10 | if (GetMaster(oPC) != OBJECT_INVALID || !GetIsPC(oPC)) 11 | return; 12 | 13 | location lJump; 14 | fctn_UpdateReputation(oPC); 15 | 16 | int nPCID = chr_GetPCID(oPC); 17 | int nFaction = fctn_GetFaction(oPC); 18 | 19 | if (sql_GetPCDead(nPCID)) 20 | { 21 | lJump = fctn_GetFactionFugueLocation(nFaction); 22 | WriteTimestampedLogEntry ("Creating corpse for " + GetName (oPC) + ", dead on enter."); 23 | AnphSendCorpseHome(oPC); 24 | } 25 | 26 | else if (GetName(OBJECT_SELF) == "Wake up in the field!") 27 | { 28 | lJump = sql_GetPCLocation(chr_GetPCID(oPC)); 29 | } 30 | else 31 | { 32 | lJump = fctn_GetFactionStartingLocation(nFaction); 33 | } 34 | 35 | AssignCommand (oPC, ClearAllActions ()); 36 | AssignCommand (oPC, JumpToLocation (lJump)); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /factions/anph_team_cnt.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "faction_inc" 3 | 4 | int StartingConditional() 5 | { 6 | NWNX_SQL_ExecuteQuery("SELECT Faction, COUNT(*) FROM " + SQL_TABLE_CHARDATA + " WHERE IsOnline=1 GROUP BY Faction"); 7 | 8 | string sMessage = "There are currently\n"; 9 | while (NWNX_SQL_ReadyToReadNextRow()) 10 | { 11 | NWNX_SQL_ReadNextRow(); 12 | 13 | string faction = fctn_GetFactionName(StringToInt(NWNX_SQL_ReadDataInActiveRow(0))); 14 | if (faction == "None") continue; 15 | 16 | string count = NWNX_SQL_ReadDataInActiveRow(1); 17 | sMessage += ".) " + count + " " + faction + "\n"; 18 | } 19 | 20 | sMessage = sMessage + "\nonline. If you have any doubts on which side to join, it is best to pick the one with fewer warriors"; 21 | SetCustomToken(5550, sMessage); 22 | return TRUE; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /factions/faction_join.nss: -------------------------------------------------------------------------------- 1 | #include "faction_inc" 2 | 3 | 4 | int checkAlignment(object oPC, int faction) 5 | { 6 | int goodevil = GetAlignmentGoodEvil (oPC); 7 | int lawchaos = GetAlignmentLawChaos (oPC); 8 | if (faction == ANPH_FACTION_AXFELL) 9 | { 10 | if (goodevil == ALIGNMENT_GOOD && lawchaos == ALIGNMENT_LAWFUL) 11 | { 12 | SendMessageToPC(oPC, "Lawful good characters are not allowed in Axfell"); 13 | return FALSE; 14 | } 15 | } 16 | 17 | if (faction == ANPH_FACTION_CLEAVEN) 18 | { 19 | if (goodevil == ALIGNMENT_EVIL && lawchaos == ALIGNMENT_CHAOTIC) 20 | { 21 | SendMessageToPC(oPC, "Chaotic Evil characters are not allowed in Cleaven"); 22 | return FALSE; 23 | } 24 | } 25 | return TRUE; 26 | } 27 | 28 | int checkClass(object oPC, int faction) 29 | { 30 | 31 | return TRUE; 32 | } 33 | 34 | int checkRace(object oPC, int faction) 35 | { 36 | int race = GetRacialType(oPC); 37 | string subrace = GetSubRace(oPC); 38 | 39 | if (faction == ANPH_FACTION_CLEAVEN) 40 | { 41 | if (FindSubString("Drow###Duergar###Dark Elf###Gray Dwarf###Grey Dwarf###Deep Gnome###Svirfneblin", subrace) > 0) 42 | { 43 | SendMessageToPC(oPC, "Underdark race characters are not allowed in Cleaven"); 44 | return FALSE; 45 | } 46 | } 47 | return TRUE; 48 | } 49 | 50 | void giveStartingGear(object oPC, int faction) 51 | { 52 | CreateItemOnObject("FoodRation", oPC); 53 | CreateItemOnObject("FoodRation", oPC); 54 | CreateItemOnObject("FoodRation", oPC); 55 | CreateItemOnObject("FoodRation", oPC); 56 | CreateItemOnObject("FoodRation", oPC); 57 | CreateItemOnObject("FoodRation", oPC); 58 | GiveGoldToCreature(oPC, 140); 59 | 60 | // Give druids Ear of the Druid 61 | if(GetLevelByClass(CLASS_TYPE_DRUID, oPC) > 0 && !GetIsObjectValid(GetItemPossessedBy(oPC, "DruidEar"))) 62 | { 63 | CreateItemOnObject("DruidEar", oPC); 64 | } 65 | 66 | if (GetXP(oPC) < 3000) 67 | GiveXPToCreature(oPC, 3001 - GetXP(oPC)); 68 | } 69 | void main() 70 | { 71 | object oPC = GetLastUsedBy(); 72 | if (!GetIsPC(oPC) || GetIsDM(oPC) || GetMaster(oPC) != OBJECT_INVALID) 73 | return; 74 | 75 | string tag = GetTag(OBJECT_SELF); 76 | string factname = GetStringRight(tag, GetStringLength(tag)-4); // join[faction] 77 | int faction = fctn_GetFactionIdFromName(factname); 78 | 79 | if (!checkAlignment(oPC, faction)) 80 | return; 81 | if (!checkClass(oPC, faction)) 82 | return; 83 | if (!checkRace(oPC, faction)) 84 | return; 85 | 86 | giveStartingGear(oPC, faction); 87 | 88 | fctn_JoinFaction(oPC, faction); 89 | location loc = fctn_GetFactionStartingLocation(faction); 90 | AssignCommand (oPC, JumpToLocation(loc)); 91 | } 92 | -------------------------------------------------------------------------------- /loot/egs_tst.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // egs_tst 3 | // written by: eyesolated 4 | // written at: June 17, 2004 5 | // 6 | // Notes: Test script for the EGS 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "eas_inc" 12 | #include "egs_inc" 13 | 14 | void main() 15 | { 16 | object oUser = GetLastUsedBy(); 17 | string sTest = GetTag(OBJECT_SELF); 18 | string sItem; 19 | if (sTest == "Get_ItemAny") 20 | { 21 | SendMessageToPC(oUser, "Testing '" + sTest + "'"); 22 | sItem = egs_GetItem_Any(); 23 | } 24 | else if (sTest == "Get_ItemWeaponMelee") 25 | { 26 | SendMessageToPC(oUser, "Testing '" + sTest + "'"); 27 | sItem = egs_GetItem_WeaponMelee(); 28 | } 29 | else if (sTest == "Get_ItemWeaponTiny") 30 | { 31 | SendMessageToPC(oUser, "Testing '" + sTest + "'"); 32 | sItem = egs_GetItem_Weapon(-1, CI_EGS_WEAPONSIZE_TINY); 33 | } 34 | else if (sTest == "Get_ItemWand") 35 | { 36 | SendMessageToPC(oUser, "Testing '" + sTest + "'"); 37 | sItem = egs_GetItem_Wand(); 38 | } 39 | else if (sTest == "Get_ItemFood") 40 | { 41 | SendMessageToPC(oUser, "Testing '" + sTest + "'"); 42 | sItem = egs_GetRandomItem(CI_EGS_ITEM_MAIN_FOOD); 43 | } 44 | CreateItemOnObject(sItem, oUser); 45 | SendMessageToPC(oUser, "Created Object: '" + sItem + "'"); 46 | } 47 | -------------------------------------------------------------------------------- /loot/ip_ini_b.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // ip_ini 3 | // written by: eyesolated 4 | // written at: April 2, 2015 5 | // 6 | // Notes: IP Initialization w/o NWNX 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "eas_inc" 12 | #include "color_inc" 13 | #include "egs_inc" 14 | #include "ip_inc" 15 | #include "eas_inc" 16 | 17 | const int ITERATION = 20; 18 | void main() 19 | { 20 | object oModule = OBJECT_SELF; 21 | object oStorePreload = GetLocalObject(oModule, CS_IP_DB_PRELOAD_STORE_OBJ); 22 | 23 | int iCurrentPropertyID = GetLocalInt(oModule, CS_IP_ARRAY_INIT); 24 | int iTotalProperties = eas_Array_GetSize(oStorePreload, CS_IP_DB_PRELOAD_ARRAY); 25 | 26 | if (iCurrentPropertyID >= iTotalProperties) 27 | { 28 | object oLog = GetObjectByTag("LOG"); 29 | SetDescription(oLog, GetDescription(oLog) + "\nIP INI B - Item properties store preload finished (" + IntToString(iTotalProperties) + ")."); 30 | WriteTimestampedLogEntry("IP INI B - Item properties store preload finished"); 31 | return; 32 | } 33 | 34 | string sID; 35 | int iProperty; 36 | int iType; 37 | string sCategoriesMain; 38 | string sCategoriesSub; 39 | string sBaseItems; 40 | int iCount; 41 | int iVarOne; 42 | int iVarTwo; 43 | int iVarThree; 44 | int iMonsterOnly; 45 | 46 | int n = iCurrentPropertyID; 47 | while (n < iTotalProperties && 48 | n < iCurrentPropertyID + ITERATION) 49 | { 50 | sID = IntToString(n); 51 | iProperty = GetLocalInt(oStorePreload, CS_IP_ID + sID); 52 | iType = GetLocalInt(oStorePreload, CS_IP_TYPE + sID); 53 | sCategoriesMain = GetLocalString(oStorePreload, CS_IP_CATEGORIES_MAIN + sID); 54 | sCategoriesSub = GetLocalString(oStorePreload, CS_IP_CATEGORIES_SUB + sID); 55 | sBaseItems = GetLocalString(oStorePreload, CS_IP_BASEITEMS + sID); 56 | iCount = GetLocalInt(oStorePreload, CS_IP_LEVEL + sID); 57 | iVarOne = GetLocalInt(oStorePreload, CS_IP_VARONE + sID); 58 | iVarTwo = GetLocalInt(oStorePreload, CS_IP_VARTWO + sID); 59 | iVarThree = GetLocalInt(oStorePreload, CS_IP_VARTHREE + sID); 60 | iMonsterOnly = GetLocalInt(oStorePreload, CS_IP_MONSTERONLY + sID); 61 | ip_AddProperty(iProperty, iType, sCategoriesMain, sCategoriesSub, sBaseItems, iCount, iVarOne, iVarTwo, iVarThree, iMonsterOnly); 62 | 63 | n++; 64 | } 65 | 66 | SetLocalInt(oModule, CS_IP_ARRAY_INIT, n); 67 | DelayCommand(0.1f, ExecuteScript("ip_ini_b", OBJECT_SELF)); 68 | } 69 | -------------------------------------------------------------------------------- /loot/ip_names_cfg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // ip_names_cfg 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: 7 | 8 | const string CS_IPNAMES_INI_USERDEFINEDEVENTNUMBER = "IPNAMES_EVENTID"; 9 | 10 | // Table Name 11 | const string CS_IP_NAMETABLE = "ip_Names"; 12 | 13 | // NonNWNX constants 14 | const string CS_IPNAMES_DB_AREA = "A_EGS"; 15 | const string CS_IPNAMES_DB_WAYPOINT = "WP_EGS"; 16 | const string CS_IPNAMES_DB_MERCHANT_RESREF = "M_EGS"; 17 | const string CS_IPNAMES_DB_MERCHANT_NEWTAG = "M_IPNAMES"; 18 | const string CS_IPNAMES_ARRAY_IP = "IPN_ARR_IP"; 19 | 20 | // Field Names 21 | const string CS_IP_NAME_PROPID = "Property"; 22 | const string CS_IP_NAME_VAR_I = "Variable1"; 23 | const string CS_IP_NAME_VAR_II = "Variable2"; 24 | const string CS_IP_NAME_VAR_III = "Variable3"; 25 | const string CS_IP_NAME_PREFIX_I = "Prefix1"; 26 | const string CS_IP_NAME_PREFIX_II = "Prefix2"; 27 | const string CS_IP_NAME_POSTFIX = "Prefix3"; 28 | const string CS_IP_NAME_LOWLEVEL = "StartLevel"; 29 | const string CS_IP_NAME_HIGHLEVEL = "EndLevel"; 30 | -------------------------------------------------------------------------------- /loot/ip_names_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // ipnames_ini 3 | // written by: eyesolated 4 | // written at: June 17, 2004 5 | // 6 | // Notes: IP Name Initialization 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "eas_inc" 12 | #include "color_inc" 13 | #include "egs_inc" 14 | #include "ip_inc" 15 | #include "eas_inc" 16 | 17 | void InitAll() 18 | { 19 | object oLog = GetObjectByTag("LOG"); 20 | 21 | // Let's setup our properties 22 | ip_InitializeItemNames_01(); 23 | ip_InitializeItemNames_02(); 24 | ip_InitializeItemNames_03(); 25 | ip_InitializeItemNames_04(); 26 | ip_InitializeItemNames_05(); 27 | ip_InitializeItemNames_06(); 28 | ip_InitializeItemNames_07(); 29 | ip_InitializeItemNames_08(); 30 | ip_InitializeItemNames_09(); 31 | 32 | SetDescription(oLog, GetDescription(oLog) + "\nIP - Item Names initialized."); 33 | WriteTimestampedLogEntry("IP - Item Names initialized."); 34 | } 35 | 36 | void main() 37 | { 38 | // If all tables exist, do not (re)initialize 39 | if (ip_GetNameTableExists()) 40 | { 41 | object oLog = GetObjectByTag("LOG"); 42 | SetDescription(oLog, GetDescription(oLog) + "\nIP_Names - database already exists."); 43 | WriteTimestampedLogEntry("IP_Names - database already exists - skipping initialization."); 44 | return; 45 | } 46 | 47 | // Drop any existing tables 48 | ip_DropNameTable(); 49 | 50 | // Create table 51 | ip_CreateNameTable(); 52 | 53 | // Initialize 54 | DelayCommand(0.2, InitAll()); 55 | } 56 | -------------------------------------------------------------------------------- /loot/ip_tst.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // egs_tst 3 | // written by: eyesolated 4 | // written at: June 17, 2004 5 | // 6 | // Notes: Test script for the IP 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "eas_inc" 12 | #include "color_inc" 13 | #include "egs_inc" 14 | #include "ip_inc" 15 | 16 | void main() 17 | { 18 | object oUser = GetLastUsedBy(); 19 | string sTag = GetTag(OBJECT_SELF); 20 | if (sTag == "o_ip_rnditem") 21 | { 22 | string sItem = egs_GetItem_Any(-1, -1, TRUE); 23 | object oItem = CreateItemOnObject(sItem, oUser); 24 | if (!GetIsObjectValid(oItem)) 25 | { 26 | SendMessageToAllDMs("Error creating " + sItem); 27 | return; 28 | } 29 | ip_InfuseItemWithMagic(oItem, 20, TRUE, TRUE); 30 | } 31 | else if (sTag == "o_ip_wand") 32 | { 33 | string sItem = egs_GetItem_Wand(-1, TRUE);//"i_egs_wand01"; 34 | object oItem = CreateItemOnObject(sItem, oUser); 35 | ip_InfuseItemWithMagic(oItem, 50, FALSE, TRUE); 36 | } 37 | else if (sTag == "o_ip_weapon") 38 | { 39 | string sItem = egs_GetItem_Weapon(-1, -1, TRUE); 40 | object oItem = CreateItemOnObject(sItem, oUser); 41 | ip_InfuseItemWithMagic(oItem, 25, FALSE, TRUE); 42 | } 43 | else if (sTag == "o_ip_armor") 44 | { 45 | string sItem = egs_GetItem_Armor(-1, TRUE); 46 | object oItem = CreateItemOnObject(sItem, oUser); 47 | ip_InfuseItemWithMagic(oItem, 20, FALSE, TRUE); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /loot/lgs_chest_ondmg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // lgs_chest_ondmg 3 | // written by: eyesolated 4 | // written at: May 19, 2018 5 | // 6 | // Notes: Deals with bashing in loot chests 7 | 8 | #include "lgs_cfg" 9 | void main() 10 | { 11 | object oChest = OBJECT_SELF; 12 | int nRealMaxHitPoints = GetLocalInt(oChest, CS_LGS_CHEST_VAR_HITPOINTS); 13 | int nCurrentHitPoints = GetCurrentHitPoints(oChest); 14 | int nMaxHitPoints = GetMaxHitPoints(oChest); 15 | 16 | if (!GetPlotFlag(oChest) && 17 | nCurrentHitPoints < (nMaxHitPoints - nRealMaxHitPoints)) // The chest is below it's max hitpoings 18 | { 19 | // Destroy some inventory 20 | object oItem = GetFirstItemInInventory(oChest); 21 | int nBaseItemType; 22 | while (GetIsObjectValid(oItem)) 23 | { 24 | nBaseItemType = GetBaseItemType(oItem); 25 | switch (nBaseItemType) 26 | { 27 | case BASE_ITEM_GOLD: 28 | SetItemStackSize(oItem, GetItemStackSize(oItem) / (Random(3) + 2)); 29 | break; 30 | default: 31 | if (d100() <= 33) 32 | DestroyObject(oItem); 33 | break; 34 | } 35 | oItem = GetNextItemInInventory(oChest); 36 | } 37 | 38 | // Unlock the chest 39 | SetLocked(oChest, FALSE); 40 | 41 | // Make the chest PLOT so it can't be damaged any more 42 | SetPlotFlag(oChest, TRUE); 43 | 44 | // Heal the chest to full 45 | ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nRealMaxHitPoints), oChest); 46 | 47 | // Tell the PC that he broke the lock 48 | SendMessageToPC(GetLastDamager(oChest), "You successfully bashed the lock to pieces."); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /loot/lgs_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // lgs_ini 3 | // written by: eyesolated 4 | // written at: April 27, 2018 5 | // 6 | // Notes: Initialized LGS 7 | 8 | /////////// 9 | // Includes 10 | // 11 | // Needs 12 | #include "ip_inc" 13 | //#include "x0_i0_treasure" 14 | #include "mod_cfg" 15 | #include "lgs_cfg" 16 | 17 | /////////////////////// 18 | // Function Declaration 19 | // 20 | 21 | void main() 22 | { 23 | // Place Chests 24 | int nth = 0; 25 | object oWaypoint = GetObjectByTag(CS_LGS_CHEST_VAR_WAYPOINT, nth); 26 | object oChest; 27 | int nLockDC; 28 | while (GetIsObjectValid(oWaypoint)) 29 | { 30 | oChest = CreateObject(OBJECT_TYPE_PLACEABLE, CS_LGS_CHEST_VAR_RESREF, GetLocation(oWaypoint), FALSE, CS_LGS_CHEST_VAR_RESREF); 31 | 32 | nLockDC = GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_LOCKDC); 33 | // Save Waypoint Variables on Chest 34 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_LOCKCHANCE, GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_LOCKCHANCE)); 35 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_LOCKDC, nLockDC); 36 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_TRAPCHANCE, GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_TRAPCHANCE)); 37 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_TRAPSTRENGTH, GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_TRAPSTRENGTH)); 38 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_TRAPDETECTDC, GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_TRAPDETECTDC)); 39 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_TRAPDISARMDC, GetLocalInt(oWaypoint, CS_LGS_CHEST_VAR_TRAPDISARMDC)); 40 | 41 | // Set the chests hardness and fortitude save 42 | nLockDC -= 20; 43 | if (nLockDC < 5) 44 | nLockDC = 5; 45 | SetHardness(nLockDC , oChest); 46 | SetFortitudeSavingThrow(oChest, nLockDC + 10); 47 | 48 | // Set the chests hitpoints 49 | SetLocalInt(oChest, CS_LGS_CHEST_VAR_HITPOINTS, nLockDC * 3); 50 | 51 | ExecuteScript("lgs_chest_check", oChest); 52 | 53 | nth++; 54 | oWaypoint = GetObjectByTag(CS_LGS_CHEST_VAR_WAYPOINT, nth); 55 | } 56 | 57 | object oLog = GetObjectByTag("LOG"); 58 | SetDescription(oLog, GetDescription(oLog) + "\nLGS - Loot Generation System initialized."); 59 | WriteTimestampedLogEntry("LGS - Loot Generation System initialized"); 60 | } 61 | -------------------------------------------------------------------------------- /persistentchests/psc_chest_distur.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "chr_inc" 3 | #include "dbg_inc" 4 | 5 | void main() 6 | { 7 | object chest = OBJECT_SELF; 8 | object item = GetInventoryDisturbItem(); 9 | int type = GetInventoryDisturbType(); 10 | object pc = GetLastDisturbed(); 11 | 12 | if (type == INVENTORY_DISTURB_TYPE_ADDED) 13 | { 14 | string filter = GetLocalString(chest, "PSC_FILTER_TAGS"); 15 | if (filter != "" && FindSubString(filter, GetTag(item)) < 0) 16 | { 17 | string msg = GetLocalString(chest, "PSC_FILTER_MESSAGE"); 18 | if (msg == "") 19 | msg = "This container accepts only specific items"; 20 | SendMessageToPC(pc, msg); 21 | CopyItem(item, pc, TRUE); 22 | DestroyObject(item); 23 | return; 24 | } 25 | 26 | if (GetBaseItemType(item) == BASE_ITEM_GOLD) 27 | { 28 | SendMessageToPC(pc, "You cannot put gold in these chests"); 29 | int amount = GetItemStackSize(item); 30 | DestroyObject(item); 31 | GiveGoldToCreature(pc, amount); 32 | return; 33 | } 34 | NWNX_SQL_PrepareQuery("INSERT INTO " + SQL_TABLE_STORAGECHESTS + "(Tag,Object,Name,AddedByPCID) VALUES(?,?,?,?)"); 35 | NWNX_SQL_PreparedString(0, GetTag(chest)); 36 | NWNX_SQL_PreparedObjectFull(1, item); 37 | NWNX_SQL_PreparedString(2, GetName(item)); 38 | NWNX_SQL_PreparedInt(3, chr_GetPCID(pc)); 39 | NWNX_SQL_ExecutePreparedQuery(); 40 | 41 | SetLocalInt(item, "PSC_ID", SQLExecAndFetchInt("SELECT MAX(ID) FROM "+ SQL_TABLE_STORAGECHESTS)); 42 | } 43 | else if (type == INVENTORY_DISTURB_TYPE_REMOVED) 44 | { 45 | int id = GetLocalInt(item, "PSC_ID"); 46 | NWNX_SQL_ExecuteQuery("DELETE FROM " + SQL_TABLE_STORAGECHESTS + " WHERE ID="+IntToString(id)); 47 | if (NWNX_SQL_GetAffectedRows() == 0) 48 | { 49 | dbg_ReportBug("Item " + GetName(item) + "(" + GetTag(item) + ") id=" + IntToString(id) + " stack=" + IntToString(GetItemStackSize(item)) + " not found in database.", pc); 50 | } 51 | DeleteLocalInt(item, "PSC_ID"); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /persistentchests/psc_chest_open.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "util_inc" 3 | #include "dbg_inc" 4 | 5 | void main() 6 | { 7 | object chest = OBJECT_SELF; 8 | object oPC = GetLastOpenedBy(); 9 | if (GetLocalInt(chest, "PSC_INITIALIZED")) 10 | return; 11 | 12 | string tag = GetTag(chest); 13 | // Make sure we didn't accidentally place multiple instances 14 | int n = 0; 15 | while (TRUE) 16 | { 17 | object other = GetObjectByTag(tag, n++); 18 | if (other == OBJECT_INVALID) 19 | break; 20 | 21 | if (other != chest) 22 | { 23 | dbg_ReportBug("Duplicate PSC tags found, aborting and destroying", chest); 24 | SendMessageToPC(oPC, "BUG! This chest is not configured properly, it will not work as persistent storage!"); 25 | DestroyObject(OBJECT_SELF); 26 | return; 27 | } 28 | } 29 | 30 | util_ClearInventory(chest); 31 | 32 | NWNX_SQL_PrepareQuery("SELECT ID, Object FROM " + SQL_TABLE_STORAGECHESTS + " WHERE Tag=?"); 33 | NWNX_SQL_PreparedString(0, tag); 34 | NWNX_SQL_ExecutePreparedQuery(); 35 | 36 | while (NWNX_SQL_ReadyToReadNextRow()) 37 | { 38 | NWNX_SQL_ReadNextRow(); 39 | int id = StringToInt(NWNX_SQL_ReadDataInActiveRow(0)); 40 | object item = NWNX_SQL_ReadFullObjectInActiveRow(1, chest); 41 | SetLocalInt(item, "PSC_ID", id); 42 | if (GetBaseItemType(item) == BASE_ITEM_GOLD) 43 | { 44 | int amount = GetItemStackSize(item); 45 | dbg_Warning("Found gold in chest, destroying " + IntToString(amount), chest); 46 | DestroyObject(item); 47 | } 48 | } 49 | 50 | SetLocalInt(chest, "PSC_INITIALIZED", 1); 51 | SendMessageToPC(oPC, "Do not put more than 50000 gold pieces in the chest"); 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /persistentchests/psc_pvt_clenter.nss: -------------------------------------------------------------------------------- 1 | #include "chr_inc" 2 | #include "sql_inc" 3 | 4 | const int PSC_CACHE_ITEMS_IN_ONE_GO = 20; 5 | void PopulateCache(object oCache, string tag, string pcid) 6 | { 7 | int offset = GetLocalInt(oCache, "PSC_CACHE_OFFSET"); 8 | 9 | // Deal with gold first 10 | if (offset == 0) 11 | { 12 | int gold = StringToInt(sql_GetVar("PSC_PVT_" + tag + "_" + pcid + "_GOLD")); 13 | if (gold > 0) 14 | CreateItemOnObject("NW_IT_GOLD001", oCache, gold); 15 | } 16 | 17 | NWNX_SQL_ExecuteQuery("SELECT ID, Object FROM " + SQL_TABLE_PLAYERCHESTS + " WHERE Tag=? AND PCID=" + pcid + 18 | " LIMIT " + IntToString(PSC_CACHE_ITEMS_IN_ONE_GO) + " OFFSET " + IntToString(offset)); 19 | 20 | NWNX_SQL_PreparedString(0, tag); 21 | NWNX_SQL_ExecutePreparedQuery(); 22 | 23 | if (!NWNX_SQL_ReadyToReadNextRow()) // DONE! 24 | { 25 | DeleteLocalInt(oCache, "PSC_CACHE_OFFSET"); 26 | SetLocalInt(oCache, "PSC_CACHE_INITIALIZED", 1); 27 | return; 28 | } 29 | 30 | while (NWNX_SQL_ReadyToReadNextRow()) 31 | { 32 | NWNX_SQL_ReadNextRow(); 33 | int id = StringToInt(NWNX_SQL_ReadDataInActiveRow(0)); 34 | object item = NWNX_SQL_ReadFullObjectInActiveRow(1, oCache); 35 | SetLocalInt(item, "PSC_ID", id); 36 | } 37 | 38 | offset += PSC_CACHE_ITEMS_IN_ONE_GO; 39 | SetLocalInt(oCache, "PSC_CACHE_OFFSET", offset); 40 | 41 | DelayCommand(0.5, PopulateCache(oCache, tag, pcid)); 42 | } 43 | 44 | void InitCache(object oPC, string tag, string pcid) 45 | { 46 | string cachetag = "PSC_CACHE_" + tag + "_" + pcid; 47 | if (GetObjectByTag(cachetag) != OBJECT_INVALID) 48 | return; // already initialized. 49 | 50 | object oWP = GetWaypointByTag("PSC_CACHE_WP"); 51 | if (oWP == OBJECT_INVALID) 52 | oWP = GetWaypointByTag("PSC_CACHE_WP_END"); 53 | 54 | object oCache = CreateObject(OBJECT_TYPE_PLACEABLE, "psc_cache", GetLocation(oWP), FALSE, cachetag); 55 | if (GetTag(oWP) == "PSC_CACHE_WP") 56 | DestroyObject(oWP); 57 | 58 | DelayCommand(0.1, PopulateCache(oCache, tag, pcid)); 59 | } 60 | 61 | void main() 62 | { 63 | object oPC = OBJECT_SELF; 64 | string pcid = IntToString(chr_GetPCID(oPC)); 65 | 66 | NWNX_SQL_ExecuteQuery("SELECT Tag FROM "+SQL_TABLE_PLAYERCHESTS+" WHERE PCID="+pcid); 67 | while (NWNX_SQL_ReadyToReadNextRow()) 68 | { 69 | NWNX_SQL_ReadNextRow(); 70 | string tag = NWNX_SQL_ReadDataInActiveRow(); 71 | InitCache(oPC, tag, pcid); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /persistentchests/psc_pvt_close.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "chr_inc" 3 | #include "dbg_inc" 4 | 5 | void main() 6 | { 7 | object chest = OBJECT_SELF; 8 | object pc = GetLastClosedBy(); 9 | 10 | util_ClearInventory(chest); 11 | DeleteLocalInt(chest, "PSC_PVT_PCID"); 12 | } 13 | -------------------------------------------------------------------------------- /persistentchests/psc_pvt_disturb.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "chr_inc" 3 | #include "dbg_inc" 4 | 5 | void main() 6 | { 7 | object chest = OBJECT_SELF; 8 | object item = GetInventoryDisturbItem(); 9 | int type = GetInventoryDisturbType(); 10 | object pc = GetLastDisturbed(); 11 | string tag = GetTag(chest); 12 | int pcid = chr_GetPCID(pc); 13 | 14 | if (GetObjectType(pc) != OBJECT_TYPE_CREATURE) 15 | return; 16 | 17 | if (pcid != GetLocalInt(chest, "PSC_PVT_PCID")) 18 | { 19 | SendMessageToPC(pc, "Someone else is using this chest, please wait until they are finished."); 20 | if (type == INVENTORY_DISTURB_TYPE_ADDED) 21 | { 22 | CopyItem(item, pc, TRUE); 23 | DestroyObject(item); 24 | } 25 | else if (type == INVENTORY_DISTURB_TYPE_REMOVED) 26 | { 27 | CopyItem(item, pc, TRUE); 28 | DestroyObject(item); 29 | } 30 | return; 31 | } 32 | 33 | string goldvar = "PSC_PVT_" + tag + "_" + IntToString(pcid) + "_GOLD"; 34 | int gold = GetGold(chest); 35 | if (gold != GetLocalInt(chest, goldvar)) 36 | { 37 | SetLocalInt(chest, goldvar, gold); 38 | sql_SetVarInt(goldvar, gold); 39 | return; 40 | } 41 | 42 | if (type == INVENTORY_DISTURB_TYPE_ADDED) 43 | { 44 | NWNX_SQL_PrepareQuery("INSERT INTO " + SQL_TABLE_PLAYERCHESTS + "(Tag,Object,Name,PCID) VALUES(?,?,?,?)"); 45 | NWNX_SQL_PreparedString(0, tag); 46 | NWNX_SQL_PreparedObjectFull(1, item); 47 | NWNX_SQL_PreparedString(2, GetName(item)); 48 | NWNX_SQL_PreparedInt(3, pcid); 49 | NWNX_SQL_ExecutePreparedQuery(); 50 | 51 | SetLocalInt(item, "PSC_ID", SQLExecAndFetchInt("SELECT MAX(ID) FROM "+ SQL_TABLE_PLAYERCHESTS)); 52 | } 53 | else if (type == INVENTORY_DISTURB_TYPE_REMOVED) 54 | { 55 | int id = GetLocalInt(item, "PSC_ID"); 56 | NWNX_SQL_ExecuteQuery("DELETE FROM " + SQL_TABLE_PLAYERCHESTS + " WHERE ID="+IntToString(id) + " AND PCID=" + IntToString(pcid)); 57 | if (NWNX_SQL_GetAffectedRows() == 0) 58 | { 59 | dbg_ReportBug("Item " + GetName(item) + "(" + GetTag(item) + ") id=" + IntToString(id) + " stack=" + IntToString(GetItemStackSize(item)) + " not found in database.", pc); 60 | } 61 | DeleteLocalInt(item, "PSC_ID"); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /persistentchests/psc_pvt_open.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "util_inc" 3 | #include "dbg_inc" 4 | #include "chr_inc" 5 | 6 | void main() 7 | { 8 | object chest = OBJECT_SELF; 9 | object pc = GetLastOpenedBy(); 10 | 11 | if (!GetIsPC(pc) || GetIsDM(pc)) 12 | return; 13 | 14 | int pcid = chr_GetPCID(pc); 15 | 16 | // Already initialized for this PCID 17 | if (GetLocalInt(chest, "PSC_PVT_PCID") == pcid) 18 | return; 19 | 20 | string tag = GetTag(chest); 21 | 22 | int n = 0; 23 | while (TRUE) 24 | { 25 | object other = GetObjectByTag(tag, n++); 26 | if (other == OBJECT_INVALID) 27 | break; 28 | 29 | if (other != chest && GetLocalInt(other, "PSC_PVT_PCID") == pcid) 30 | { 31 | SendMessageToPC(pc, "You already have your personal chest open elsewhere"); 32 | return; 33 | } 34 | } 35 | 36 | 37 | //SendMessageToPC(pc, "Personal chests have not been extensively tested yet. Please don't put anything of value in it today."); 38 | util_ClearInventory(chest); 39 | 40 | NWNX_SQL_PrepareQuery("SELECT ID, Object FROM " + SQL_TABLE_PLAYERCHESTS + " WHERE Tag=? AND PCID=?"); 41 | NWNX_SQL_PreparedString(0, tag); 42 | NWNX_SQL_PreparedInt(1, pcid); 43 | NWNX_SQL_ExecutePreparedQuery(); 44 | 45 | while (NWNX_SQL_ReadyToReadNextRow()) 46 | { 47 | NWNX_SQL_ReadNextRow(); 48 | int id = StringToInt(NWNX_SQL_ReadDataInActiveRow(0)); 49 | object item = NWNX_SQL_ReadFullObjectInActiveRow(1, chest); 50 | SetLocalInt(item, "PSC_ID", id); 51 | } 52 | 53 | string goldvar = "PSC_PVT_" + tag + "_" + IntToString(pcid) + "_GOLD"; 54 | int gold = sql_GetVarInt(goldvar); 55 | if (gold > 0) 56 | { 57 | CreateItemOnObject("NW_IT_GOLD001", chest, gold); 58 | SetLocalInt(chest, goldvar, gold); 59 | } 60 | 61 | SetLocalInt(chest, "PSC_PVT_PCID", pcid); 62 | } 63 | 64 | 65 | -------------------------------------------------------------------------------- /placeables/plc_detbarrdeath.nss: -------------------------------------------------------------------------------- 1 | void main() 2 | { 3 | effect eExplode = EffectVisualEffect(VFX_FNF_FIREBALL); 4 | effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M); 5 | location lTarget = GetLocation(OBJECT_SELF); 6 | 7 | float fRadius = GetLocalFloat(OBJECT_SELF, "DAMAGE_RADIUS"); 8 | int nDice = GetLocalInt(OBJECT_SELF, "DAMAGE_DICE"); 9 | int nRoll = GetLocalInt(OBJECT_SELF, "DAMAGE_ROLL"); 10 | 11 | //Apply the fireball explosion at the location captured above. 12 | ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget); 13 | 14 | object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget, 15 | TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); 16 | //Cycle through the targets within the spell shape until an invalid object is captured. 17 | while (GetIsObjectValid(oTarget) || oTarget == OBJECT_SELF) 18 | { 19 | // Get the distance between the explosion and the target to calculate delay 20 | float fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20; 21 | 22 | int nDamage = 0; 23 | int i; 24 | for(i = 0; i < nDice; ++i) 25 | { 26 | nDamage += Random(nRoll - 1) + 1; 27 | } 28 | 29 | //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion. 30 | nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE); 31 | effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE); 32 | if(nDamage > 0) 33 | { 34 | DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget)); 35 | DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); 36 | } 37 | 38 | //Select the next target within the spell shape. 39 | oTarget = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget, TRUE, 40 | OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /placeables/plc_dummy_ondmg.nss: -------------------------------------------------------------------------------- 1 | #include "xp_inc" 2 | #include "nwnx_time" 3 | 4 | 5 | void main() 6 | { 7 | object oPC = GetLastDamager(); 8 | 9 | if (!GetIsPC(oPC)) 10 | return; 11 | 12 | int tNow = NWNX_Time_GetTimeStamp(); 13 | int tLast = GetLocalInt(oPC, "DUMMY_LAST_HIT_TIME"); 14 | int nSession = GetLocalInt(oPC, "DUMMY_SESSION"); 15 | int tSince = (tNow - tLast); 16 | if (tSince > 60 && tSince < 120) 17 | { 18 | xp_GiveXP(oPC, 10, XP_TYPE_COMBAT); 19 | AssignCommand(oPC, ClearAllActions()); 20 | if (++nSession > 10) 21 | { 22 | DeleteLocalInt(oPC, "DUMMY_SESSION"); 23 | SetLocalInt(oPC, "DUMMY_LAST_HIT_TIME", tNow + 3600); 24 | SendMessageToPC(oPC, "You have finished with this training session. Come back at a later time"); 25 | } 26 | else 27 | { 28 | SetLocalInt(oPC, "DUMMY_LAST_HIT_TIME", tNow); 29 | } 30 | } 31 | else if (tSince > 120) 32 | { 33 | SetLocalInt(oPC, "DUMMY_LAST_HIT_TIME", tNow); 34 | if (nSession == 0) 35 | { 36 | SendMessageToPC(oPC, "You start a new training session..."); 37 | NWNX_Object_SetCurrentHitPoints(OBJECT_SELF, GetMaxHitPoints(OBJECT_SELF)); 38 | } 39 | else 40 | SendMessageToPC(oPC, "You continue your training session..."); 41 | } 42 | else if (tSince < 0) 43 | { 44 | SendMessageToPC(oPC, "You have finished with this training session. Come back at a later time"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /placeables/plc_inf_ondistur.nss: -------------------------------------------------------------------------------- 1 | #include "sql_inc" 2 | #include "chr_inc" 3 | #include "dbg_inc" 4 | 5 | void main() 6 | { 7 | object chest = OBJECT_SELF; 8 | object item = GetInventoryDisturbItem(); 9 | int type = GetInventoryDisturbType(); 10 | object pc = GetLastDisturbed(); 11 | 12 | 13 | if (type == INVENTORY_DISTURB_TYPE_ADDED) 14 | { 15 | CopyItem(item, pc, TRUE); 16 | DestroyObject(item); 17 | SendMessageToPC(pc, "Please do not put anything in these chests"); 18 | } 19 | else if (type == INVENTORY_DISTURB_TYPE_REMOVED) 20 | { 21 | CopyItem(item, chest, TRUE); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /placeables/plc_link_onheart.nss: -------------------------------------------------------------------------------- 1 | #include "color_inc" 2 | 3 | void main() 4 | { 5 | object oMod = GetModule(); 6 | object oOther = GetLocalObject(oMod, "PLC_LINK_OTHER"); 7 | if (!GetIsObjectValid(oOther)) 8 | { 9 | SendMessageToAllDMs(COLOR_CODE_BLUE_DARK + "First link placed. Next time you place a link placeable it will be linked to this one" + COLOR_CODE_END); 10 | SetLocalObject(oMod, "PLC_LINK_OTHER", OBJECT_SELF); 11 | } 12 | else 13 | { 14 | SetLocalObject(OBJECT_SELF, "PLC_LINK_OTHER", oOther); 15 | SetLocalObject(oOther, "PLC_LINK_OTHER", OBJECT_SELF); 16 | SendMessageToAllDMs(COLOR_CODE_BLUE_DARK + 17 | "Linked " + GetName(OBJECT_SELF) + " in " + GetName(GetArea(OBJECT_SELF)) + 18 | " with " + GetName(oOther) + " in " + GetName(GetArea(oOther)) + COLOR_CODE_END); 19 | DeleteLocalObject(oMod, "PLC_LINK_OTHER"); 20 | } 21 | 22 | SetEventScript(OBJECT_SELF, EVENT_SCRIPT_PLACEABLE_ON_HEARTBEAT, ""); 23 | } 24 | -------------------------------------------------------------------------------- /placeables/plc_link_onused.nss: -------------------------------------------------------------------------------- 1 | #include "color_inc" 2 | 3 | void main() 4 | { 5 | object oOther = GetLocalObject(OBJECT_SELF, "PLC_LINK_OTHER"); 6 | if (!GetIsObjectValid(oOther)) 7 | { 8 | SendMessageToAllDMs(COLOR_CODE_RED + "Link " + GetName(OBJECT_SELF) + " in " + GetName(GetArea(OBJECT_SELF))+ " has no other end."+ COLOR_CODE_END); 9 | } 10 | else 11 | { 12 | AssignCommand(GetLastUsedBy(), JumpToObject(oOther)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pveautotune/pat_ini.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : pat_ini 3 | * created by : eyesolated 4 | * date : 2018/7/31 5 | * 6 | * description : Initialization script for PAT 7 | * 8 | * changes : 2018/7/31 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | #include "pat_inc" 11 | 12 | void Initialize_Base(object oMod, object PAT_Cache) 13 | { 14 | // Initialize Roles 15 | ExecuteScript("pat_ini_base", oMod); 16 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Roles."); 17 | } 18 | 19 | void Initialize_ClassSetups(object oMod, object PAT_Cache) 20 | { 21 | // Initialize Class Setups 22 | ExecuteScript("pat_ini_class", oMod); 23 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Class Setups."); 24 | } 25 | 26 | void Initialize_Spells(object oMod, object PAT_Cache) 27 | { 28 | // Initialize Spells 29 | ExecuteScript("pat_ini_spells", oMod); 30 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Spells."); 31 | } 32 | 33 | void Initialize_Featpacks(object oMod, object PAT_Cache) 34 | { 35 | // Initialize Feat Packs 36 | ExecuteScript("pat_ini_featpack", oMod); 37 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Feat Packs."); 38 | } 39 | 40 | void Initialize_Skillsets(object oMod, object PAT_Cache) 41 | { 42 | // Initialize Skill Sets 43 | ExecuteScript("pat_ini_skillset", oMod); 44 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Skill Sets."); 45 | } 46 | 47 | void Initialize_Areas(object oMod, object PAT_Cache) 48 | { 49 | // Initialize Areas 50 | ExecuteScript("pat_ini_areas", oMod); 51 | SetDescription(PAT_Cache, GetDescription(PAT_Cache) + "\nPAT - Initialized Areas."); 52 | } 53 | 54 | void Initialize_All(object oMod) 55 | { 56 | object PAT_Cache = pat_GetCache(); 57 | 58 | DelayCommand(0.1f, Initialize_Base(oMod, PAT_Cache)); 59 | DelayCommand(0.2f, Initialize_ClassSetups(oMod, PAT_Cache)); 60 | DelayCommand(0.3f, Initialize_Spells(oMod, PAT_Cache)); 61 | DelayCommand(0.4f, Initialize_Featpacks(oMod, PAT_Cache)); 62 | DelayCommand(0.5f, Initialize_Skillsets(oMod, PAT_Cache)); 63 | DelayCommand(0.6f, Initialize_Areas(oMod, PAT_Cache)); 64 | } 65 | 66 | void main() 67 | { 68 | // If all tables exist, do not (re)initialize 69 | if (pat_GetTablesExist()) 70 | { 71 | object oLog = GetObjectByTag("LOG"); 72 | SetDescription(oLog, GetDescription(oLog) + "\nPAT - database already exists."); 73 | WriteTimestampedLogEntry("PAT - database already exists - skipping initialization."); 74 | return; 75 | } 76 | 77 | // Drop any existing tables 78 | pat_DropTables(); 79 | 80 | // Create all tables 81 | pat_CreateTables(); 82 | 83 | object oMod = GetModule(); 84 | DelayCommand(0.2, Initialize_All(oMod)); 85 | } 86 | -------------------------------------------------------------------------------- /pveautotune/pat_ini_skillset.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : pat_ini_skillset 3 | * created by : eyesolated 4 | * date : 2018/7/31 5 | * 6 | * description : Skillset Initialization script for PAT 7 | * 8 | * changes : 2018/7/31 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | #include "pat_inc" 11 | #include "x0_i0_stringlib" 12 | 13 | string pat_SkillString(int nSkill) 14 | { 15 | return (IntToString(nSkill) + ";"); 16 | } 17 | 18 | void main() 19 | { 20 | // Generic Melee DPS Skillset 21 | pat_AddSkillset(PAT_SKILLSET_DPS_MELEE_GENERIC, 22 | "", 23 | pat_SkillString(SKILL_DISCIPLINE), 24 | pat_SkillString(SKILL_TUMBLE), 25 | ""); 26 | 27 | // Generic Range DPS Skillset 28 | pat_AddSkillset(PAT_SKILLSET_DPS_RANGE_GENERIC, 29 | "", 30 | pat_SkillString(SKILL_DISCIPLINE) + pat_SkillString(SKILL_TUMBLE), 31 | "", 32 | ""); 33 | 34 | // Generic Caster DPS Skillset 35 | pat_AddSkillset(PAT_SKILLSET_DPS_CASTER_GENERIC, 36 | pat_SkillString(SKILL_CONCENTRATION) + pat_SkillString(SKILL_SPELLCRAFT), 37 | "", 38 | "", 39 | ""); 40 | 41 | // Generic Heal Skillset 42 | pat_AddSkillset(PAT_SKILLSET_HEAL_GENERIC, 43 | pat_SkillString(SKILL_HEAL) + pat_SkillString(SKILL_CONCENTRATION), 44 | pat_SkillString(SKILL_DISCIPLINE), 45 | pat_SkillString(SKILL_SPELLCRAFT), 46 | ""); 47 | 48 | // Generic Support Skillset 49 | pat_AddSkillset(PAT_SKILLSET_SUPPORT_GENERIC, 50 | pat_SkillString(SKILL_CONCENTRATION), 51 | pat_SkillString(SKILL_SPELLCRAFT), 52 | pat_SkillString(SKILL_DISCIPLINE) + pat_SkillString(SKILL_TUMBLE), 53 | ""); 54 | 55 | // Generic Tank Skillset 56 | pat_AddSkillset(PAT_SKILLSET_TANK_GENERIC, 57 | pat_SkillString(SKILL_DISCIPLINE) + pat_SkillString(SKILL_INTIMIDATE), 58 | pat_SkillString(SKILL_TUMBLE) + pat_SkillString(SKILL_TAUNT), 59 | "", 60 | ""); 61 | 62 | // Rogue Skillset 63 | pat_AddSkillset(PAT_SKILLSET_ROGUE, 64 | pat_SkillString(SKILL_HIDE) + pat_SkillString(SKILL_MOVE_SILENTLY), 65 | pat_SkillString(SKILL_TUMBLE), 66 | pat_SkillString(SKILL_DISCIPLINE), 67 | ""); 68 | } 69 | -------------------------------------------------------------------------------- /pveautotune/pat_tst.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : pat_tst 3 | * created by : eyesolated 4 | * date : 2018/7/31 5 | * 6 | * description : Test script for PAT 7 | * 8 | * changes : 2018/7/31 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | #include "pat_cfg" 11 | 12 | void main() 13 | { 14 | object oUser = GetLastUsedBy(); 15 | string sTest = GetTag(OBJECT_SELF); 16 | 17 | // Get target CR 18 | int nCR = StringToInt(GetStringRight(sTest, 2)); 19 | 20 | // Get Area 21 | object oArea = GetArea(OBJECT_SELF); 22 | 23 | // Set PAT CR on the Area 24 | SetLocalInt(oArea, PAT_VAR_CR, nCR); 25 | } 26 | -------------------------------------------------------------------------------- /spells/esm_cfg.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : esm_cfg 3 | * created by : eyesolated 4 | * date : 2018/4/15 5 | * 6 | * description : The central configuration file for eyesolated spell macros 7 | * 8 | * changes : 2018/4/15 - eyesolated - Initial creation 9 | ************************************************************************/ 10 | 11 | const string ESM_BLUEPRINT = "esm_emptymacro"; 12 | const string ESM_BLUEPRINT_SMART = "esm_emptysmart"; 13 | const string ESM_ITEMTAG_RECORDING = "esm_macro_rec"; 14 | const string ESM_ITEMTAG_FINISHED = "esm_macro_fin"; 15 | 16 | const string ESM_ARRAY_TEMP = "esm_temparray"; 17 | const string ESM_ARRAY_TEMP_METAMAGIC = "esm_temparray_mm"; 18 | const string ESM_ARRAY_ONOBJECT = "esm_spellarray"; 19 | const string ESM_ARRAY_ONOBJECT_METAMAGIC = "esm_spellarray_mm"; 20 | 21 | const string ESM_VAR_MACRONAME = "esm_macro_name"; 22 | 23 | const string ESM_VAR_SMARTCAST = "esm_smartcast"; 24 | const int ESM_SMARTCAST_DISABLED = 0; 25 | const int ESM_SMARTCAST_ENABLED = 1; 26 | 27 | const string ESM_VAR_RECORDING = "esm_recording"; 28 | const int ESM_RECORDING_DISABLED = 0; 29 | const int ESM_RECORDING_ENABLED = 1; 30 | 31 | const string ESM_VAR_ORIGINALTAG = "esm_orgtag"; 32 | -------------------------------------------------------------------------------- /spells/esm_spuserdef.nss: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * script name : esm_spuserdef 3 | * created by : eyesolated 4 | * date : 2018/4/15 5 | * 6 | * description : The user defined Spell script for eyesolated spell macros 7 | * This script needs to be defined as the user defined spell 8 | * script on the module. 9 | * Either you set the variable X2_S_UD_SPELLSCRIPT manually or 10 | * call SetModuleOverrideSpellscript 11 | * 12 | * changes : 2018/4/15 - eyesolated - Initial creation 13 | ************************************************************************/ 14 | 15 | // Includes 16 | #include "color_inc" 17 | #include "eas_inc" 18 | #include "esm_inc" 19 | 20 | void main() 21 | { 22 | object oPC = OBJECT_SELF; 23 | int nSpell = GetSpellId(); 24 | int nMetaMagic = GetMetaMagicFeat(); 25 | 26 | if (esm_IsRecording(oPC)) 27 | { 28 | esm_AddSpell_Temporary_PC(oPC, nSpell, nMetaMagic); 29 | SendMessageToPC(oPC, "Added [" + esm_GetSpellName(nSpell) + "] to macro."); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spells/nw_s0_knock.nss: -------------------------------------------------------------------------------- 1 | //:://///////////////////////////////////////////// 2 | //:: Knock 3 | //:: NW_S0_Knock 4 | //:: Copyright (c) 2001 Bioware Corp. 5 | //::////////////////////////////////////////////// 6 | /* 7 | Opens doors not locked by magical means. 8 | */ 9 | /* 10 | Anphillia Changes 11 | This spell now unlocks DCs of d20 + Caster Level + Int Modifier. If the 12 | lock DC is higher, the spell will weaken the DC by 13 | Caser Level + Int Modifier for 30 seconds. 14 | */ 15 | //::////////////////////////////////////////////// 16 | //:: Created By: Preston Watamaniuk 17 | //:: Created On: Nov 29, 2001 18 | //::////////////////////////////////////////////// 19 | //:: Last Updated By: Georg 2003/07/31 - Added signal event and custom door flags 20 | //:: VFX Pass By: Preston W, On: June 22, 2001 21 | #include "nw_i0_spells" 22 | 23 | #include "x2_inc_spellhook" 24 | 25 | 26 | void main() 27 | { 28 | 29 | /* 30 | Spellcast Hook Code 31 | Added 2003-06-23 by GeorgZ 32 | If you want to make changes to all spells, 33 | check x2_inc_spellhook.nss to find out more 34 | 35 | */ 36 | 37 | if (!X2PreSpellCastCode()) 38 | { 39 | // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell 40 | return; 41 | } 42 | 43 | // End of Spell Cast Hook 44 | 45 | 46 | location loc = GetLocation(OBJECT_SELF); 47 | int nCasterLevel = GetCasterLevel(OBJECT_SELF); 48 | int nRoll = (GetIsInCombat(OBJECT_SELF) ? d20() : 20); 49 | int nModifier = nCasterLevel + GetAbilityModifier(ABILITY_INTELLIGENCE); 50 | 51 | object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 50.0, loc, FALSE, OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); 52 | while(GetIsObjectValid(oTarget)) 53 | { 54 | SignalEvent(oTarget,EventSpellCastAt(OBJECT_SELF,GetSpellId())); 55 | float fDelay = GetRandomDelay(0.5, 2.5); 56 | if(GetLocked(oTarget) && GetStringUpperCase(GetStringLeft(GetTag(oTarget), 3)) != "CNR") 57 | { 58 | int nResist = GetDoorFlag(oTarget,DOOR_FLAG_RESIST_KNOCK); 59 | 60 | // Knock shouldn't open doors that require special keys 61 | if (GetLockKeyRequired(oTarget)) 62 | { 63 | FloatingTextStringOnCreature(GetName(oTarget) + " requires a special key.", OBJECT_SELF); 64 | } 65 | else if (nResist == 0) 66 | { 67 | DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_KNOCK), oTarget)); 68 | 69 | int nDC = GetLockUnlockDC(oTarget); 70 | if (nDC <= (nRoll + nModifier)) 71 | { 72 | AssignCommand(oTarget, ActionUnlockObject(oTarget)); 73 | FloatingTextStringOnCreature(GetName(oTarget) + " has been unlocked.", OBJECT_SELF); 74 | } 75 | else 76 | { 77 | SetLockUnlockDC(oTarget, nDC - nModifier); 78 | DelayCommand(30.0, SetLockUnlockDC(oTarget, nDC)); 79 | FloatingTextStringOnCreature(GetName(oTarget) + " has been weakened.", OBJECT_SELF); 80 | } 81 | } 82 | else if (nResist == 1) 83 | { 84 | FloatingTextStrRefOnCreature(83887,OBJECT_SELF); // 85 | } 86 | } 87 | oTarget = GetNextObjectInShape(SHAPE_SPHERE, 50.0, loc, FALSE, OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /spells/nw_s0_truesee.nss: -------------------------------------------------------------------------------- 1 | //:://///////////////////////////////////////////// 2 | //:: True Seeing 3 | //:: NW_S0_TrueSee.nss 4 | //:: Copyright (c) 2001 Bioware Corp. 5 | //::////////////////////////////////////////////// 6 | /* 7 | The creature can seen all invisible, sanctuared, 8 | or hidden opponents. 9 | */ 10 | /* 11 | Anphillia Changes 12 | True Seeing does not reveal hidden creatures but is composed of the 13 | following effects: 14 | . See Invisibility 15 | . Spell School Immunity (Illusion) 16 | . Spell Immunity (Sanctuary) 17 | . Spell Immunity (Phantasmal Killer) 18 | . UltraVision 19 | */ 20 | //::////////////////////////////////////////////// 21 | //:: Created By: Preston Watamaniuk 22 | //:: Created On: [date] 23 | //::////////////////////////////////////////////// 24 | 25 | #include "x2_inc_spellhook" 26 | 27 | void main() 28 | { 29 | 30 | /* 31 | Spellcast Hook Code 32 | Added 2003-06-23 by GeorgZ 33 | If you want to make changes to all spells, 34 | check x2_inc_spellhook.nss to find out more 35 | 36 | */ 37 | 38 | if (!X2PreSpellCastCode()) 39 | { 40 | // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell 41 | return; 42 | } 43 | 44 | // End of Spell Cast Hook 45 | 46 | //Declare major variables 47 | object oTarget = GetSpellTargetObject(); 48 | effect eVis = EffectVisualEffect(VFX_DUR_MAGICAL_SIGHT); 49 | effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE); 50 | effect eSight1 = EffectSeeInvisible(); 51 | effect eSight2 = EffectSpellImmunity(SPELL_SCHOOL_ILLUSION); 52 | effect eSight3 = EffectSpellImmunity(SPELL_SANCTUARY); 53 | effect eSight4 = EffectUltravision(); 54 | effect eSight5 = EffectSpellImmunity(SPELL_PHANTASMAL_KILLER); 55 | effect eLink = EffectLinkEffects(eSight1, eSight2); 56 | eLink = EffectLinkEffects(eLink, eSight3); 57 | eLink = EffectLinkEffects(eLink, eSight4); 58 | eLink = EffectLinkEffects(eLink, eVis); 59 | eLink = EffectLinkEffects(eLink, eDur); 60 | eLink = EffectLinkEffects(eLink, eSight5); 61 | //Fire cast spell at event for the specified target 62 | SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_TRUE_SEEING, FALSE)); 63 | int nDuration = GetCasterLevel(OBJECT_SELF); 64 | int nMetaMagic = GetMetaMagicFeat(); 65 | //Enter Metamagic conditions 66 | if (nMetaMagic == METAMAGIC_EXTEND) 67 | { 68 | nDuration = nDuration *2; //Duration is +100% 69 | } 70 | //Apply the VFX impact and effects 71 | if (GetIsDM(GetLastSpellCaster())) 72 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectTrueSeeing(), oTarget, TurnsToSeconds(nDuration)); 73 | else 74 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration)); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /spells/nw_s2_familiar.nss: -------------------------------------------------------------------------------- 1 | //:://///////////////////////////////////////////// 2 | //:: Summon Familiar 3 | //:: NW_S2_Familiar 4 | //:: Copyright (c) 2001 Bioware Corp. 5 | //::////////////////////////////////////////////// 6 | /* 7 | This spell summons an Arcane casters familiar 8 | */ 9 | //::////////////////////////////////////////////// 10 | //:: Created By: Preston Watamaniuk 11 | //:: Created On: Sept 27, 2001 12 | //::////////////////////////////////////////////// 13 | 14 | void main() 15 | { 16 | //Yep thats it 17 | SummonFamiliar(); 18 | object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR); 19 | if (GetAppearanceType(oFamiliar) == APPEARANCE_TYPE_FAERIE_DRAGON) 20 | SetCreatureAppearanceType(oFamiliar, 3371); // Cute purple dragon 21 | 22 | int nFamiliarLevel = GetHitDice(oFamiliar); 23 | float fScale = 0.6 + nFamiliarLevel*0.05; 24 | SetObjectVisualTransform(oFamiliar, OBJECT_VISUAL_TRANSFORM_SCALE, fScale); 25 | } 26 | -------------------------------------------------------------------------------- /spells/spell_hook.nss: -------------------------------------------------------------------------------- 1 | #include "x2_inc_spellhook" 2 | #include "x2_inc_switches" 3 | #include "spell_inc" 4 | #include "nwnx_creature" 5 | 6 | void main() 7 | { 8 | // eyesolated spell macros script 9 | ExecuteScript("esm_spuserdef", OBJECT_SELF); 10 | 11 | int nSpellID = GetSpellId(); 12 | object oCaster = OBJECT_SELF; 13 | int nCasterLvl = GetCasterLevel(oCaster); 14 | int nMetaMagic = GetMetaMagicFeat(); 15 | 16 | 17 | 18 | 19 | if (spell_GetLevel(nSpellID, GetLastSpellCastClass()) == 0) 20 | NWNX_Creature_RestoreSpells(oCaster, 0); 21 | 22 | // Special spell failure conditions 23 | switch (nSpellID) 24 | { 25 | case SPELL_CALL_LIGHTNING: 26 | if (GetIsAreaInterior(GetArea(oCaster))) 27 | { 28 | FloatingTextStringOnCreature("You cannot cast this spell indoors.", oCaster); 29 | SetModuleOverrideSpellScriptFinished(); 30 | return; 31 | } 32 | break; 33 | } 34 | 35 | // Custom spells not using Bioware implementation 36 | switch (nSpellID) 37 | { 38 | case SPELL_MAGIC_WEAPON: 39 | case SPELL_GREATER_MAGIC_WEAPON: 40 | case SPELL_DARKFIRE: 41 | case SPELL_BLADE_THIRST: 42 | case SPELL_FLAME_WEAPON: 43 | ExecuteScript("spell_weapon", OBJECT_SELF); 44 | SetModuleOverrideSpellScriptFinished(); 45 | break; 46 | case SPELL_MAGIC_MISSILE: 47 | case SPELL_SHADOW_CONJURATION_MAGIC_MISSILE: 48 | case SPELL_ISAACS_LESSER_MISSILE_STORM: 49 | case SPELL_ISAACS_GREATER_MISSILE_STORM: 50 | case SPELL_BALL_LIGHTNING: 51 | case SPELL_FLAME_ARROW: 52 | case SPELL_FIREBRAND: 53 | // case SPELL_MELFS_ACID_ARROW: 54 | // case SPELL_GREATER_SHADOW_CONJURATION_ACID_ARROW: 55 | ExecuteScript("spell_missile", OBJECT_SELF); 56 | SetModuleOverrideSpellScriptFinished(); 57 | break; 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /spells/spell_inc.nss: -------------------------------------------------------------------------------- 1 | 2 | // Temporary for spell names.. 3 | #include "cnr_spells_inc" 4 | 5 | int spell_GetLevel(int nSpellID, int nCasterClass = -1); 6 | string spell_GetName(int nSpellID); 7 | int spell_GetSchool(int nSpellID); 8 | int spell_GetSpellFocusFeat(int nSpellSchool, int bGreaterFocusFeat=FALSE); 9 | 10 | 11 | 12 | 13 | 14 | 15 | string spell_GetName(int nSpellID) 16 | { 17 | return CnrGetNameForSpell(nSpellID); 18 | } 19 | 20 | int spell_GetLevel(int nSpellID, int nCasterClass = -1) 21 | { 22 | string sColumn; 23 | 24 | switch (nCasterClass) 25 | { 26 | case CLASS_TYPE_BARD: sColumn="Bard"; break; 27 | case CLASS_TYPE_CLERIC: sColumn="Cleric"; break; 28 | case CLASS_TYPE_DRUID: sColumn="Druid"; break; 29 | case CLASS_TYPE_PALADIN: sColumn="Paladin"; break; 30 | case CLASS_TYPE_RANGER: sColumn="Ranger"; break; 31 | case CLASS_TYPE_WIZARD: 32 | case CLASS_TYPE_SORCERER: // Wizards and Sorcerers use the same column. 33 | sColumn="Wiz_Sorc"; break; 34 | default: sColumn="Innate"; break; 35 | } 36 | 37 | string sLevel = Get2DAString("spells", sColumn, nSpellID); 38 | return (sLevel=="") ? -1 : StringToInt(sLevel); 39 | } 40 | 41 | int spell_GetSchool(int nSpellID) 42 | { 43 | string sSchool = Get2DAString("spells", "School", nSpellID); 44 | 45 | if (sSchool == "A") return SPELL_SCHOOL_ABJURATION; 46 | if (sSchool == "C") return SPELL_SCHOOL_CONJURATION; 47 | if (sSchool == "D") return SPELL_SCHOOL_DIVINATION; 48 | if (sSchool == "E") return SPELL_SCHOOL_ENCHANTMENT; 49 | if (sSchool == "V") return SPELL_SCHOOL_EVOCATION; 50 | if (sSchool == "I") return SPELL_SCHOOL_ILLUSION; 51 | if (sSchool == "N") return SPELL_SCHOOL_NECROMANCY; 52 | if (sSchool == "T") return SPELL_SCHOOL_TRANSMUTATION; 53 | 54 | return SPELL_SCHOOL_GENERAL; 55 | } 56 | 57 | int spell_GetSpellFocusFeat(int nSpellSchool, int bGreaterFocusFeat=FALSE) 58 | { 59 | switch (nSpellSchool) 60 | { 61 | case SPELL_SCHOOL_ABJURATION: 62 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_ABJURATION : FEAT_SPELL_FOCUS_ABJURATION; 63 | case SPELL_SCHOOL_CONJURATION: 64 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_CONJURATION : FEAT_SPELL_FOCUS_CONJURATION; 65 | case SPELL_SCHOOL_DIVINATION: 66 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_DIVINATION : FEAT_SPELL_FOCUS_DIVINATION; 67 | case SPELL_SCHOOL_ENCHANTMENT: 68 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_ENCHANTMENT : FEAT_SPELL_FOCUS_ENCHANTMENT; 69 | case SPELL_SCHOOL_EVOCATION: 70 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_EVOCATION : FEAT_SPELL_FOCUS_EVOCATION; 71 | case SPELL_SCHOOL_ILLUSION: 72 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_ILLUSION : FEAT_SPELL_FOCUS_ILLUSION; 73 | case SPELL_SCHOOL_NECROMANCY: 74 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_NECROMANCY : FEAT_SPELL_FOCUS_NECROMANCY; 75 | case SPELL_SCHOOL_TRANSMUTATION: 76 | return bGreaterFocusFeat ? FEAT_GREATER_SPELL_FOCUS_TRANSMUTATION : FEAT_SPELL_FOCUS_TRANSMUTATION; 77 | } 78 | 79 | return -1; 80 | } 81 | -------------------------------------------------------------------------------- /spells/x2_s3_onhitcast.nss: -------------------------------------------------------------------------------- 1 | //:://///////////////////////////////////////////// 2 | //:: User Defined OnHitCastSpell code 3 | //:: x2_s3_onhitcast 4 | //:: Copyright (c) 2003 Bioware Corp. 5 | //::////////////////////////////////////////////// 6 | /* 7 | This file can hold your module specific 8 | OnHitCastSpell definitions 9 | 10 | How to use: 11 | - Add the Item Property OnHitCastSpell: UniquePower (OnHit) 12 | - Add code to this spellscript (see below) 13 | 14 | WARNING! 15 | This item property can be a major performance hog when used 16 | extensively in a multi player module. Especially in higher 17 | levels, with each player having multiple attacks, having numerous 18 | of OnHitCastSpell items in your module this can be a problem. 19 | 20 | It is always a good idea to keep any code in this script as 21 | optimized as possible. 22 | 23 | 24 | */ 25 | //::////////////////////////////////////////////// 26 | //:: Created By: Georg Zoeller 27 | //:: Created On: 2003-07-22 28 | //::////////////////////////////////////////////// 29 | 30 | #include "x2_inc_switches" 31 | 32 | void main() 33 | { 34 | 35 | object oItem; // The item casting triggering this spellscript 36 | object oSpellTarget; // On a weapon: The one being hit. On an armor: The one hitting the armor 37 | object oSpellOrigin; // On a weapon: The one wielding the weapon. On an armor: The one wearing an armor 38 | 39 | // fill the variables 40 | oSpellOrigin = OBJECT_SELF; 41 | oSpellTarget = GetSpellTargetObject(); 42 | oItem = GetSpellCastItem(); 43 | 44 | if (GetIsObjectValid(oItem)) 45 | { 46 | // * Generic Item Script Execution Code 47 | // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module, 48 | // * it will execute a script that has the same name as the item's tag 49 | // * inside this script you can manage scripts for all events by checking against 50 | // * GetUserDefinedItemEventNumber(). See x2_it_example.nss 51 | if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE) 52 | { 53 | SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ONHITCAST); 54 | int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF); 55 | if (nRet == X2_EXECUTE_SCRIPT_END) 56 | { 57 | return; 58 | } 59 | } 60 | 61 | string sItemTag = GetTag(oItem); 62 | if (sItemTag == "ee_sq_webber_wpn") 63 | { 64 | // Paralyze the target for 6 seconds 65 | effect eEffect = EffectCutsceneParalyze(); 66 | effect eVFX_1 = EffectVisualEffect(VFX_DUR_STONEHOLD); 67 | effect eVFX_2 = EffectVisualEffect(VFX_DUR_ICESKIN); 68 | 69 | effect eLink = EffectLinkEffects(eEffect, eVFX_1); 70 | eLink = EffectLinkEffects(eLink, eVFX_2); 71 | ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oSpellTarget, 6.0f); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /store/store_cfg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // store_cfg 3 | // written by: eyesolated 4 | // written at: Sept. 22, 2004 5 | // 6 | // Notes: Store Configuration 7 | 8 | // Constants 9 | const string CS_STORE_SYSTEMREADY = "STORE_READY"; 10 | const string CS_STORE_SCRIPT_OPEN = "store_open"; 11 | 12 | const string CS_STORE_DEFAULTHEARTBEATSCRIPT = "nw_c2_default1"; 13 | const string CS_STORE_INITIALIZED = "StoreInitialized"; 14 | const string CS_STORE_NEEDSRESET = "StoreNeedsReset"; 15 | const string CS_STORE_CATNEEDSRESET = "CAT_"; 16 | const string CS_STORE_ITEMAMOUNT = "StoreItemAmount"; 17 | 18 | // Store reset time in Heartbeats (= 6 seconds) 19 | const int CS_STORE_RESETTIME = 600; // 1 hour = 600 heartbeats 20 | 21 | //Store Variables 22 | 23 | // What kinds of stuff does this store sell? 24 | // The value of these INTEGER values sets the Maximum of items available 25 | // for this category. If set to 0, the store won't have these items, and items 26 | // from this category that are sold to the store will disappear. 27 | // 28 | // SH_Everything gets added to EACH category. 29 | const string CS_STORE_StoreHas_EVERYTHING = "SH_EVERYTHING"; 30 | const string CS_STORE_StoreHas_ARMOR_BODY_CLOTHING = "SH_ARMOR_CLOTHING"; 31 | const string CS_STORE_StoreHas_ARMOR_BODY_LIGHT = "SH_ARMOR_LIGHT"; 32 | const string CS_STORE_StoreHas_ARMOR_BODY_MEDIUM = "SH_ARMOR_MEDIUM"; 33 | const string CS_STORE_StoreHas_ARMOR_BODY_HEAVY = "SH_ARMOR_HEAVY"; 34 | const string CS_STORE_StoreHas_ARMOR_SHIELD = "SH_ARMOR_SHIELD"; 35 | const string CS_STORE_StoreHas_ARMOR_HELMET = "SH_ARMOR_HELMET"; 36 | const string CS_STORE_StoreHas_WEAPON_MELEE = "SH_WEAPON_MELEE"; 37 | const string CS_STORE_StoreHas_WEAPON_RANGED = "SH_WEAPON_RANGED"; 38 | const string CS_STORE_StoreHas_WEAPON_THROWN = "SH_WEAPON_THROWN"; 39 | const string CS_STORE_StoreHas_AMMO = "SH_AMMO"; 40 | const string CS_STORE_StoreHas_ACCESSORIES_CLOTHING = "SH_ACC_CLOTHING"; 41 | const string CS_STORE_StoreHas_ACCESSORIES_JEWELRY = "SH_ACC_JEWELRY"; 42 | const string CS_STORE_StoreHas_RODSWANDS = "SH_RODSWANDS"; 43 | const string CS_STORE_StoreHas_SCROLLS = "SH_SCROLLS"; 44 | const string CS_STORE_StoreHas_POTIONS = "SH_POTIONS"; 45 | const string CS_STORE_StoreHas_CONTAINERS = "SH_CONTAINERS"; 46 | const string CS_STORE_StoreHas_BOMBS = "SH_BOMBS"; 47 | const string CS_STORE_StoreHas_THIEVESTOOLS = "SH_THIEVESTOOLS"; 48 | const string CS_STORE_StoreHas_TRAPS = "SH_TRAPS"; 49 | const string CS_STORE_StoreHas_MEDKITS = "SH_MEDKITS"; 50 | const string CS_STORE_StoreHas_MISC = "SH_MISC"; 51 | 52 | // Suffix for counting the current amount 53 | const string CS_STORE_AMOUNTSUFFIX = "_CA"; 54 | 55 | // How many items does the store have MINIMUM per category? 56 | // The value of this variable sets the DIVISOR by which the above maximums are 57 | // divided to see what the minimum is. 58 | // Example: If a store has a maximum of 12 Melee Weapons, and this divisor is 59 | // set to 3, the store will always carry a minimum of 4 Melee Weapons. 60 | // If it was set to 2, the store would always have at least 6 Melee 61 | // Weapons. 62 | const string CS_STORE_StoreHasMinimum = "SHMinimum"; 63 | 64 | // The Chance of Magic Items for this store 65 | const string CS_STORE_MAGICCHANCE = "S_MAGICCHANCE"; 66 | 67 | // The Maximum Magic Level for this store 68 | const string CS_STORE_MAGICLEVEL = "S_MAGICLEVEL"; 69 | 70 | // Chance that these Magic items are identified 71 | const string CS_STORE_IDENTIFIEDCHANCE = "S_IDENTIFIEDCHANCE"; 72 | -------------------------------------------------------------------------------- /store/store_cleaven.nss: -------------------------------------------------------------------------------- 1 | //:://///////////////////////////////////////////// 2 | //:: FileName store_cleaven 3 | //::////////////////////////////////////////////// 4 | //::////////////////////////////////////////////// 5 | //:: Created By: Script Wizard 6 | //:: Created On: 19/07/2004 20:33:27 7 | //::////////////////////////////////////////////// 8 | #include "nw_i0_plot" 9 | 10 | void main() 11 | { 12 | 13 | // Either open the store with that tag or let the user know that no store exists. 14 | object oStore = GetNearestObjectByTag("newbiemerchan001"); 15 | if(GetObjectType(oStore) == OBJECT_TYPE_STORE) 16 | gplotAppraiseOpenStore(oStore, GetPCSpeaker()); 17 | else 18 | ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK); 19 | } 20 | -------------------------------------------------------------------------------- /store/store_folinus.nss: -------------------------------------------------------------------------------- 1 | void main() 2 | { 3 | OpenStore(GetNearestObjectByTag("STORE_FolinusTB"), GetPCSpeaker()); 4 | } 5 | -------------------------------------------------------------------------------- /store/store_hrtbeat.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // store_hrtbeat 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: The special heartbeat for Store owners, responsible for resetting 7 | // the store 8 | 9 | /////////// 10 | // Includes 11 | // 12 | #include "eas_inc" 13 | #include "color_inc" 14 | #include "egs_inc" 15 | #include "ip_inc" 16 | #include "store_inc" 17 | #include "store_cfg" 18 | 19 | /////////////////////// 20 | // Function Declaration 21 | // 22 | 23 | //////////////// 24 | // Function Code 25 | // 26 | void main() 27 | { 28 | ExecuteScript(CS_STORE_DEFAULTHEARTBEATSCRIPT, OBJECT_SELF); 29 | object oStore = store_GetStore(OBJECT_SELF); 30 | 31 | // If the store is valid, move on 32 | if (GetIsObjectValid(oStore)) 33 | { 34 | // See if the store is initialized, if not, return 35 | if (GetLocalInt(oStore, CS_STORE_INITIALIZED) == 0) 36 | return; 37 | 38 | // If the store is initialized, we increase the heartbeat counter 39 | int iNumHeartbeats = GetLocalInt(oStore, "heartbeats") + 1; 40 | SetLocalInt(oStore, "heartbeats", iNumHeartbeats); 41 | 42 | // If we reach the number of heartbeats needed, we reset the store 43 | if(iNumHeartbeats > CS_STORE_RESETTIME) 44 | { 45 | DeleteLocalInt(oStore, "heartbeats"); 46 | store_ResetStore(oStore); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /store/store_ini.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // store_ini 3 | // written by: eyesolated 4 | // written at: Sept. 22, 2004 5 | // 6 | // Notes: Store Initialization 7 | 8 | /////////// 9 | // Includes 10 | // 11 | //#include "store_inc" 12 | #include "store_cfg" 13 | 14 | /////////////////////// 15 | // Function Declaration 16 | // 17 | 18 | //////////////// 19 | // Function Code 20 | // 21 | void main() 22 | { 23 | object oModule = GetModule(); 24 | 25 | SetLocalInt(oModule, CS_STORE_SYSTEMREADY, 1); 26 | } 27 | -------------------------------------------------------------------------------- /store/store_onclosed.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // store_onclosed 3 | // written by: eyesolated 4 | // written at: Jan. 30, 2004 5 | // 6 | // Notes: the OnClosed event for stores 7 | 8 | /////////// 9 | // Includes 10 | // 11 | #include "eas_inc" 12 | #include "color_inc" 13 | #include "egs_inc" 14 | #include "ip_inc" 15 | 16 | /////////////////////// 17 | // Function Declaration 18 | // 19 | 20 | //////////////// 21 | // Function Code 22 | // 23 | void main() 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /store/store_open.nss: -------------------------------------------------------------------------------- 1 | #include "eas_inc" 2 | #include "color_inc" 3 | #include "egs_inc" 4 | #include "ip_inc" 5 | #include "store_inc" 6 | 7 | void main() 8 | { 9 | object oNPC = OBJECT_SELF; 10 | object oStore; 11 | object oPC = GetPCSpeaker (); 12 | string sTag = GetTag (oNPC); 13 | 14 | oStore = store_GetStore(OBJECT_SELF); 15 | if (!GetIsObjectValid (oStore)) 16 | { 17 | ActionSpeakString ("Sorry, the store is closed."); 18 | return; 19 | } 20 | 21 | object oModule = GetModule(); 22 | int nReady = GetLocalInt(oModule, CS_STORE_SYSTEMREADY); 23 | if (nReady == 0) 24 | { 25 | ActionSpeakString ("Sorry, the store is closed, but will open very soon."); 26 | return; 27 | } 28 | 29 | store_Initialize(oStore); 30 | 31 | if (store_GetAmountOfItems(oStore) == 0) 32 | { 33 | int iMinutesToRefill = (CS_STORE_RESETTIME - GetLocalInt(oStore, "heartbeats")) / 10; 34 | ActionSpeakString ("I am out of stock. The next delivery of items is scheduled in about " + color_ConvertString(IntToString(iMinutesToRefill), COLOR_GREEN) + " minutes.\nYou can still sell items to me though."); 35 | } 36 | 37 | OpenStore (oStore, oPC); 38 | } 39 | -------------------------------------------------------------------------------- /tools/server_restart.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_admin" 2 | 3 | void BootAll() 4 | { 5 | ExportAllCharacters(); 6 | object pc = GetFirstPC(); 7 | while (pc != OBJECT_INVALID) 8 | { 9 | BootPC(pc, "Anphillia is updating, please log again in a minute"); 10 | pc = GetNextPC(); 11 | } 12 | WriteTimestampedLogEntry("All players booted"); 13 | } 14 | 15 | void main() 16 | { 17 | object oUsedBy = GetLastUsedBy(); 18 | if (!GetIsDM(oUsedBy)) 19 | { 20 | SendMessageToPC(oUsedBy, "Only a DM can initiate a server restart."); 21 | return; 22 | } 23 | 24 | WriteTimestampedLogEntry("Server restart requested."); 25 | AssignCommand(GetModule(), SpeakString("The server will restart in 1 minute.", TALKVOLUME_SHOUT)); 26 | object pc = GetFirstPC(); 27 | while (pc != OBJECT_INVALID) 28 | { 29 | SendMessageToPC(pc, "The server will restart in 1 minute."); 30 | pc = GetNextPC(); 31 | } 32 | 33 | DelayCommand(60.0, BootAll()); 34 | DelayCommand(63.0, NWNX_Administration_ShutdownServer()); 35 | } 36 | -------------------------------------------------------------------------------- /tools/x3_dm_tool01.nss: -------------------------------------------------------------------------------- 1 | #include "anph_inc" 2 | #include "nwnx_time" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | if (oTarget == OBJECT_INVALID) 9 | { 10 | SendMessageToPC(oUser, "This tool is used to grow an object, must target a valid object."); 11 | return; 12 | } 13 | 14 | float fScale = GetObjectVisualTransform(oTarget, OBJECT_VISUAL_TRANSFORM_SCALE); 15 | fScale += 0.02; 16 | SetObjectVisualTransform(oTarget, OBJECT_VISUAL_TRANSFORM_SCALE, fScale); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /tools/x3_dm_tool02.nss: -------------------------------------------------------------------------------- 1 | #include "anph_inc" 2 | #include "nwnx_time" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | if (oTarget == OBJECT_INVALID) 9 | { 10 | SendMessageToPC(oUser, "This tool is used to shrink an object, must target a valid object."); 11 | return; 12 | } 13 | 14 | float fScale = GetObjectVisualTransform(oTarget, OBJECT_VISUAL_TRANSFORM_SCALE); 15 | fScale -= 0.02; 16 | SetObjectVisualTransform(oTarget, OBJECT_VISUAL_TRANSFORM_SCALE, fScale); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /tools/x3_dm_tool08.nss: -------------------------------------------------------------------------------- 1 | #include "anph_inc" 2 | #include "nwnx_time" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | 9 | if (GetObjectType(oTarget) != OBJECT_TYPE_CREATURE || GetIsPC(oTarget)) 10 | { 11 | SendMessageToPC(oUser, "NPC randomizer tool should only be used on (NPC) creatures"); 12 | return; 13 | } 14 | 15 | string sWhat = GetStringUpperCase(chr_GetPlayerChatMessage(oUser)); 16 | 17 | string sMsg = ""; 18 | 19 | if (FindSubString(sWhat, "G") >= 0) sMsg += " Gender"; 20 | if (FindSubString(sWhat, "R") >= 0) sMsg += " Race"; 21 | if (FindSubString(sWhat, "N") >= 0) sMsg += " Name"; 22 | if (FindSubString(sWhat, "S") >= 0) sMsg += " Scaling"; 23 | if (FindSubString(sWhat, "L") >= 0) sMsg += " Levels"; 24 | if (FindSubString(sWhat, "A") >= 0) sMsg += " Armor"; 25 | if (FindSubString(sWhat, "W") >= 0) sMsg += " Weapons"; 26 | if (FindSubString(sWhat, "H") >= 0) sMsg += " Head"; 27 | if (FindSubString(sWhat, "C") >= 0) sMsg += " Color"; 28 | if (FindSubString(sWhat, "P") >= 0) sMsg += " PhenoType"; 29 | 30 | if (sMsg != "") 31 | { 32 | SendMessageToPC(oUser, "Randomizing: " + sMsg); 33 | SetLocalString(oTarget, "NPC_RANDOMIZE", sWhat); 34 | ExecuteScript("npc_randomize", oTarget); 35 | } 36 | else 37 | { 38 | SendMessageToPC(oUser, "Speak any of GRNSLAWHPC to randomize the NPC:\n" + 39 | "G: Gender\n" + 40 | "R: Race\n" + 41 | "N: Name\n" + 42 | "S: Scaling\n" + 43 | "L: Levels\n" + 44 | "A: Armor\n" + 45 | "W: Weapons\n"+ 46 | "H: Head\n"+ 47 | "P: PhenoType\n"+ 48 | "C: Color\n" 49 | ); 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /tools/x3_dm_tool09.nss: -------------------------------------------------------------------------------- 1 | #include "anph_inc" 2 | #include "nwnx_time" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | 9 | 10 | if (oTarget == oUser) 11 | { 12 | SendMessageToPC(oUser, "Cloning tool disarmed. Use it again to pick an object to clone (select ground for areas)"); 13 | DeleteLocalObject(oUser, "DMTOOL_CLONE_OBJECT"); 14 | return; 15 | } 16 | 17 | 18 | object oToClone = GetLocalObject(oUser, "DMTOOL_CLONE_OBJECT"); 19 | if (!GetIsObjectValid(oToClone)) 20 | { 21 | if (oTarget == OBJECT_INVALID) 22 | { 23 | oTarget = GetAreaFromLocation(GetSpellTargetLocation()); 24 | } 25 | else if (GetObjectType(oTarget) != OBJECT_TYPE_CREATURE && GetObjectType(oTarget) != OBJECT_TYPE_ITEM) 26 | { 27 | SendMessageToPC(oUser, "Only creatures, items and ground (areas) can be cloned with this tool."); 28 | return; 29 | } 30 | 31 | SetLocalObject(oUser, "DMTOOL_CLONE_OBJECT", oTarget); 32 | SendMessageToPC(oUser, "Cloning " + GetName(oTarget) + ". Use the tool again and select the location."); 33 | SendMessageToPC(oUser, "If you're cloning an area, select any location."); 34 | return; 35 | } 36 | else 37 | { 38 | if (GetObjectType(oToClone) == OBJECT_TYPE_CREATURE) 39 | { 40 | CopyObject(oToClone, GetSpellTargetLocation()); 41 | } 42 | if (GetObjectType(oToClone) == OBJECT_TYPE_ITEM) 43 | { 44 | if (GetIsObjectValid(oTarget)) 45 | { 46 | CopyItem(oToClone, oTarget, TRUE); 47 | SendMessageToPC(oUser, GetName(oToClone) + " cloned into " + GetName(oTarget) + "'s inventory."); 48 | } 49 | else 50 | CopyObject(oToClone, GetSpellTargetLocation()); 51 | } 52 | else if (GetIsAreaNatural(oToClone) != AREA_INVALID) 53 | { 54 | string sName = GetName(oToClone); 55 | if (sName == "Axfell" || sName == "Fort Cleaven" || sName == "Ranzington") 56 | { 57 | SendMessageToPC(oUser, "Bad! Don't use this to clone fort areas, other systems might get messed"); 58 | SendMessageToPC(oUser, "(if you really know what you're doing, you know how to bypass this)"); 59 | return; 60 | } 61 | CreateArea(GetResRef(oToClone), "", " Clone - " + GetName(oToClone)); 62 | SendMessageToPC(oUser, "Area cloned as ' Clone - "+ GetName(oToClone)+"', find it in the Chooser"); 63 | } 64 | 65 | SendMessageToPC(oUser, "Note that your tool is still armed, and you can create more clones. Use on self to disarm."); 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /tools/x3_dm_tool10.nss: -------------------------------------------------------------------------------- 1 | #include "anph_inc" 2 | #include "nwnx_time" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | if (!GetIsPC(oTarget)) 9 | { 10 | SendMessageToPC(oUser, "This tool is used to get detailed PC info, must target a PC."); 11 | return; 12 | } 13 | 14 | SendMessageToPC(oUser, "------------------------------------------"); 15 | SendMessageToPC(oUser, anph_DescribePC(oTarget)); 16 | 17 | 18 | int nPCID = chr_GetPCID(oTarget); 19 | NWNX_SQL_ExecuteQuery("SELECT Deaths, PVPKills, Playtime, DonatedStuff, IsDead FROM " 20 | +SQL_TABLE_CHARDATA+" WHERE PCID="+IntToString(nPCID)); 21 | 22 | if (NWNX_SQL_ReadyToReadNextRow()) 23 | { 24 | NWNX_SQL_ReadNextRow(); 25 | string sDeaths = NWNX_SQL_ReadDataInActiveRow(0); 26 | string sPVPKills = NWNX_SQL_ReadDataInActiveRow(1); 27 | string sPlaytime = NWNX_SQL_ReadDataInActiveRow(2); 28 | string sDonated = NWNX_SQL_ReadDataInActiveRow(3); 29 | string sIsDead = NWNX_SQL_ReadDataInActiveRow(4); 30 | 31 | SendMessageToPC(oUser, "Total deaths:"+sDeaths + "; Total PvP Kills:"+sPVPKills + 32 | "; Total playtime: "+sPlaytime+" seconds (~" + IntToString((StringToInt(sPlaytime)+1800) / 3600) + " hours)" + 33 | "; Total gear donated worth: " + sDonated + "; IsDead:" + sIsDead); 34 | } 35 | 36 | int tNow = NWNX_Time_GetTimeStamp(); 37 | int tLastFlush = GetLocalInt(oTarget, "XP_LastFlush"); 38 | int nUnflushed = GetLocalInt(oTarget, "XP_Unflushed"); 39 | int nBanked = GetLocalInt(oTarget, "XP_Banked"); 40 | int nLost = GetLocalInt(oTarget, "XP_Lost"); 41 | float fMod = GetLocalFloat(oTarget, "XP_Multipler"); 42 | SendMessageToPC(oUser, "\nXP system data: " + 43 | IntToString(tNow - tLastFlush) + "s (~" + IntToString((tNow - tLastFlush+1800)/3600) + " hours) since flush. " + 44 | IntToString(nUnflushed) + " unflushed XP, " + 45 | IntToString(nBanked) + " banked XP, " + 46 | IntToString(nLost) + " lost XP, " + 47 | " personal XP multiplier: " + FloatToString(fMod, 3, 2)); 48 | 49 | SendMessageToPC(oUser, "------------------------------------------"); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /tools/x3_pl_tool08.nss: -------------------------------------------------------------------------------- 1 | #include "dev_inc" 2 | #include "chr_inc" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | 9 | // Team members can rename anything.. 10 | if (!dev_IsTeamMember(oUser)) 11 | { 12 | dbg_ReportBug("Team-only tool used. How did you get this?", oUser); 13 | return; 14 | } 15 | 16 | if (oTarget == OBJECT_INVALID || oTarget == OBJECT_SELF) 17 | { 18 | SendMessageToPC(oUser, "You will now speak normally."); 19 | DeleteLocalObject(oUser, "SPEAK_THROUGH_OTHER"); 20 | } 21 | else 22 | { 23 | SetLocalObject(oUser, "SPEAK_THROUGH_OTHER", oTarget); 24 | SendMessageToPC(oUser, "You will now speak through " + GetName(oTarget)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/x3_pl_tool09.nss: -------------------------------------------------------------------------------- 1 | #include "dev_inc" 2 | #include "chr_inc" 3 | 4 | void main() 5 | { 6 | object oUser = OBJECT_SELF; 7 | object oTarget = GetSpellTargetObject(); 8 | 9 | // Team members can rename anything.. 10 | if (!dev_IsTeamMember(oUser)) 11 | { 12 | if (GetObjectType(oTarget) != OBJECT_TYPE_ITEM || GetItemPossessor(oTarget) != oUser) 13 | { 14 | SendMessageToPC(oUser, "This tool is used to rename an item you own. Must target an item in your possession"); 15 | return; 16 | } 17 | } 18 | 19 | if (oTarget == OBJECT_INVALID) 20 | oTarget = GetAreaFromLocation(GetSpellTargetLocation()); 21 | 22 | string sOldName = GetName(oTarget); 23 | string sMsg = chr_GetPlayerChatMessage(oUser); 24 | 25 | SendMessageToPC(oUser, "Renaming " + sOldName + " to " + sMsg); 26 | SetName(oTarget, sMsg); 27 | } 28 | -------------------------------------------------------------------------------- /tools/x3_pl_tool10.nss: -------------------------------------------------------------------------------- 1 | // Anphillia UNSTUCK Tool. 2 | 3 | #include "dbg_inc" 4 | #include "util_inc" 5 | #include "color_inc" 6 | #include "dev_inc" 7 | void main() 8 | { 9 | object oPC = OBJECT_SELF; 10 | location loc = GetSpellTargetLocation(); 11 | 12 | string sMsg = "UNSTUCK tool used. Source:"+util_EncodeLocation(GetLocation(oPC)) + " Target:"+util_EncodeLocation(loc) + " PC:"+GetName(oPC) + "(" + GetPCPublicCDKey(oPC) + ")"; 13 | WriteTimestampedLogEntry(sMsg); 14 | if (!dev_IsTeamMember(oPC)) 15 | dbg_Warning(sMsg, oPC); 16 | SendMessageToPC(oPC, COLOR_CODE_ORANGE_LIGHT+"UNSTUCK tool used. This tool is OOC and should only be used for fixing bugs when a PC gets stuck. Every use is logged and abuse will be punished." + COLOR_CODE_END); 17 | 18 | AssignCommand(oPC, JumpToLocation(loc)); 19 | } 20 | -------------------------------------------------------------------------------- /utils/anph_gate_closed.nss: -------------------------------------------------------------------------------- 1 | void main() 2 | { 3 | // Automatically lock the door after it was close if it's not bashed in 4 | if (GetLockKeyTag(OBJECT_SELF) != "door_Bashed_NoKey") 5 | SetLocked (OBJECT_SELF, TRUE); 6 | } 7 | -------------------------------------------------------------------------------- /utils/anph_gate_ondmg.nss: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // anph_gate_ondmg 3 | // written by: eyesolated 4 | // written at: May 19, 2018 5 | // 6 | // Notes: Deals with bashing in doors 7 | 8 | // Defines how long a door takes to regenerate. The Health of the door is multiplied 9 | // with this value to get the seconds until it is fully healed/repaired again 10 | const int DOOR_HITPOINTS_DELAY_MULTIPLIER = 1; 11 | 12 | const string DOOR_VAR_HITPOINTS = "Hitpoints"; 13 | const string DOOR_VAR_KEYTAG = "door_KeyTag"; 14 | 15 | // this const is also used in "anph_close_door" and "anph_gate_closed", 16 | // be sure to change it there as well if you change it here 17 | const string DOOR_KEYTAG_BASHED = "door_Bashed_NoKey"; 18 | 19 | #include "nwnx_webhook" 20 | #include "nwnx_time" 21 | const string WEBHOOK_ALARM = "/api/webhooks/451346097038819329/th1si5n0tar43lAPiK3y-n3v3rPuTaPiKEY5inS0urceRep0_Y_amIap0tat0lalalaF/slack"; 22 | 23 | void door_Repaired(object oDoor) 24 | { 25 | // Change the Key Tag 26 | SetLockKeyTag(oDoor, GetLocalString(oDoor, DOOR_VAR_KEYTAG)); 27 | 28 | // Open the door 29 | ActionCloseDoor(oDoor); 30 | 31 | // Lock the door again 32 | SetLocked(oDoor, TRUE); 33 | 34 | // Make the door NOT PLOT so it can be damaged again 35 | SetPlotFlag(oDoor, FALSE); 36 | } 37 | 38 | void main() 39 | { 40 | object oDoor = OBJECT_SELF; 41 | int nRealMaxHitPoints = GetLocalInt(oDoor, DOOR_VAR_HITPOINTS); 42 | int nCurrentHitPoints = GetCurrentHitPoints(oDoor); 43 | int nMaxHitPoints = GetMaxHitPoints(oDoor); 44 | 45 | int nTimestamp = NWNX_Time_GetTimeStamp(); 46 | int nLastAlarmTime = GetLocalInt(oDoor, "LAST_ALARM_TIME"); 47 | int nDisableDiscord = GetLocalInt(oDoor, "Discord_Disable"); 48 | if (nDisableDiscord == 0 && 49 | (nTimestamp - nLastAlarmTime) > 30) // 30 seconds between alarms 50 | { 51 | SetLocalInt(oDoor, "LAST_ALARM_TIME", nTimestamp); 52 | string sMessage = "Gate under attack!"; 53 | NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_ALARM, sMessage, GetTag(oDoor)); 54 | } 55 | 56 | if (!GetPlotFlag(oDoor) && 57 | nCurrentHitPoints < (nMaxHitPoints - nRealMaxHitPoints)) // The door is below it's max hitpoings 58 | { 59 | // Remember the keytag to open the door when it's not bashed in 60 | SetLocalString(oDoor, DOOR_VAR_KEYTAG, GetLockKeyTag(oDoor)); 61 | 62 | // Change the Key Tag 63 | SetLockKeyTag(oDoor, DOOR_KEYTAG_BASHED); 64 | 65 | // Unlock the door 66 | SetLocked(oDoor, FALSE); 67 | 68 | // Open the door 69 | ActionOpenDoor(oDoor); 70 | 71 | // Make the door PLOT so it can't be damaged any more 72 | SetPlotFlag(oDoor, TRUE); 73 | 74 | // Heal the door to full 75 | ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nRealMaxHitPoints), oDoor); 76 | 77 | // Close the door again after a delay 78 | DelayCommand(IntToFloat(nRealMaxHitPoints * DOOR_HITPOINTS_DELAY_MULTIPLIER), door_Repaired(oDoor)); 79 | 80 | if (nDisableDiscord == 0) 81 | { 82 | string sMessage = "Gate has been breached!"; 83 | NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_ALARM, sMessage, GetTag(oDoor)); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /utils/color_inc.nss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtijanic/anphillia/937f2ada171c11f0ce24f004282faa5e579cdb95/utils/color_inc.nss -------------------------------------------------------------------------------- /utils/dbg_inc.nss: -------------------------------------------------------------------------------- 1 | #include "nwnx_webhook" 2 | #include "color_inc" 3 | 4 | 5 | const string WEBHOOK_BUG = "/api/webhooks/453873022315659275/th1si5n0tar43lAPiK3y-n3v3rPuTaPiKEY5inS0urceRep0_Y_amIap0tat0lalalaF/slack"; 6 | 7 | // Report a bug, sending it everywhere 8 | void dbg_ReportBug(string sMessage, object oReporter=OBJECT_INVALID); 9 | // Print a warning 10 | void dbg_Warning(string sMessage, object oReporter=OBJECT_INVALID); 11 | 12 | string dbg_GetReporterInfo(object oReporter); 13 | 14 | string dbg_GetReporterInfo(object oReporter) 15 | { 16 | if (GetIsObjectValid(oReporter)) 17 | { 18 | return GetName(oReporter) + "(" + (GetIsPC(oReporter) ? GetPCPublicCDKey(oReporter) : GetTag(oReporter)) + ")" 19 | + " @ " + GetName(GetArea(oReporter)) + "(" + GetTag(GetArea(oReporter)) + ")"; 20 | } 21 | return ""; 22 | } 23 | 24 | void dbg_ReportBug(string sMessage, object oReporter=OBJECT_INVALID) 25 | { 26 | string sPrefix = "[BUG] " + dbg_GetReporterInfo(oReporter); 27 | string sBug = sPrefix + "\n" + sMessage; 28 | string sBugColor = COLOR_CODE_RED + sBug + COLOR_CODE_END; 29 | 30 | WriteTimestampedLogEntry(sBug); 31 | SendMessageToAllDMs(sBugColor); 32 | if (GetIsPC(oReporter)) SendMessageToPC(oReporter, sBugColor); 33 | NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_BUG, sMessage, "BUG - " + GetName(oReporter)); 34 | } 35 | 36 | void dbg_Warning(string sMessage, object oReporter=OBJECT_INVALID) 37 | { 38 | string sPrefix = "[WARNING] " + dbg_GetReporterInfo(oReporter); 39 | string sBug = sPrefix + "\n" + sMessage; 40 | string sBugColor = COLOR_CODE_ORANGE + sBug + COLOR_CODE_END; 41 | 42 | WriteTimestampedLogEntry(sBug); 43 | SendMessageToAllDMs(sBugColor); 44 | if (GetIsPC(oReporter)) SendMessageToPC(oReporter, sBugColor); 45 | NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_BUG, sMessage, "Warning - " + GetName(oReporter)); 46 | } 47 | -------------------------------------------------------------------------------- /utils/dev_inc.nss: -------------------------------------------------------------------------------- 1 | 2 | int dev_IsTeamMember(object oPC); 3 | 4 | int dev_IsTeamMember(object oPC) 5 | { 6 | if (GetIsDM(oPC) || GetIsDMPossessed(oPC)) 7 | return TRUE; 8 | 9 | string sCDKey = GetPCPublicCDKey(oPC); 10 | if (sCDKey == "XXXXXXXX" || // Zerak 11 | sCDKey == "XXXXXXXX" || // Sherincall 12 | sCDKey == "XXXXXXXX" || // Samurai 13 | sCDKey == "XXXXXXXX" || // PastorPug 14 | sCDKey == "XXXXXXXX" || // Styke 15 | sCDKey == "XXXXXXXX" || // eyesolated 16 | // Trusted players: 17 | sCDKey == "XXXXXXXX" || // Goodpart 18 | sCDKey == "XXXXXXXX" // Lux 19 | ) 20 | return TRUE; 21 | 22 | return FALSE; 23 | } 24 | -------------------------------------------------------------------------------- /utils/flavor_enter.nss: -------------------------------------------------------------------------------- 1 | #include "color_inc" 2 | #include "util_inc" 3 | #include "dbg_inc" 4 | 5 | 6 | void main() 7 | { 8 | object oTrigger = OBJECT_SELF; 9 | object oPC = GetEnteringObject(); 10 | 11 | string sText = ""; 12 | 13 | if (GetLocalInt(oTrigger, "FLAVOR_ONCE_PER_PC")) 14 | { 15 | if (GetLocalInt(oPC, "FLAVOR_TEXT_" + ObjectToString(oTrigger))) 16 | return; 17 | SetLocalInt(oPC, "FLAVOR_TEXT_" + ObjectToString(oTrigger), 1); 18 | } 19 | 20 | switch (util_GetDayPeriod()) 21 | { 22 | case PERIOD_DAY: sText = GetLocalString(oTrigger, "FLAVOR_TEXT_DAY"); break; 23 | case PERIOD_NIGHT: sText = GetLocalString(oTrigger, "FLAVOR_TEXT_NIGHT"); break; 24 | case PERIOD_DAWN: sText = GetLocalString(oTrigger, "FLAVOR_TEXT_DAWN"); break; 25 | case PERIOD_DUSK: sText = GetLocalString(oTrigger, "FLAVOR_TEXT_DUSK"); break; 26 | } 27 | 28 | if (sText == "") 29 | sText = GetLocalString(oTrigger, "FLAVOR_TEXT"); 30 | if (sText == "") 31 | { 32 | dbg_Warning("Terrain trigger string not found", oPC); 33 | return; 34 | } 35 | 36 | // Apply color effects 37 | string sRGB = GetLocalString(oTrigger, "FLAVOR_TEXT_RGB"); 38 | if (sRGB != "") 39 | sText = color_ConvertString(sText, sRGB); 40 | 41 | // Send the message to the PC 42 | FloatingTextStringOnCreature(sText, oPC, FALSE); 43 | } 44 | -------------------------------------------------------------------------------- /utils/terrain_exit.nss: -------------------------------------------------------------------------------- 1 | //#include "terrain_inc" 2 | //#include "color_inc" 3 | 4 | void main() 5 | { 6 | object oCreature = GetExitingObject(); 7 | if (GetIsDM(oCreature)) 8 | return; 9 | 10 | object oTrigger = OBJECT_SELF; 11 | effect eEffect = GetFirstEffect(oCreature); 12 | while (GetEffectCreator(eEffect) != oTrigger) 13 | eEffect = GetNextEffect(oCreature); 14 | 15 | RemoveEffect(oCreature, eEffect); 16 | 17 | if(GetIsPC(oCreature)) 18 | FloatingTextStringOnCreature("Exiting special terrain, effects removed", oCreature); 19 | } 20 | -------------------------------------------------------------------------------- /xp/xp_apply.nss: -------------------------------------------------------------------------------- 1 | #include "xp_inc" 2 | 3 | void main() 4 | { 5 | xp_ApplyBankedXP(OBJECT_SELF); 6 | } 7 | -------------------------------------------------------------------------------- /xp/xp_reload.nss: -------------------------------------------------------------------------------- 1 | #include "xp_inc" 2 | 3 | void _initDefaults() 4 | { 5 | // These will fail if anything exists in the database 6 | int lvl; 7 | for (lvl = 1; lvl <= 16; lvl++) 8 | NWNX_SQL_ExecuteQuery("INSERT INTO "+SQL_TABLE_XPDATA+" (Level) VALUES("+IntToString(lvl)+")"); 9 | } 10 | void main() 11 | { 12 | WriteTimestampedLogEntry("XP reload"); 13 | _initDefaults(); 14 | xp_ReloadTables(); 15 | } 16 | --------------------------------------------------------------------------------