Page MenuHomeFeedback Tracker

Expose ability to fire weapon from script
Assigned, NormalPublic

Description

Hello,

I had looked over the scripts and I do not see a way to simply tell a WeaponComponent to fire the weapon. Could this be implemented at a later stage?

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General

Event Timeline

Geez changed the task status from New to Assigned.Apr 12 2023, 11:42 AM
ookexoo added a comment.EditedThu, Jul 3, 8:12 PM

There are some indirect approaches via character command handler to force weapon fire:

//------------------------------------------------------------------------------------------------
modded class SCR_CharacterCommandHandlerComponent : CharacterCommandHandlerComponent
{
	protected bool m_bACE_ForceWeaponFire = false;
	
	//------------------------------------------------------------------------------------------------
	override bool HandleWeaponFire(CharacterInputContext pInputCtx, float pDt, int pCurrentCommandID)
	{
		if (m_bACE_ForceWeaponFire)
		{
			if (pInputCtx.WeaponIsRaised())
				pInputCtx.SetWeaponPullTrigger(true);
				
			m_bACE_ForceWeaponFire = false;
		}
		
		return HandleWeaponFireDefault(pInputCtx, pDt, pCurrentCommandID);
	}
	
	//------------------------------------------------------------------------------------------------
	void ACE_ForceWeaponFire()
	{
		m_bACE_ForceWeaponFire = true;
	}
}

However, this approach does not work when the weapon is lowered, so it's not good for features like weapon cook-off.