PlayerPawn input grabbing?

Discussions about Coding and Scripting
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

PlayerPawn input grabbing?

Post by Saya-chan »

So I'm here making some new mutator that does special actions based on the keyboard & mouse input from the player, and, besides having some other problems, I can't grab player input through the typical 'getting the values of Axis variables on PlayerPawn or the states of bPressedJump or bDuck' (bDuck works, though). Is there any real way to check if player is pressing forward/backward keys or looking around (Or even getting ANY of the inputs from keyboard & mouse)?

I know you can get key presses and stuff directly in a Console object, though...
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: PlayerPawn input grabbing?

Post by Rakiayn »

''function mutate'' in a mutator should work.
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: PlayerPawn input grabbing?

Post by Saya-chan »

Uhm... Wouldn't that actually require to replace all the previous bindings for player movement? (so, for example, pressing Forward key would call 'MoveForward|Mutate MovedForward', or something like that)
Image
  ~♥~ Bless the Cute Emperor ~♥~
Darkness
Experienced
Posts: 81
Joined: Mon Mar 01, 2010 10:12 pm
Location: Brazil

Re: PlayerPawn input grabbing?

Post by Darkness »

I don't know if it'd work like that, since mutate can't have "autofire" I guess.

The main problem of input is that most is processed client-side, so I guess that those thing can be checked if you put an item that reads these inside a client-side only function ( netmod != dedicated ).

Some of them I use easily, like the bduck, I guess it just works fine even without it.

I still have to improve these stuff, so I'd gladly be looking for an alternate answer as well.
User avatar
TheDane
Masterful
Posts: 660
Joined: Tue Feb 12, 2008 2:47 pm
Personal rank: Happy fool :-)

Re: PlayerPawn input grabbing?

Post by TheDane »

I believe what you seach for is covered pretty good in this topic: http://wiki.beyondunreal.com/Legacy:Key ... teractions
Retired.
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: PlayerPawn input grabbing?

Post by Saya-chan »

@TheDane: Then I think this function might help.

Code: Select all

function int AttachCommand(string Key, string Command)
{
	local string temp, temp2;

	temp = ConsoleCommand("get input"@Key);
	if ( Left(Temp,21) ~= "Unrecognized property" )
		return -1;
	if ( Left(Temp,Len(Command)) ~= Command )
		return 0;

	temp2 = ConsoleCommand("set input"@Key@Command$"|"$temp);
	if ( Left(Temp,21) ~= "Unrecognized property" )
		return -1;

	return 1;
}
And to make 'button-like' commands it should be "<SomeCommand>|OnRelease <SomeCommand>" AFAIK.
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Post by anth »

Interaction is not available in UEngine 1.0. If you want to grab player input using uscript you need to replace the console or the hud (not 100% sure about the latter, you should check it yourself). Mutators CAN read the state of certain keys by checking the bFire, bAltFire, ... values in the playerpawn object. Keep in mind that a serverside method is in no way reliable though because it suffers from latency and network congestion.
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: PlayerPawn input grabbing?

Post by Saya-chan »

Hmm, yes. I thought now of writing a new console object, since I just investigated a bit and input variables only work on the playerpawn, not on inventory items, unlike exec functions. Obviously, changing the HUD is indeed not reliable, as it would require making different versions of the same HUD for all GameTypes (and would make mods that change the HUD incompatible). Now, how can I replace the console object of a player in-game?

Oh, and all my mods are only clientside. Replication coding simply just can't get into my head. :tongue:
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Post by anth »

Take a look at the CSHP4+ sourcecode or the XConsole source (not sure if the latter is available). Either way, it's not an easy job.
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: PlayerPawn input grabbing?

Post by Saya-chan »

CSHP4+ has what I want, it does replace the console at run-time. XConsole, though, requires you to select the console on advanced options. Thanks for your help, now I'll get back to work. :tu:
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Post by anth »

Or you could replace the Console value under [Engine.Engine]. Another runtime possibility is to "hook" the console. Replace it with a wrapper that only modifies the functions you need and redirects everything else to the original console. It's not that hard to do and it has little side effects (unless you're going to do that during online play on a server with UTPure).
gopostal

Re: PlayerPawn input grabbing?

Post by gopostal »

If you do it this way, you'll never pass AC checks.
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Post by anth »

Well I'm not sure what your goal is but XConsole does work with UTPure
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: PlayerPawn input grabbing?

Post by Saya-chan »

Hmmm, I've done the hook thingy. Now I just have to find out why when I press Esc the screen just goes white, or why can't I access the console window at all.

Edit: Forget it, I fixed that. The whole thing is getting real now. Bad thing is it depends on some functions that prevent it from ever becoming net-compatible.
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Post by anth »

What exactly do you mean by that?
Post Reply