0 of 0

File information

Last updated

Original upload

Created by

HuJohner

Uploaded by

HuJohner

Virus scan

Safe to use

Tags for this mod

About this mod

This mod adds an implementation of firearm AI to the game.

Requirements
Permissions and credits
Changelogs
PCVR version | Nomad version


Firearm AI

This mod adds an implementation of firearm AI to the game.
Back in U12 there was a very broken implementation in the game and this mod was used as a bandaid to at least make it “work”. In 1.0 this implementation was largely removed and firearm AI was nonexistent.
Enter this mod: now it not only brings back an improved version of the U12 firearm AI but also includes more features that were previously not possible.
- better range keeping / movement AI
- improved IK for better visual
- melee (eg pistol whip) when too close
- support for (fake) two handed firearms

For Modders
If you want a firearm to be used by AI you need to do two things:
1. add the AIFireable component to your item using the SDK. The aimTransform should be the transform where your bullet comes out of, so most likely end of the barrel with forward facing in the direction of the bullet travel. You then need to hook up the fireEvent to fire your weapon
2. In your item json make sure in your ItemModuleAI you have set the primary (or secondary) class to Firearm and you have RangedWeaponData in there
More detailed explanations:
AIFireable
- aimTransform: used to align the gun to aim at the target
- aimEvent: gets called when the ranged attack starts
- reloadEvent: unused at the moment
- fireEvent: gets called when the ranged attack finishes
ItemModuleAI
- primaryClass / secondaryClass: one has to be Firearm for it to be recognised as a gun, the other *can* be set to Melee if you want them to attempt a melee attack when the target is in melee range
- weaponHandling / secondaryHandling: OneHanded in most cases, TwoHanded if you want the other free hand to align with a handle. If you want to specify a specific handle you can set a custom reference on your Item component with name “FirearmSecondaryHandle” and a reference to the handle transform
- rangedWeaponData: more configuration see below
- defaultStanceInfo / stanceInfosByOffhand: used to determine the stance of the NPC while holding the weapon. I recommend using the shield one for most cases or dual for akimbo
ItemModuleAI.RangedWeaponData
- tooCloseDistance: used to determine the preferred range the AI will circle around you
- spread: every time the AI aims it will choose a random offset determined from the spread values to simulate inaccurate aiming
- projectileSpeed: used when accountForGravity is enabled
- accountForGravity: when aiming the AI will use projectileSpeed to determine if they need to aim higher to hit the target
- weaponHoldPositionOffset: the position offset where the gun should be held
- weaponAimAngleOffset: the rotation offset for aiming, unlikely you need this as the aimTransform is used to align the gun
- weaponHoldAngleOffset: currently only the y value is used and it is used as a turn offset for the NPC
- customRangedAttackAnimationData: the id of the animation data that should be played when the ranged attack fires