X2 inc switches

From NWN Lexicon
Jump to navigationJump to search



x2_inc_switches

This file provides a basic interface for switching different Hordes of the Underdark subsystems on/off and allows centralized access to certain "expert" functionality like overriding AI or Spellscripts.

Changing any of these switches from their default position is considered unsupported and done at your own risk.

Constants

Name Value Brief Description
CREATURE_AI_MODIFIED_COMPASSION_RATE X2_L_BEH_COMPASSION The higher value of this variable, the higher the chance that the creature will aid friendly creatures in combat.

Not that helping usually degrades the overall difficulty of an encounter, but makes it more interesting.
CREATURE_AI_MODIFIED_MAGIC_RATE X2_L_BEH_MAGIC The value of this variable (int) is added to the chance that a creature will use magic in combat.

Set to 100 for always, 0 for never.
CREATURE_AI_MODIFIED_OFFENSE_RATE X2_L_BEH_OFFENSE The higher value of this variable, the higher the chance that the creature will use offensive abilities in combat. Set to 0 to make them flee.
CREATURE_VAR_CUSTOM_AISCRIPT X2_SPECIAL_COMBAT_AI_SCRIPT See x2_ai_demo for details.
CREATURE_VAR_IMMUNE_TO_DISPEL X1_L_IMMUNE_TO_DISPEL Set to TRUE to make the creature immune to dispel magic (used for statues).
CREATURE_VAR_IS_INCORPOREAL X2_L_IS_INCORPOREAL Set this variable to TRUE on a creature to make it walk through other creatures.
CREATURE_VAR_NUMBER_OF_ATTACKS X2_L_NUMBER_OF_ATTACKS Set this variable to 1 - 6 to override the number of attacks a creature has based on its BAB.
CREATURE_VAR_PALE_MASTER_SPECIAL_ITEM X2_S_PM_SPECIAL_ITEM This allows you to script items that enhance a Palemaster's summoned creatures.

You need to put the name of a script into this variable that will be run on any creature called by the Palemaster's summon undead ability.

You can use this script to add effects to the creature.

You can use the OnEquip/OnUnEquip event hooks set this variable.
CREATURE_VAR_RANDOMIZE_NAME X2_NAME_RANDOM Setting this variable on a creature will make its use a random name.

See nw_c2_default9 for details.
CREATURE_VAR_RANDOMIZE_SPELLUSE X2_SPELL_RANDOM Setting this variable on a spellcaster creature will make its spell use a bit more random, but their spell selection may not always be appropriate to the situation anymore.
CREATURE_VAR_USE_SPAWN_AMBIENT X2_L_SPAWN_USE_AMBIENT Set to TRUE to make the creature play mobile ambient animations after spawn.
CREATURE_VAR_USE_SPAWN_AMBIENT_IMMOBILE X2_L_SPAWN_USE_AMBIENT_IMMOBILE Set to TRUE to make the creature play immobile ambient animations after spawn.
CREATURE_VAR_USE_SPAWN_SEARCH X2_L_SPAWN_USE_SEARCH Set to TRUE to make the creature activate detectmode after spawn.
CREATURE_VAR_USE_SPAWN_STEALTH X2_L_SPAWN_USE_STEALTH Set to TRUE to make the creature activate stealth mode after spawn.
DOOR_FLAG_RESIST_KNOCK X2_FLAG_DOOR_RESIST_KNOCK Doors.
ITEM_FLAG_NO_CRAFT_MODIFICATION X2_FLAG_ITEM_CRAFT_DO_NOT_MODIFY NOTE: THIS NO LONGER WORKS. TO PREVENT MODIFICATION USE THE PLOT FLAG.
MODULE_SWITCH_AOE_HURT_NEUTRAL_NPCS X0_G_ALLOWSPELLSTOHURT Toggle Area of Effect Spell behavior.

If set to TRUE, AOE Spells will hurt NPCS that are neutral to the caster if they are caught in the effect.
MODULE_SWITCH_DISABLE_AI_DISPEL_AOE X2_L_AI_NO_AOE_DISPEL If this variable is set, the AI will not use Dispel Magic against harmful AOE spells.
MODULE_SWITCH_DISABLE_ITEM_CREATION_FEATS X2_SWITCH_DISABLE_ITEMCREATION_FEATS Toggle on/off the Item Creation Feats.

Default = FALSE.

Disable the Item Creation Feats that come with Hordes of the Underdark for the module.
MODULE_SWITCH_DISABLE_SECRET_DOOR_FLASH X2_SWITCH_DISABLE_SECRET_DOOR_FLASH Setting this switch to TRUE will disable the glow of a newly found secret door used in some locations in XP2.
MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR X2_SWITCH_BEBILITH_HARDCORE_RUIN_ARMOR If set to TRUE, the Bebilith Ruin Armor ability is going to actually destroy the armor it hits.

