Author |
Message |
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Custom control issues
Obviously you can do stuff with UInputMan in order to find out if keys are being pressed. Now, is there some way to figure out which player is pressing the key? I'm having an issue where pressing the melee button I've set up makes it activate for multiple players.
Now that I think about it, I could probably just set up different keys for different players, which would probably make more sense anyway. Still, just for curiosity's sake, I'm asking my question anyway.
|
Sun Nov 08, 2009 9:23 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Custom control issues
Well, the problem here is, how would the game know which player is pressing it? The game assumes that there is only one keyboard.
|
Sun Nov 08, 2009 11:18 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Custom control issues
It could check who moves when a certain button is pressed, then figure out if that's red or green.
|
Sun Nov 08, 2009 11:45 pm |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Re: Custom control issues
TheLastBanana wrote: Well, the problem here is, how would the game know which player is pressing it? The game assumes that there is only one keyboard. Haaaaaaaaaa... good point. Okay, time to change the subject a bit before I feel too dumb. What does everyone think is the most efficient way to set up new controls that can be customized by the user? My current solution is to make a settings.ini that defines some simple null particles, each one representing a different control. You set the mass of each particle equal to the ID for the key you want. Then in the game, actors that rely on those custom controls have in their script some stuff that creates these particles somewhere out of the way and then reads their mass to find out whether or not a key does something. This is useful since it also lets players change keys in-game with the command line, by finding the particle and changing its mass. I swear a while back somebody somewhere suggested something simpler, but I fail to recall what it was.
|
Sun Nov 08, 2009 11:46 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: Custom control issues
Could you do a "Press the button you want to use for..." MOSParticle popup, linked in script to the mass thing?
|
Sun Nov 08, 2009 11:51 pm |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Re: Custom control issues
It needs to be persistent between instances of the game. And the interface for changing the keys in-game isn't really what I'm asking about. What I'm wondering is if anybody has any other ideas for storing the keys for the long-term. My idea works, but it feels a tad convoluted. Then again, considering what I have to work with, maybe convoluted is the best I can do.
|
Mon Nov 09, 2009 6:04 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Custom control issues
Can you just check the line from settings.ini?
|
Mon Nov 09, 2009 7:01 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Custom control issues
Not in any way that'd be any less complicated than actually packing in a file I/O library.
You'd have to have a file reader specifically check settings.ini, either through a batch file or lua i/o, and have it spit out another file for CC to check against. At that point, you might as well have a specifically created and modified file.
But uh, yeah, not having any I/O is pretty limiting to longterm stuff. I'd ask Data, but I can fully appreciate why he didn't include it. That said, limiting it to the same .rte shouldn't be too hard.
|
Mon Nov 09, 2009 7:44 am |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Re: Custom control issues
Well, I guess I'll stick with my method then.
What would be CC modding without awkward shenanigans?
|
Mon Nov 09, 2009 2:59 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Custom control issues
You could say something like "if my actor is player number 2 and this button is pressed, I'm going to make this happen." TLB has a player checking code in his Mind Control Orb, but I can't make sense of it.
|
Mon Nov 09, 2009 10:46 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Custom control issues
In theory that works, but in practice, it really doesn't. You have one keyboard. How does it know who pushed which button? Let's say you're using the button "I". It is not associated with either player. How does the game know whether it was player 1 who reached over and pushed it or player 2? Simple answer: it doesn't. Anyway, to get an actor's controlling player, actor:GetController().Player works just fine.
|
Tue Nov 10, 2009 4:08 am |
|
|
|