PlayerPawn input grabbing?

Discussions about Coding and Scripting

PlayerPawn input grabbing?

Postby Saya-chan » Thu Apr 01, 2010 4:43 pm

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...
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby Rakiayn » Thu Apr 01, 2010 7:58 pm

''function mutate'' in a mutator should work.
User avatar
Rakiayn
Masterful
 
Posts: 512
Joined: Fri Aug 28, 2009 3:33 pm

Re: PlayerPawn input grabbing?

Postby Saya-chan » Sat Apr 03, 2010 12:14 pm

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)
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby Darkness » Sat Apr 03, 2010 12:53 pm

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
Darkness
Average
 
Posts: 65
Joined: Mon Mar 01, 2010 10:12 pm
Location: Brazil

Re: PlayerPawn input grabbing?

Postby TheDane » Sat Apr 03, 2010 7:47 pm

I believe what you seach for is covered pretty good in this topic: http://wiki.beyondunreal.com/Legacy:Key ... teractions
http://www.thedanesjoint.com - My little dot on the internet.
http://www.ut99.net - Library of UT files.
User avatar
TheDane
Skilled
 
Posts: 202
Joined: Tue Feb 12, 2008 2:47 pm
Personal rank: Developer

Re: PlayerPawn input grabbing?

Postby Saya-chan » Sun Apr 04, 2010 1:47 pm

@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.
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby anth » Thu May 13, 2010 2:56 am

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.
anth
Experienced
 
Posts: 110
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Postby Saya-chan » Thu May 13, 2010 1:44 pm

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:
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby anth » Thu May 13, 2010 3:35 pm

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.
anth
Experienced
 
Posts: 110
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Postby Saya-chan » Thu May 13, 2010 9:47 pm

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:
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby anth » Fri May 14, 2010 4:29 pm

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).
anth
Experienced
 
Posts: 110
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Postby gopostal » Sat May 15, 2010 1:40 pm

If you do it this way, you'll never pass AC checks.
gopostal
 

Re: PlayerPawn input grabbing?

Postby anth » Sat May 15, 2010 3:50 pm

Well I'm not sure what your goal is but XConsole does work with UTPure
anth
Experienced
 
Posts: 110
Joined: Thu May 13, 2010 2:23 am

Re: PlayerPawn input grabbing?

Postby Saya-chan » Sat May 15, 2010 4:56 pm

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.
^ rusted UT99 modder/mapper is rusted ^
User avatar
Saya-chan
Adept
 
Posts: 402
Joined: Mon Jun 02, 2008 10:46 am
Location: Vigo, Galicia
Personal rank: Ordinary Magician

Re: PlayerPawn input grabbing?

Postby anth » Sat May 15, 2010 5:57 pm

What exactly do you mean by that?
anth
Experienced
 
Posts: 110
Joined: Thu May 13, 2010 2:23 am

Next

Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest