View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:56 am



Reply to topic  [ 11 posts ] 
 Custom control issues 
Author Message
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Custom control issues
Can you just check the line from settings.ini?


Mon Nov 09, 2009 7:01 am
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.044s | 13 Queries | GZIP : Off ]