FindWeaponAmmo

From GECK
Jump to: navigation, search


A function added by the pp NVSE Plugin.

Description

efficient way of cycling through ammo types relative to a specific weapon. It returns the ammo for a specific weapon that is inside of an actors inventory. If passed an optional ammo form, it will search the actors inventory relative to that ammo type in that weapons Ammo List, similar to pressing 2 on the keyboard to switch ammo types. This is an

Syntax

[help]
(NextAmmo:ref) actorReference.FindWeaponAmmo weapon:ref ammo:ref

Example

rNewAmmo = Player.FindWeaponAmmo Weap9mmPistol

This will search for any available ammo type in the players inventory for the Weap9mmPistol.

Example

Keep in mind, the 9mm Pistol Ammo List has the following ammo types, in this order:

  • Ammo9mm
  • Ammo9mmP
  • Ammo9mmHollowPoint
rNewAmmo = Player.FindWeaponAmmo Weap9mmPistol Ammo9mmP

This will search the player for the next available ammo type for the 9mm pistol relative to Ammo9mmP.

The function first looks for Ammo9mmHollowPoint.

  • If the player does not have this ammo type, it moves to the next option.

It then looks for Ammo9mm.

  • If the player does not have this ammo type either, it continues.

Finally, it looks for Ammo9mmP.

  • If none of the ammo types are found in the player's inventory, the function returns a null reference.

See Also