Ranged Weapons and Ammunition

From Dragon Age Toolset Wiki
Jump to: navigation, search

This article explains the relationship between ranged weapons and their ammunition types, how default ammo works, and how the weapon and ammunition (quiver) models and variants interrelate. This discussion applies to all four standard ranged weapons in Dragon Age: longbows, shortbows, crossbows, and staffs; and to their associated ammo types: arrows, bolts, and staff projectiles.

Defining and Linking Weapons and Ammunition

Weapon types are defined in the BITM_base.xls 2da. There are two fields of importance for ranged weapons:

  • Type - This is a value from the _ItemTypes worksheet; bows use ITEM_TYPE_WEAPON_RANGED and staffs use ITEM_TYPE_WEAPON_MAGIC. (I think this determines the base hit model; ranged weapon types can miss but can also crit, while magic weapon types cannot miss but also cannot crit).
  • Ammo - This is a reference to the ID in BITM_base.xls of the ammunition type that the weapon uses. For instance, longbows and shortbows use the arrow ammo type, crossbows use the bolt ammo type, and staffs use the staff projectile ammo type.

Ammo types are also defined in the BITM_base.xls 2da. There are three fields of note for ammunition:

  • Type - This is a value from the _ItemTypes worksheet; ammo uses ITEM_TYPE_AMMO.
  • DefaultResource - This is a string that matches the tag of the default ammunition item to use when no ammunition is equipped. The default arrow type is "gen_im_arrow", the default bolt is "gen_im_bolt", and the default staff projectile is "gen_im_staff_projectile". These default ammo items can all be found in the _Global/HOLDING item folder in the toolset.
  • Projectile - This is the ID of an entry in the PRJ_base.xls 2da, which defines the projectile model/animation to use for the ammo as well as base modifiers to damage. The value defined here can be changed for a specific item by setting the PROJECTILE_OVERRIDE variable on that item's UTI definition to a different projectile ID. This variable should be set on the weapon that uses the ammo, not the ammo item itself.

When a ranged or magic weapon is equipped, the player's ammunition slot is automatically populated with an instance of the ammo's default resource. This item cannot be unequipped and is never consumed, which is how the infinite default arrow/bolt/staff projectiles work.

Item and Ammunition Variations and Models

The model that is displayed for ammunition is independent of the model displayed for the weapon itself. In the case of arrows and bolts, the quiver models are shown whenever arrows or bolts are equipped, even if no weapon is equipped. This can be verified by equipping special ammo types like Ice Arrows with no weapon equipped.

However, when equipping an ammo using weapon, like a bow, the infinite default resource ammunition item is automatically created/equipped as well, so the quiver displays even when no specific arrows are equipped. The game is behaving as though a gen_im_arrow item is equipped, and displaying its model.

You can create new arrow and bolt variations using the ItemVariations.xls 2da, which are actually variants of the quiver model shown on the back. (TODO - I'm not sure how the location/attachment point of the quiver model is defined for arrows/bolts, and why it's not defined for staff projectiles, other than that arrows/bolts have item variation worksheets and staff projectiles don't). If you were then to create new arrow items in the toolset that use your custom quiver variant, your custom quiver would be shown when that ammo is equipped. (To actually change the arrow/bolt models shown in-flight, you would instead need to create a new projectile type in PRJ_base.xls, then assign that projectile to your ammo or override the projectile for a specific weapon).

The longbow, shortbow, and crossbow item variation 2da's have an extra column called DefaultAmmoVariation that links to an ID in the arrow/bolt variant 2das. The default infinite ammo resource that is created when you equip that weapon will use the variant ID specified here. For example, if you had created a custom arrow variant (quiver), you could then create a custom bow variant that specifies your custom arrow variant ID in this field, and that is the quiver model that will be shown when the bow is equipped with the default infinite ammo.

Unfortunately the limitation is that non-default ammo items like Ice Arrows, Fire Arrows, etc., are actually separate ammo items and do not reflect the DefaultAmmoVariation specified in the weapon variant. These items instead have their variant defined based on their UTI definition, just like any other item. This means that when one of these ammo types is equipped, the custom quiver variant being displayed for the default ammo will disappear and the ammo item will display the generic quiver since that is the variant it uses.

There is no perfectly clean solution for handling this. You can override the item variant for all of the non-default ammo items, but that will cause your custom quiver variant to display when that ammo is equipped on any PC/NPC, regardless of the bow they are using.

Another option is to create duplicate versions of all the ammo items and change those duplicates to use your custom ammo variant. If you used these items instead of the normal ammo items, you would then see the custom quiver. Of course this has its own problems; you have to continually produce a supply of these duplicate items for yourself (since ammo is consumed), and will not be able to use "found" ammo items since they will still be of the original item type with the default variant. This option can be expanded by providing some mechanism for converting the standard types to your custom duplicate types; e.g. you could hook the EVENT_TYPE_EQUIP event and have a script that converts ammo from the vanilla version to your duplicate custom variant version when your custom weapon is also equipped.