Would be very annoying for players...
MODULE_SWITCH_ENABLE_CRAFT_WAND_50_CHARGES X2_SWITCH_ENABLE_50_WAND_CHARGES For balancing reasons the crafting system will create 50 charges on a new wand instead it will create 10 + casterlevel charges.

If you want to be "hard core rules compliant" 50 charges, enable this switch.
MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS X2_SWITCH_CROSSAREA_WALKWAYPOINTS Setting this switch to TRUE will enable the allow NPCs running between waypoints using the WalkWaypoints function to cross areas, like they did in the original NWN.

This was changed in 1.30 to use only waypoints in one area.
MODULE_SWITCH_ENABLE_INVISIBLE_GLYPH_OF_WARDING X2_SWITCH_GLYPH_OF_WARDING_INVISIBLE Setting this switch to TRUE will make the Glyph of Warding symbol disappear after 6 seconds, but the glyph will stay active....
MODULE_SWITCH_ENABLE_MULTI_HENCH_AOE_DAMAGE X2_SWITCH_MULTI_HENCH_AOE_MADNESS Multiple Henchmen: By default, henchmen will never damage each other with AoE spells.

By activating this switch, henchmen will be able to damage each other with AoE spells and potentially go on each other's throats.

Warning: Activating this switch has the potential of introducing game breaking bugs. Do not use on the official SoU campaign. Use at your own risk. Really, its dangerous!
MODULE_SWITCH_ENABLE_NPC_AOE_HURT_ALLIES X2_SWITCH_ENABLE_NPC_AOE_HURT_ALLIES Spell Targeting: Pre Hordes of the Underdark, in hardcore mode, creatures would not hurt each other with their AOE spells if they were no PCs.

Setting this switch to true, will activate the correct behavior.

Activating this on older modules can break things, unless you know what you are doing!
MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS X2_SWITCH_ENABLE_TAGBASED_SCRIPTS Setting this switch to TRUE will disable execution of tag based scripts that are enabled by default when using the standard module events (x2_mod_def_*).
MODULE_SWITCH_ENABLE_UMD_SCROLLS X2_SWITCH_ENABLE_UMD_SCROLLS Force Use Magic Device Skillchecks.

Default = FALSE except for GAME_DIFFICULTY_CORE_RULES. If switched to TRUE, a rogue has to succeed in a UMD check against DC 25 + SpellLevel in order to use a scroll.

See x2_pc_umdcheck.nss for details.
MODULE_SWITCH_EPIC_SPELLS_HURT_CASTER X2_SWITCH_EPIC_SPELLS_HURT_CASTER Some epic spells, namely Hellball, do damage to the caster. We found this too confusing in testing, so it was disabled.

You can reactivate using this flag.
MODULE_SWITCH_NO_RANDOM_MONSTER_LOOT X2_L_NOTREASURE Setting this variable to TRUE on the module will disable the call to the random loot generation in most creatures' OnSpawn script.
MODULE_SWITCH_RESTRICT_USE_POISON_TO_FEAT X2_SWITCH_RESTRICT_USE_POISON_FEAT By default, all characters can use the various poisons that can be found to poison their weapons if they win a dexterity check.

Activating this flag will restrict the use of poison to chars with the UsePoison feat only.
MODULE_SWITCH_SPELL_CORERULES_DMASTERTOUCH X2_SWITCH_SPELL_CORERULE_DMTOUCH Deathless master touch is not supposed to affect creatures of size > large but we do not check this condition by default to balance the fact that the slain creature is not raised under the command of the Palemaster.

By setting this switch to TRUE, the ability will no longer effect creatures of huge+ size.
MODULE_SWITCH_USE_XP2_RESTSYSTEM X2_SWITCH_ENABLE_XP2_RESTSYSTEM Setting this switch to TRUE will enable the XP2 Wandering Monster System for this module (if you are using the default rest script and you have set up the correct variables for each area).
MODULE_VAR_AI_NO_DISPEL_AOE_CHANCE X2_L_AI_AOE_DISPEL_CHANCE This variable allows specifying a % for NOT using dispel magic against AOEs instead fleeing.
MODULE_VAR_AI_STOP_EXPERTISE_ABUSE X2_L_STOP_EXPERTISE_ABUSE Setting this variable to TRUE will cause the Expertise/Improved Expertise modes to be disabled whenever a player is casting a spell.
MODULE_VAR_OVERRIDE_SPELLSCRIPT X2_S_UD_SPELLSCRIPT
MODULE_VAR_TAGBASED_SCRIPT_PREFIX X2_S_UD_SPELLSCRIPT
MODULE_VAR_WANDERING_MONSTER_2DA X2_WM_2DA_NAME Variable that holds the wandering monster 2da filename.
WAYPOINT_VAR_FORCE_SETFACING X2_L_WAYPOINT_SETFACING By setting this variable to TRUE on a waypoint, a creature using this waypoint as part of its WalkWaypoints routine will assume the facing of the waypoint upon reaching it.
X2_EXECUTE_SCRIPT_CONTINUE 0
X2_EXECUTE_SCRIPT_END 1
X2_ITEM_EVENT_ACQUIRE 4 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_ACTIVATE 0 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_EQUIP 1 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_ONHITCAST 3 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_SPELLCAST_AT 6 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_UNACQUIRE 5 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.
X2_ITEM_EVENT_UNEQUIP 2 Defines item messages that are routed to script files with the item tag's through the default XP2 module scripts.


