Arrow sticking behaviour

From The DarkMod Wiki
Jump to: navigation, search

Broadhead arrows will stick into some objects they hit. Here is a description of the logic behind whether or not an arrow sticks in.

  • The most important thing is the surface type of the object. Arrows will only stick into "soft" surfaces; for example, flesh, wood, and dirt, among others.
  • Arrows will not stick into living AIs. This is to avoid guards sauntering around with dirty great arrows sticking out of their chests, which looks silly. Note that an arrow which kills an AI will stick, even if the AI was alive before being shot.
  • Arrows will not stick into objects attached to living AIs, principally because this includes AI heads.
  • You can override some of these rules using two spawnargs, arrowsticking_forceenabled and arrowsticking_disabled, which are documented below.

Overriding arrow-sticking behaviour

To force arrows to never stick in an entity, set the spawnarg arrowsticking_disabled like so: "arrowsticking_disabled" "1"

  • Usage example: There are sometimes instability problems with certain ragdolls (AFs) when they have arrows fired into them. arrowsticking_disabled provides a quick and dirty way to get around this.

To force arrows to always stick in an entity, provided that the surface type is soft, you can set the spawnarg arrowsticking_forceenabled like so: "arrowsticking_forceenabled" "1". However, arrows will still break rather than sticking into the entity's hard surfaces, if it has any.

  • Usage example: Suppose you've given an AI a wooden shield to carry. Since the shield is attached to the AI, arrows won't normally stick in it, according to the rules above. To fix this, you can set "arrowsticking_forceenabled" "1" on the shield.

AI heads are usually separate entities from AI bodies, so if you change these spawnargs for an AI entity make sure to also change the spawnargs for its head entity (if it has one).

Info for coders

This logic is in tdm_weapon_arrow_result_base.script. The active() method is called when an arrow hits a soft surface; dud() is called if it hits a hard surface.