Jump to content
Sign in to follow this  
haleks

[Reforger] ActionListener not firing?

Recommended Posts

Just gonna post this here since Discord is giving me headaches...

 

I'm trying to add a new ActionListener on the "CharacterWalk" action, but for some reason it never fires... 😕

I've overridden the UpdateLocalPlayerController method in the SCR_PlayerController component :

Spoiler

modded class SCR_PlayerControllerClass: PlayerControllerClass
{
};

modded class SCR_PlayerController : PlayerController
{
	//! Find if this is local player controller. We assume that this never changes during scenario.
	override void UpdateLocalPlayerController()
	{
		Print("TEST method begins");
		m_bIsLocalPlayerController = this == GetGame().GetPlayerController();
		if (!m_bIsLocalPlayerController)
			return;
		
		s_pLocalPlayerController = this;
		InputManager inputManager = GetGame().GetInputManager();
		if (!inputManager)
			return;
		
		inputManager.AddActionListener("WeaponChangeMagnification", EActionTrigger.VALUE, ChangeMagnification);
		inputManager.AddActionListener("CharacterWalk", EActionTrigger.DOWN, OnWalk);
		inputManager.AddActionListener("CharacterWalk", EActionTrigger.UP, OnEndWalk);
		inputManager.AddActionListener("Inventory", EActionTrigger.DOWN, Action_OpenInventory );
		inputManager.AddActionListener("TacticalPing", EActionTrigger.DOWN, Action_GesturePing );
		inputManager.AddActionListener("TacticalPingHold", EActionTrigger.DOWN, Action_GesturePingHold );
		inputManager.AddActionListener("TacticalPingHold", EActionTrigger.UP, Action_GesturePingHold );
		
		inputManager.AddActionListener("CharacterWalk", EActionTrigger.DOWN, TestDebug_CharacterWalk);
		inputManager.AddActionListener("Inventory", EActionTrigger.DOWN, TestDebug_Inventory);
		
		Print("TEST method ends");
	}
	
	//------------------------------------------------------------------------------------------------
	void TestDebug_CharacterWalk()
	{
		Print("TEST W key down");
	}

	//------------------------------------------------------------------------------------------------
	void TestDebug_Inventory()
	{
		Print("TEST TAB key down");
	}

};

 

 

All debug hints are printed in the log console - except for "TEST W key down".

I'm tempted to believe that for some reason that specific action doesn't fire - but it does have 2 vanilla methods (OnWalk and OnEndWalk) plugged to it... What's going on here? tired.png

 

Share this post


Link to post
Share on other sites

Okay, found a workaround, I'm using the "CharacterForward" action instead.

 

modded class SCR_PlayerControllerClass: PlayerControllerClass
{
};

modded class SCR_PlayerController : PlayerController
{
	//! Find if this is local player controller. We assume that this never changes during scenario.
	override void UpdateLocalPlayerController()
	{
		Print("TEST method begins");
		m_bIsLocalPlayerController = this == GetGame().GetPlayerController();
		if (!m_bIsLocalPlayerController)
			return;
		
		s_pLocalPlayerController = this;
		InputManager inputManager = GetGame().GetInputManager();
		if (!inputManager)
			return;
		
		inputManager.AddActionListener("WeaponChangeMagnification", EActionTrigger.VALUE, ChangeMagnification);
		inputManager.AddActionListener("CharacterWalk", EActionTrigger.DOWN, OnWalk);
		inputManager.AddActionListener("CharacterWalk", EActionTrigger.UP, OnEndWalk);
		inputManager.AddActionListener("Inventory", EActionTrigger.DOWN, Action_OpenInventory );
		inputManager.AddActionListener("TacticalPing", EActionTrigger.DOWN, Action_GesturePing );
		inputManager.AddActionListener("TacticalPingHold", EActionTrigger.DOWN, Action_GesturePingHold );
		inputManager.AddActionListener("TacticalPingHold", EActionTrigger.UP, Action_GesturePingHold );
		
		inputManager.AddActionListener("CharacterForward", EActionTrigger.DOWN, TestDebug_CharacterForwardDown);
		inputManager.AddActionListener("CharacterForward", EActionTrigger.UP, TestDebug_CharacterForwardUp);
		
		Print("TEST method ends");
	}
	
	//------------------------------------------------------------------------------------------------
	void TestDebug_CharacterForwardDown()
	{
		Print("TEST W key down");// It works !
	}
	
	//------------------------------------------------------------------------------------------------
	void TestDebug_CharacterForwardUp()
	{
		Print("TEST W key up");// It doesn't ! :(
	}

};

However, a new mystery arises : the TestDebug_CharacterForwardUp method doesn't fire. 😕 

Share this post


Link to post
Share on other sites
5 hours ago, Tory Xiao said:

is this the first reforger post on this forum?

 

There's discussion in the News section. There should be official subforums up soon-ish.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×