</code></pre></div></div> <h2 id="adjustpoison"> <a href="#adjustpoison" class="anchor-heading" aria-labelledby="adjustpoison"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> AdjustPoison </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter
</code></pre></div></div> <h2 id="ammocost"> <a href="#ammocost" class="anchor-heading" aria-labelledby="ammocost"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> AmmoCost </h2> <p><code class="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 <code class="language-plaintext highlighter-rouge">arg3</code>), set <strong>CheckWeaponAmmoCost=1</strong> in <strong>Misc</strong> section of ddraw.ini.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="barterprice"> <a href="#barterprice" class="anchor-heading" aria-labelledby="barterprice"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> BarterPrice </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter doing the bartering (either dude_obj or inven_dude)
</code></pre></div></div> <h2 id="bestweapon"> <a href="#bestweapon" class="anchor-heading" aria-labelledby="bestweapon"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> BestWeapon </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter searching for a weapon
</code></pre></div></div> <h2 id="calcapcost"> <a href="#calcapcost" class="anchor-heading" aria-labelledby="calcapcost"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> CalcAPCost </h2> <p><code class="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 (<code class="language-plaintext highlighter-rouge">ATKTYPE_LWEP1</code>, <code class="language-plaintext highlighter-rouge">ATKTYPE_LWEP2</code>, etc) and then calling <code class="language-plaintext highlighter-rouge">critter_inven_obj</code>.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - The critter performing the action
</code></pre></div></div> <h2 id="canuseweapon"> <a href="#canuseweapon" class="anchor-heading" aria-labelledby="canuseweapon"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> CanUseWeapon </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter doing the check
</code></pre></div></div> <h2 id="combatdamage"> <a href="#combatdamage" class="anchor-heading" aria-labelledby="combatdamage"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> CombatDamage </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="deathanim1"> <a href="#deathanim1" class="anchor-heading" aria-labelledby="deathanim1"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> DeathAnim1 </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
</code></pre></div></div> <h2 id="deathanim2"> <a href="#deathanim2" class="anchor-heading" aria-labelledby="deathanim2"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> DeathAnim2 </h2> <p><code class="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 <code class="language-plaintext highlighter-rouge">HOOK_DEATHANIM1</code>, but performs no validation.<br /> When using <code class="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 <code class="language-plaintext highlighter-rouge">obj_art_fid == 0x20001F5</code>.</p> <p>Does not run for critters in the knockdown/out state.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
</code></pre></div></div> <h2 id="deprecated-hooks"> <a href="#deprecated-hooks" class="anchor-heading" aria-labelledby="deprecated-hooks"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Deprecated hooks </h2> <ul> <li><code class="language-plaintext highlighter-rouge">hs_hexmoveblocking.int</code></li> <li><code class="language-plaintext highlighter-rouge">hs_hexaiblocking.int</code></li> <li><code class="language-plaintext highlighter-rouge">hs_hexshootblocking.int</code></li> <li><code class="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: <code class="language-plaintext highlighter-rouge">obj_blocking_tile</code>, <code class="language-plaintext highlighter-rouge">obj_blocking_line</code>, <code class="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 <code class="language-plaintext highlighter-rouge">HOOK_MOVECOST</code> hook.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter doing the moving
</code></pre></div></div> <h2 id="descriptionobj"> <a href="#descriptionobj" class="anchor-heading" aria-labelledby="descriptionobj"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> DescriptionObj </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Obj arg0 - the object
</code></pre></div></div> <h2 id="encounter"> <a href="#encounter" class="anchor-heading" aria-labelledby="encounter"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Encounter </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="explosivetimer"> <a href="#explosivetimer" class="anchor-heading" aria-labelledby="explosivetimer"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> ExplosiveTimer </h2> <p><code class="language-plaintext highlighter-rouge">HOOK_EXPLOSIVETIMER</code> (hs_explosivetimer.int)</p> <p>Runs after setting the explosive timer. You can override the result.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - the time in ticks set in the timer
</code></pre></div></div> <h2 id="findtarget"> <a href="#findtarget" class="anchor-heading" aria-labelledby="findtarget"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> FindTarget </h2> <p><code class="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 <code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - The attacker
</code></pre></div></div> <h2 id="gamemodechange"> <a href="#gamemodechange" class="anchor-heading" aria-labelledby="gamemodechange"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> GameModeChange </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - event type: 1 - when the player exits the game, 0 - otherwise
</code></pre></div></div> <h2 id="invenwield"> <a href="#invenwield" class="anchor-heading" aria-labelledby="invenwield"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> InvenWield </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - critter
</code></pre></div></div> <h2 id="inventorymove"> <a href="#inventorymove" class="anchor-heading" aria-labelledby="inventorymove"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> InventoryMove </h2> <p><code class="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. 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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - Target slot:
</code></pre></div></div> <h2 id="itemdamage"> <a href="#itemdamage" class="anchor-heading" aria-labelledby="itemdamage"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> ItemDamage </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - The default min damage
</code></pre></div></div> <h2 id="keypress"> <a href="#keypress" class="anchor-heading" aria-labelledby="keypress"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> KeyPress </h2> <p><code class="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><a href="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - event type: 1 - pressed, 0 - released
</code></pre></div></div> <h2 id="ondeath"> <a href="#ondeath" class="anchor-heading" aria-labelledby="ondeath"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> OnDeath </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - The critter that just died
</code></pre></div></div> <h2 id="onexplosion"> <a href="#onexplosion" class="anchor-heading" aria-labelledby="onexplosion"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> OnExplosion </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="removeinvenobj"> <a href="#removeinvenobj" class="anchor-heading" aria-labelledby="removeinvenobj"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> RemoveInvenObj </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Obj arg0 - the owner that the object is being removed from
</code></pre></div></div> <h2 id="rollcheck"> <a href="#rollcheck" class="anchor-heading" aria-labelledby="rollcheck"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> RollCheck </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - event type:
</code></pre></div></div> <h2 id="setglobalvar"> <a href="#setglobalvar" class="anchor-heading" aria-labelledby="setglobalvar"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> SetGlobalVar </h2> <p><code class="language-plaintext highlighter-rouge">HOOK_SETGLOBALVAR</code> (hs_setglobalvar.int)</p> <p>Runs when setting the value of a global variable.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - the index number of the global variable being set
</code></pre></div></div> <h2 id="setlighting"> <a href="#setlighting" class="anchor-heading" aria-labelledby="setlighting"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> SetLighting </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Obj arg0 - the object being set, or -1 when setting the light level for a map
</code></pre></div></div> <h2 id="sneak"> <a href="#sneak" class="anchor-heading" aria-labelledby="sneak"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Sneak </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - Sneak check result: 1 - success, 0 - failure
</code></pre></div></div> <h2 id="stdprocedure"> <a href="#stdprocedure" class="anchor-heading" aria-labelledby="stdprocedure"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> StdProcedure </h2> <p><code class="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 <code class="language-plaintext highlighter-rouge">start</code>, <code class="language-plaintext highlighter-rouge">critter_p_proc</code>, <code class="language-plaintext highlighter-rouge">timed_event_p_proc</code>, and <code class="language-plaintext highlighter-rouge">map_update_p_proc</code> procedures.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - the number of the standard script handler (see define.h)
</code></pre></div></div> <h2 id="stdprocedureend"> <a href="#stdprocedureend" class="anchor-heading" aria-labelledby="stdprocedureend"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> StdProcedureEnd </h2> <p><code class="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 <code class="language-plaintext highlighter-rouge">start</code>, <code class="language-plaintext highlighter-rouge">critter_p_proc</code>, <code class="language-plaintext highlighter-rouge">timed_event_p_proc</code>, and <code class="language-plaintext highlighter-rouge">map_update_p_proc</code> procedures.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>int arg0 - the number of the standard script handler (see define.h)
</code></pre></div></div> <h2 id="steal"> <a href="#steal" class="anchor-heading" aria-labelledby="steal"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Steal </h2> <p><code class="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 /> <code class="language-plaintext highlighter-rouge">display_msg(sprintf(mstr_skill(570 + (isSuccess != false) + arg3 * 2), obj_name(arg2)));</code></p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - Thief
</code></pre></div></div> <h2 id="subcombatdamage"> <a href="#subcombatdamage" class="anchor-heading" aria-labelledby="subcombatdamage"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> SubCombatDamage </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="targetobject"> <a href="#targetobject" class="anchor-heading" aria-labelledby="targetobject"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> TargetObject </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="tohit"> <a href="#tohit" class="anchor-heading" aria-labelledby="tohit"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> ToHit </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="useanimobj"> <a href="#useanimobj" class="anchor-heading" aria-labelledby="useanimobj"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> UseAnimObj </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the critter that uses an object (usually dude_obj)
</code></pre></div></div> <h2 id="useobj"> <a href="#useobj" class="anchor-heading" aria-labelledby="useobj"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> UseObj </h2> <p><code class="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 <code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - The user
</code></pre></div></div> <h2 id="useobjon"> <a href="#useobjon" class="anchor-heading" aria-labelledby="useobjon"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> UseObjOn </h2> <p><code class="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 <code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - The target
</code></pre></div></div> <h2 id="useskill"> <a href="#useskill" class="anchor-heading" aria-labelledby="useskill"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> UseSkill </h2> <p><code class="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 <code class="language-plaintext highlighter-rouge">message_str_game</code> along with <code class="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 <code class="language-plaintext highlighter-rouge">script_overrides</code> for using the skill.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="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> <h2 id="useskillon"> <a href="#useskillon" class="anchor-heading" aria-labelledby="useskillon"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> UseSkillOn </h2> <p><code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - the user critter (usually dude_obj)
</code></pre></div></div> <h2 id="withinperception"> <a href="#withinperception" class="anchor-heading" aria-labelledby="withinperception"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> WithinPerception </h2> <p><code class="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> <code class="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> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Critter arg0 - Watcher object