</code></pre></div></div> <h2 id="adjustpoison"><ahref="#adjustpoison"class="anchor-heading"aria-labelledby="adjustpoison"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> AdjustPoison </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ADJUSTPOISON</code> (hs_adjustpoison.int)</p><p>Runs when a critter’s poison level is changed, or when the player takes damage from the poison.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter
</code></pre></div></div><h2id="afterhitroll"><ahref="#afterhitroll"class="anchor-heading"aria-labelledby="afterhitroll"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> AfterHitRoll </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_AFTERHITROLL</code> (hs_afterhitroll.int)</p><p>Runs after Fallout has decided if an attack will hit or miss.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - If the attack will hit: 0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit
</code></pre></div></div><h2id="ammocost"><ahref="#ammocost"class="anchor-heading"aria-labelledby="ammocost"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> AmmoCost </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_AMMOCOST</code> (hs_ammocost.int)</p><p>Runs when calculating ammo cost for a weapon. Doesn’t affect damage, only how much ammo is spent.<br/> By default, weapons can make attacks when at least 1 ammo is left, regardless of ammo cost calculations.<br/> To add proper check for ammo before attacking and proper calculation of the number of burst rounds (hook type 1 and 2 in <codeclass="language-plaintext highlighter-rouge">arg3</code>), set <strong>CheckWeaponAmmoCost=1</strong> in <strong>Misc</strong> section of ddraw.ini.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Item arg0 - The weapon
int arg1 - Number of bullets in burst or 1 for single shots
int arg2 - The amount of ammo that will be consumed, calculated by the original ammo cost function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
NOTE: for hook type 2, this value is the ammo cost per round (default is always 1)
int arg3 - Type of hook:
0 - when subtracting ammo after single shot attack
1 - when checking for "out of ammo" before attack
2 - when calculating number of burst rounds
3 - when subtracting ammo after burst attack
int ret0 - The new amount of ammo to be consumed, or ammo cost per round for hook type 2 (set to 0 for unlimited ammo)
</code></pre></div></div><h2id="barterprice"><ahref="#barterprice"class="anchor-heading"aria-labelledby="barterprice"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> BarterPrice </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_BARTERPRICE</code> (hs_barterprice.int)</p><p>Runs whenever the value of goods being purchased is calculated.</p><p>NOTE: the hook is executed twice when entering the barter screen or after transaction: the first time is for the player and the second time is for NPC.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter doing the bartering (either dude_obj or inven_dude)
</code></pre></div></div><h2id="bestweapon"><ahref="#bestweapon"class="anchor-heading"aria-labelledby="bestweapon"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> BestWeapon </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_BESTWEAPON</code> (hs_bestweapon.int)</p><p>Runs when the AI decides which weapon is the best while searching the inventory for a weapon to equip in combat. This also runs when the player presses the “Use Best Weapon” button on the party member control panel.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter searching for a weapon
</code></pre></div></div><h2id="calcapcost"><ahref="#calcapcost"class="anchor-heading"aria-labelledby="calcapcost"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> CalcAPCost </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_CALCAPCOST</code> (hs_calcapcost.int)</p><p>Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn’t run for using other item types or moving.<br/> Note that the first time a game is loaded, this script doesn’t run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player’s hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.<br/> You can get the weapon object by checking item slot based on attack type (<codeclass="language-plaintext highlighter-rouge">ATKTYPE_LWEP1</code>, <codeclass="language-plaintext highlighter-rouge">ATKTYPE_LWEP2</code>, etc) and then calling <codeclass="language-plaintext highlighter-rouge">critter_inven_obj</code>.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The critter performing the action
</code></pre></div></div><h2id="canuseweapon"><ahref="#canuseweapon"class="anchor-heading"aria-labelledby="canuseweapon"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> CanUseWeapon </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_CANUSEWEAPON</code> (hs_canuseweapon.int)</p><p>Run when the AI checks whether it can use a weapon. This mostly happens when NPCs try to find weapons in their inventory or on the map.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter doing the check
</code></pre></div></div><h2id="combatdamage"><ahref="#combatdamage"class="anchor-heading"aria-labelledby="combatdamage"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> CombatDamage </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_COMBATDAMAGE</code> (hs_subcombatdmg.int)</p><p>Runs when:</p><ol><li>Game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts). This happens BEFORE the actual attack animation.</li><li>AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.</li></ol><p>Does not run for misses, or non-combat damage like dynamite explosions.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The target
int arg8 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
int arg9 - Number of bullets actually hit the target (1 for melee attacks)
int arg10 - The amount of knockback to the target
int arg11 - Attack Type (see ATKTYPE_* constants)
mixed arg12 - computed attack data (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
int ret0 - The damage to the target
int ret1 - The damage to the attacker
int ret2 - The special effect flags for the target
int ret3 - The special effect flags for the attacker
</code></pre></div></div><h2id="combatturn"><ahref="#combatturn"class="anchor-heading"aria-labelledby="combatturn"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> CombatTurn </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_COMBATURN</code> (hs_combatturn.int)</p><p>Runs before and after each turn in combat (for both PC and NPC).</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type:
</code></pre></div></div><h2id="deathanim1"><ahref="#deathanim1"class="anchor-heading"aria-labelledby="deathanim1"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> DeathAnim1 </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_DEATHANIM1</code> (hs_deathanim1.int)</p><p>Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees.</p><p>Does not run for critters in the knockdown/out state.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
</code></pre></div></div><h2id="deathanim2"><ahref="#deathanim2"class="anchor-heading"aria-labelledby="deathanim2"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> DeathAnim2 </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_DEATHANIM2</code> (hs_deathanim2.int)</p><p>Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than <codeclass="language-plaintext highlighter-rouge">HOOK_DEATHANIM1</code>, but performs no validation.<br/> When using <codeclass="language-plaintext highlighter-rouge">critter_dmg</code> function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with <codeclass="language-plaintext highlighter-rouge">obj_art_fid == 0x20001F5</code>.</p><p>Does not run for critters in the knockdown/out state.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
</code></pre></div></div><h2id="deprecated-hooks"><ahref="#deprecated-hooks"class="anchor-heading"aria-labelledby="deprecated-hooks"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> Deprecated hooks </h2><ul><li><codeclass="language-plaintext highlighter-rouge">hs_hexmoveblocking.int</code></li><li><codeclass="language-plaintext highlighter-rouge">hs_hexaiblocking.int</code></li><li><codeclass="language-plaintext highlighter-rouge">hs_hexshootblocking.int</code></li><li><codeclass="language-plaintext highlighter-rouge">hs_hexsightblocking.int</code></li></ul><p>Run when checking to see if a hex blocks movement or shooting. (or ai-ing, presumably…)</p><p><strong>NOTE:</strong> These hook scripts can become very CPU-intensive and you should avoid using them. For this reason, these hooks are not thoroughly supported in sfall, and may be removed in future versions.<br/> If you want to check if some tile or path is blocked, use functions: <codeclass="language-plaintext highlighter-rouge">obj_blocking_tile</code>, <codeclass="language-plaintext highlighter-rouge">obj_blocking_line</code>, <codeclass="language-plaintext highlighter-rouge">path_find_to</code>.<br/> If you want script to be called every time NPC moves by hex in combat, use <codeclass="language-plaintext highlighter-rouge">HOOK_MOVECOST</code> hook.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter doing the moving
</code></pre></div></div><h2id="descriptionobj"><ahref="#descriptionobj"class="anchor-heading"aria-labelledby="descriptionobj"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> DescriptionObj </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_DESCRIPTIONOBJ</code> (hs_descriptionobj.int)</p><p>Runs when using the examine action icon to display the description of an object. You can override the description text. An example usage would be to add an additional description to the item based on player’s stats/skills.</p><p>Does not run if the script of the object overrides the description.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Obj arg0 - the object
</code></pre></div></div><h2id="encounter"><ahref="#encounter"class="anchor-heading"aria-labelledby="encounter"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> Encounter </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ENCOUNTER</code> (hs_encounter.int)</p><p>Runs whenever a random encounter occurs (except the Horrigan meeting and scripted encounters), or when the player enters a local map from the world map. You can override the map for loading or the encounter.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 0 - when a random encounter occurs, 1 - when the player enters from the world map
</code></pre></div></div><h2id="explosivetimer"><ahref="#explosivetimer"class="anchor-heading"aria-labelledby="explosivetimer"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> ExplosiveTimer </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_EXPLOSIVETIMER</code> (hs_explosivetimer.int)</p><p>Runs after setting the explosive timer. You can override the result.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - the time in ticks set in the timer
</code></pre></div></div><h2id="findtarget"><ahref="#findtarget"class="anchor-heading"aria-labelledby="findtarget"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> FindTarget </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_FINDTARGET</code> (hs_findtarget.int)</p><p>Runs when the AI is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the AI caps of the attacker.<br/> This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way.</p><p>The return values can include critters that weren’t in the list of possible targets, but the additional targets may still be discarded later on in the combat turn if they are out of the attackers perception or the chance of a successful hit is too low. The list of possible targets often includes duplicated entries, but this is fixed in sfall 4.2.3/3.8.23. Use <codeclass="language-plaintext highlighter-rouge">set_sfall_return</code> to give the 4 targets, in order of preference. If you want to specify less than 4 targets, fill in the extra spaces with 0’s or pass -1 to skip the return value.</p><p><strong>NOTE:</strong> The engine can choose targets by the following criteria: 1) The nearest enemy to the attacker. 2) The enemy that attacked the attacker. 3) The enemy that attacked an NPC from the same team as the attacker. 4) The enemy that is attacked by an NPC from the same team as the attacker.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The attacker
</code></pre></div></div><h2id="gamemodechange"><ahref="#gamemodechange"class="anchor-heading"aria-labelledby="gamemodechange"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> GameModeChange </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_GAMEMODECHANGE</code> (hs_gamemodechange.int)</p><p>Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 1 - when the player exits the game, 0 - otherwise
</code></pre></div></div><h2id="invenwield"><ahref="#invenwield"class="anchor-heading"aria-labelledby="invenwield"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> InvenWield </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_INVENWIELD</code> (hs_invenwield.int)</p><p>Runs before causing a critter or the player to wield/unwield an armor or a weapon (except when using the inventory by PC). An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.</p><p><strong>NOTE:</strong> When replacing a previously wielded armor or weapon, the unwielding hook will not be executed. If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - critter
</code></pre></div></div><h2id="inventorymove"><ahref="#inventorymove"class="anchor-heading"aria-labelledby="inventorymove"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> InventoryMove </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_INVENTORYMOVE</code> (hs_inventorymove.int)</p><p>Runs before moving items between inventory slots in dude interface. You can override the action.</p><p>What you can NOT do with this hook:</p><ul><li>force moving items to inappropriate slots (like gun in armor slot) What you can do:</li><li>restrict player from using specific weapons or armors</li><li>add AP costs for all inventory movement including reloading</li><li>apply or remove some special scripted effects depending on PC’s armor</li></ul><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - Target slot:
</code></pre></div></div><p>Notes for the event of dropping items on the ground:</p><ul><li>the event is called for each item when dropping multiple items from the stack</li><li>for ammo type items, the number of dropped ammo in a pack can be found by using the <codeclass="language-plaintext highlighter-rouge">get_weapon_ammo_count</code> function</li><li>for the <codeclass="language-plaintext highlighter-rouge">PID_BOTTLE_CAPS</code> item, the event is called only once, and the number of dropped units can be found from the value of the <codeclass="language-plaintext highlighter-rouge">OBJ_DATA_CUR_CHARGES</code> object field (or with the <codeclass="language-plaintext highlighter-rouge">get_weapon_ammo_count</code> function)</li></ul><h2id="itemdamage"><ahref="#itemdamage"class="anchor-heading"aria-labelledby="itemdamage"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> ItemDamage </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ITEMDAMAGE</code> (hs_itemdamage.int)</p><p>Runs when retrieving the damage rating of the player’s used weapon. (Which may be their fists.)</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - The default min damage
</code></pre></div></div><h2id="keypress"><ahref="#keypress"class="anchor-heading"aria-labelledby="keypress"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> KeyPress </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_KEYPRESS</code> (hs_keypress.int)</p><p>Runs once every time when any key was pressed or released.</p><ul><li>DX codes: see <strong>dik.h</strong> header or https://kippykip.com/b3ddocs/commands/scancodes.htm</li><li><ahref="http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx">VK codes</a></li></ul><p><strong>NOTE:</strong> If you want to override a key, the new key DX scancode should be the same for both pressed and released events.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 1 - pressed, 0 - released
</code></pre></div></div><h2id="mouseclick"><ahref="#mouseclick"class="anchor-heading"aria-labelledby="mouseclick"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> MouseClick </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_MOUSECLICK</code> (hs_mouseclick.int)</p><p>Runs once every time when a mouse button was pressed or released.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 1 - pressed, 0 - released
</code></pre></div></div><h2id="movecost"><ahref="#movecost"class="anchor-heading"aria-labelledby="movecost"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> MoveCost </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_MOVECOST</code> (hs_movecost.int)</p><p>Runs when calculating the AP cost of movement.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter doing the moving
</code></pre></div></div><h2id="ondeath"><ahref="#ondeath"class="anchor-heading"aria-labelledby="ondeath"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> OnDeath </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ONDEATH</code> (hs_ondeath.int)</p><p>Runs immediately after a critter dies for any reason. No return values; this is just a convenience for when you need to do something after death for a large number of different critters and don’t want to have to script each and every one of them.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The critter that just died
</code></pre></div></div><h2id="onexplosion"><ahref="#onexplosion"class="anchor-heading"aria-labelledby="onexplosion"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> OnExplosion </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ONEXPLOSION</code> (hs_onexplosion.int)</p><p>Runs when Fallout is checking all the tiles within the explosion radius for targets before an explosion occurs. The tile checking will be interrupted when 6 additional targets (critters) are received.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 1 - when checking objects within the explosion radius without causing damage (e.g. the player drops an active explosive), 0 - otherwise
</code></pre></div></div><h2id="removeinvenobj"><ahref="#removeinvenobj"class="anchor-heading"aria-labelledby="removeinvenobj"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> RemoveInvenObj </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_REMOVEINVENOBJ</code> (hs_removeinvenobj.int)</p><p>Runs when an object is removed from a container or critter’s inventory for any reason.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Obj arg0 - the owner that the object is being removed from
</code></pre></div></div><h2id="resttimer"><ahref="#resttimer"class="anchor-heading"aria-labelledby="resttimer"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> RestTimer </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_RESTTIMER</code> (hs_resttimer.int)</p><p>Runs continuously while the player is resting (using pipboy alarm clock).</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - the game time in ticks
</code></pre></div></div><h2id="rollcheck"><ahref="#rollcheck"class="anchor-heading"aria-labelledby="rollcheck"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> RollCheck </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_ROLLCHECK</code> (hs_rollcheck.int)</p><p>Runs when a game event performs a random roll to check the chance of success or failure.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type:
</code></pre></div></div><h2id="setglobalvar"><ahref="#setglobalvar"class="anchor-heading"aria-labelledby="setglobalvar"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> SetGlobalVar </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_SETGLOBALVAR</code> (hs_setglobalvar.int)</p><p>Runs when setting the value of a global variable.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - the index number of the global variable being set
</code></pre></div></div><h2id="setlighting"><ahref="#setlighting"class="anchor-heading"aria-labelledby="setlighting"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> SetLighting </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_SETLIGHTING</code> (hs_setlighting.int)</p><p>Runs before setting the light level for an object or a map. You can override the result.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Obj arg0 - the object being set, or -1 when setting the light level for a map
</code></pre></div></div><h2id="sneak"><ahref="#sneak"class="anchor-heading"aria-labelledby="sneak"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> Sneak </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_SNEAK</code> (hs_sneak.int)</p><p>Runs when the Sneak skill is activated, or when the game rolls another Sneak check after the duration for the current one is over. You can override the result of a random Sneak check or the duration time for the current result.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - Sneak check result: 1 - success, 0 - failure
</code></pre></div></div><h2id="stdprocedure"><ahref="#stdprocedure"class="anchor-heading"aria-labelledby="stdprocedure"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> StdProcedure </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_STDPROCEDURE</code> (hs_stdprocedure.int)</p><p>Runs before Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for <codeclass="language-plaintext highlighter-rouge">start</code>, <codeclass="language-plaintext highlighter-rouge">critter_p_proc</code>, <codeclass="language-plaintext highlighter-rouge">timed_event_p_proc</code>, and <codeclass="language-plaintext highlighter-rouge">map_update_p_proc</code> procedures.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - the number of the standard script handler (see define.h)
</code></pre></div></div><h2id="stdprocedureend"><ahref="#stdprocedureend"class="anchor-heading"aria-labelledby="stdprocedureend"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> StdProcedureEnd </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_STDPROCEDURE_END</code> (hs_stdprocedure.int)</p><p>Runs after Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for <codeclass="language-plaintext highlighter-rouge">start</code>, <codeclass="language-plaintext highlighter-rouge">critter_p_proc</code>, <codeclass="language-plaintext highlighter-rouge">timed_event_p_proc</code>, and <codeclass="language-plaintext highlighter-rouge">map_update_p_proc</code> procedures.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - the number of the standard script handler (see define.h)
</code></pre></div></div><h2id="steal"><ahref="#steal"class="anchor-heading"aria-labelledby="steal"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> Steal </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_STEAL</code> (hs_steal.int)</p><p>Runs when checking an attempt to steal or plant an item in other inventory using Steal skill.</p><p>This is fired before the default handlers are called, which you can override. In this case you MUST provide message of the result to player (“You steal the %s”, “You are caught planting the %s”, etc.). Example message (vanilla behavior):<br/><codeclass="language-plaintext highlighter-rouge">display_msg(sprintf(mstr_skill(570 + (isSuccess != false) + arg3 * 2), obj_name(arg2)));</code></p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - Thief
</code></pre></div></div><h2id="subcombatdamage"><ahref="#subcombatdamage"class="anchor-heading"aria-labelledby="subcombatdamage"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> SubCombatDamage </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_SUBCOMBATDAMAGE</code> (hs_subcombatdamage.int)</p><p>This hook overrides the vanilla damage calculation formula. Runs when:</p><ol><li>Before the game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts).</li><li>AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.</li></ol><p>Does not run for misses, non-combat damage like dynamite explosions, or if one of the damage formulas is selected in ddraw.ini.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the attacker
int arg4 - number of bullets actually hit the target (1 for melee attacks)
int arg5 - target's Damage Resistance (DR) value (affected by critical hit effects, perks, traits, and special unarmed attacks)
int arg6 - target's Damage Threshold (DT) value (affected by critical hit effects, perks, traits, and special unarmed attacks)
int arg7 - bonus ranged damage from the perk
int arg8 - damage multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
int arg9 - combat difficulty multiplier (125 - rough, 100 - normal, 75 - wimpy; for player or party members it's always 100)
int arg10 - the calculated amount of damage (usually 0, required when using multiple hook scripts to calculate damage and using the set_sfall_arg function)
mixed arg11 - computed attack data (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
</code></pre></div></div><h2id="targetobject"><ahref="#targetobject"class="anchor-heading"aria-labelledby="targetobject"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> TargetObject </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_TARGETOBJECT</code> (hs_targetobject.int)</p><p>Runs when the targeting cursor hovers over an object, or when the player tries to attack the target object. You can override the target object or prevent the player from attacking the chosen target.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - event type: 0 - when the targeting cursor hovers over the object, 1 - when trying to attack the target object
</code></pre></div></div><h2id="tohit"><ahref="#tohit"class="anchor-heading"aria-labelledby="tohit"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> ToHit </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_TOHIT</code> (hs_tohit.int)</p><p>Runs when Fallout is calculating the chances of an attack striking a target.<br/> Runs after the hit chance is fully calculated normally, including applying the 95% cap.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>int arg0 - The hit chance (capped)
int arg6 - Ranged flag. 1 if the hit chance calculation takes into account the distance to the target. This does not mean the attack is a ranged attack
</code></pre></div></div><h2id="useanimobj"><ahref="#useanimobj"class="anchor-heading"aria-labelledby="useanimobj"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> UseAnimObj </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_USEANIMOBJ</code> (hs_useanimobj.int)</p><p>Runs before playing the “use” (usually “magic hands”) animation when a critter uses a scenery/container object on the map, or before walking/running animation if the player is at a distance from the object.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the critter that uses an object (usually dude_obj)
</code></pre></div></div><h2id="useobj"><ahref="#useobj"class="anchor-heading"aria-labelledby="useobj"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> UseObj </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_USEOBJ</code> (hs_useobj.int)</p><p>Runs when:</p><ol><li>a critter uses an object from inventory which have “Use” action flag set or it’s an active flare or dynamite.</li><li>player uses an object from main interface</li></ol><p>This is fired before the object is used, and the relevant <codeclass="language-plaintext highlighter-rouge">use_obj</code> script procedures are run. You can disable default item behavior.</p><p><strong>NOTE:</strong> You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The user
</code></pre></div></div><h2id="useobjon"><ahref="#useobjon"class="anchor-heading"aria-labelledby="useobjon"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> UseObjOn </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_USEOBJON</code> (hs_useobjon.int)</p><p>Runs when:</p><ol><li>a critter uses an object on another critter. (Or themselves)</li><li>a critter uses an object from inventory screen AND this object does not have “Use” action flag set and it’s not active flare or explosive.</li><li>player or AI uses any drug</li></ol><p>This is fired before the object is used, and the relevant <codeclass="language-plaintext highlighter-rouge">use_obj_on</code> script procedures are run. You can disable default item behavior.</p><p><strong>NOTE:</strong> You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The target
</code></pre></div></div><h2id="useskill"><ahref="#useskill"class="anchor-heading"aria-labelledby="useskill"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> UseSkill </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_USESKILL</code> (hs_useskill.int)</p><p>Runs when using any skill on any object.</p><p>This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use <codeclass="language-plaintext highlighter-rouge">message_str_game</code> along with <codeclass="language-plaintext highlighter-rouge">sprintf</code>). Suggested use - override First Aid/Doctor skills to buff/nerf them, override Steal skill to disallow observing NPCs inventories in some cases.</p><p>Does not run if the script of the object calls <codeclass="language-plaintext highlighter-rouge">script_overrides</code> for using the skill.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - The user critter
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
</code></pre></div></div><h2id="useskillon"><ahref="#useskillon"class="anchor-heading"aria-labelledby="useskillon"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> UseSkillOn </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_USESKILLON</code> (hs_useskillon.int)</p><p>Runs before using any skill on any object. Lets you override the critter that uses the skill.</p><p><strong>NOTE:</strong> The user critter can’t be overridden when using Steal skill.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - the user critter (usually dude_obj)
</code></pre></div></div><h2id="withinperception"><ahref="#withinperception"class="anchor-heading"aria-labelledby="withinperception"><svgviewBox="0 0 16 16"aria-hidden="true"><usexlink:href="#svg-link"></use></svg></a> WithinPerception </h2><p><codeclass="language-plaintext highlighter-rouge">HOOK_WITHINPRECEPTION</code> (hs_withinperception.int)</p><p>Runs when checking if one critter sees another critter. This is used in different situations like combat AI. You can override the result.</p><p><strong>NOTE:</strong><codeclass="language-plaintext highlighter-rouge">obj_can_see_obj</code> calls this first when deciding if critter can possibly see another critter with regard to perception, lighting, sneak factors.<br/> If check fails, the end result is false. If check succeeds (e.g. critter is within perception range), another check is made if there is any blocking tile between two critters (which includes stuff like windows, large bushes, barrels, etc.) and if there is - check still fails.<br/> You can override “within perception” check by returning 0 or 1, OR, as a convenience, you can also override blocking check after the perception check by returning 2 instead. In this case you should add “line of sight” check inside your hook script, otherwise critters will detect you through walls.</p><p>This is fired after the default calculation is made.</p><divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>Critter arg0 - Watcher object