Functions

Name Brief Description
ClearCreatureOverrideAIScriptTarget Deletes the flag X2_NW_I0_GENERIC_INTRUDER from a specific target.
ExecuteScriptAndReturnInt Execute sScript on oTarget returning an integer.

Do not nest this function.
GetCreatureFlag Returns a flag set on a specific object.
GetCreatureOverrideAIScriptTarget Returns the value of X2_NW_I0_GENERIC_INTRUDER.
GetDoorFlag Used to toggle custom flags on a door.
GetItemFlag Returns a flag set on an item.
GetModuleOverrideSpellScriptFinished Internal function. Returns and deletes a saved flag.
GetModuleSwitchValue Returns the value of a module switch.
GetUserDefinedItemEventNumber Get the active User Defined Item Event.
- X2_ITEM_EVENT_ACTIVATE
- X2_ITEM_EVENT_EQUIP
- X2_ITEM_EVENT_UNEQUIP
- X2_ITEM_EVENT_ONHITCAST
- X2_ITEM_EVENT_ACQUIRE
- X2_ITEM_EVENT_UNACQUIRE
- X2_ITEM_EVENT_SPELLCAST_AT
GetUserDefinedItemEventScriptName Internal function. Returns the name for the User Defined Item Event script for oItem, including possible prefixes configured by SetUserDefinedItemEventPrefix.
SetCreatureFlag Sets a flag on a specific object.
SetCreatureOverrideAIScript

Define a replacement script for DetermineCombatRound .

See x2_ai_demo for details.

SetCreatureOverrideAIScriptFinished Call this at end of your custom override AI script set via CREATURE_VAR_CUSTOM_AISCRIPT.

See x2_ai_demo for details.
SetDoorFlag Used to toggle custom flags on a door.

X2_FLAG_DOOR_RESIST_KNOCK:
-Set to 1 to prevent knock from working with feedback.
-Set to 2 to prevent knock from working without feedback.
SetExecutedScriptReturnValue Sets the return value for scripts called via ExecuteScriptAndReturnInt.

Valid values are:
- X2_EXECUTE_SCRIPT_CONTINUE - continue calling script after executed script is done.
- X2_EXECUTE_SCRIPT_END - end calling script after executed script is done.
SetItemFlag Toggles a flag's setting on an item.
SetModuleOverrideSpellscript Allows the module creator to specify a script that will be run before any spell script is run.

You can call SetModuleOverrideSpellscript() at the end of the script specified by sScriptName.

If you call this function this will prevent the original spell script (and all craft item code) from being executed.

If you do not add this line, the original spell script and/or crafting code will run in addition to your script.
SetModuleOverrideSpellScriptFinished Internal function. You can call this in the overridden spell script. If you call this, it will prevent the original spell script (and all craft item code) from being executed. If you do not add this line, the original spell script and/or crafting code will run in addition to your script.
SetModuleSwitch Used to switch between different rule implementations or to subsystems for the game.

See constants list above for more detailed information on these switches.
SetUserDefinedItemEventNumber Set the active User Defined Item Event.
- X2_ITEM_EVENT_ACTIVATE
- X2_ITEM_EVENT_EQUIP
- X2_ITEM_EVENT_UNEQUIP
- X2_ITEM_EVENT_ONHITCAST
- X2_ITEM_EVENT_ACQUIRE
- X2_ITEM_EVENT_UNACQUIRE
- X2_ITEM_EVENT_SPELLCAST_AT
SetUserDefinedItemEventPrefix This is a security feature.

If you are running a *local vault* server and you have tag based script execution enabled, people could bring items into your game that execute existing scripts.

You can set a script prefix here to prevent that.

Note that you have to add this prefix to your item scripts in the module to make them work.
SetWanderingMonster2DAFile Define the name of the 2da file which is used for the wandering monster system.


See Also


  author: Mistress, contributor: Graewerld