• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

RO2 How to intercept the 'UseKey'

LordGleedo

FNG / Fresh Meat
Jul 18, 2010
800
74
0
Bucks, England
www.theoldgitsarmy.com
Hello, how should one intercept the Use or Interact key these days in code?

I have a class which extends ROPlayerInput but after studying that class, I can't see a way to perform my own function if the UseKey is pressed down.

Can anyone point me in the right direction please?

Thanks.
 
Last edited:

dibbler67

FNG / Fresh Meat
Sep 4, 2011
654
6
0
Texas
Hello, how should one intercept the Use or Interact key these days in code?

I have a class which extends ROPlayerInput but after studying that class, I can't see a way to perform my own function if the UseKey is pressed down.

Can anyone point me in the right direction please?

Thanks.
I'd suggest looking in ROPlayerController and seeing if you can override a function there.
 

LordGleedo

FNG / Fresh Meat
Jul 18, 2010
800
74
0
Bucks, England
www.theoldgitsarmy.com
Fixed it.

I have my player input class
Code:
class FTPlayerInput extends ROPlayerInput;

function bool InputKey(int ControllerId, name KeyName, EInputEvent IEvent, float AmountDepressed, optional bool bGamepad)
{
	local string keyPressed;
	keyPressed = string(KeyName);

	`Log(">>> DEBUG : InputKey"$KeyName, , 'FTPlayerInput');

	if (IEvent == IE_Pressed)
	{
            // put my code here
        }

DefaultProperties
{
	OnReceivedNativeInputKey=InputKey
}
And then hook up that class inside my player controller class default props:
Code:
DefaultProperties
{
    InputClass=class'FTPlayerInput'
}