Jump to content
Sign in to follow this  
[frl]myke

[KnowledgeBase] Custom controller schemes

Recommended Posts

f16customcontrols.th.png

This is the topic. Own customizable controller schemes which can be adjusted by players through the options dialogue, including own input definitions.

I've got not everything sorted yet, in fact i'm stuck and i hope by starting this knowledge base enough information is gathered so i and everyone else might be able to create their own control schemes.

First, i tried to define own default key mappings:

class CfgDefaultKeysMapping {
GLT_Headup[] = {0x00080000 + 2};
GLT_Headdown[] = {0x00080000 + 8};
};

The values in there represent dikCodes and can be found in the bin.pbo config. Do not ask about the above codes, this is experimental and not working yet.

Next, i tried to use these new defined user inputs for new actions:

class CfgActions {
class None;
class GLT_Headup : None {
	priority = 0.1;
	show = 0;
	shortcut = "GLT_Headup";
	text = "Move head up";
	textDefault = "Move head up";
};
class GLT_Headdown : None {
	priority = 0.1;
	show = 0;
	shortcut = "GLT_Headdown";
	text = "Move head down";
	textDefault = "Move head down";
};
};

cfgActions is also part of the bin.pbo and i was following the scheme from there.

The next step led to the above screenshot:

class UserActionGroups {
class GLT_Falcon_EVO {
	name = "[GLT] F-16C Evolution Controls";
	group[] = {
		"GLT_Headup", 
		"GLT_Headdown", 
		"HeliUp", 
		"HeliDown", 
		"HeliThrottlePos", 
		"HeliThrottleNeg", 
		"HeliLeft", 
		"HeliRight", 
		"HeliCyclicLeft", 
		"HeliCyclicRight", 
		"HeliRudderLeft", 
		"HeliRudderRight", 
		"HeliForward", 
		"HeliBack", 
		"HeliFastForward", 
		"LeanLeft", 
		"LeanRight", 
		"LandGear", 
		"LandGearUp", 
		"FlapsDown", 
		"FlapsUp", 
		"GetOut", 
		"Eject"
	};
};
};

As you see, the most is a copy from Heli keyboard setup with the new actions on top of them. Although this now enables a custom controller setup screen, both new created actions/userinputs do not show up in this list.

Also not sure was the next part exactly does although i have a few ideas:

class UserActionsConflictGroups {
class ActionGroups {
	GLT_Falcon_EVO[] = {
		"GLT_Headup", 
		"GLT_Headdown", 
		"HeliUp", 
		"HeliDown", 
		"HeliThrottlePos", 
		"HeliThrottleNeg", 
		"HeliLeft", 
		"HeliRight", 
		"HeliCyclicLeft", 
		"HeliCyclicRight", 
		"HeliRudderLeft", 
		"HeliRudderRight", 
		"HeliForward", 
		"HeliBack", 
		"HeliFastForward", 
		"LeanLeft", 
		"LeanRight", 
		"LandGear", 
		"LandGearUp", 
		"FlapsDown", 
		"FlapsUp"
	};
};

class CollisionGroups {
	GLT_Falcon_EVO[] = {
		"GLT_Falcon_EVO", 
		"vehBasic", 
		"basic"
	};
};
};

There are several points missing to make it definately work:

1. In the cfgActions, is there a way to launch a script by the corresponding keystroke? Something like a userAction eventhandler? I know about the user interface event handler but as far as i understand it doesn't work with such customized key layout.

2. Why is the GLT_Headup and GLT_Headdown action not displayed in the controller setup screen? What am i missing there?

3. How is such an customized action set assigned to a class? In other terms, how do i make sure that the F-16 (in this case) will have the customized controls?

Anyone who has info or code snippets that might be helpful, please post them, for me and surely for anyone else.

Thank you for your cooperation. ;)

Edited by [FRL]Myke

Share this post


Link to post
Share on other sites

No entires for Class ControllerSchemes?

Share this post


Link to post
Share on other sites

Well I assumed you did a searched though the configs for say "HeliUp". To try and determine how to configure your own customisable controller schemes?

And every time you found a reference or associated class, you also updated those with your GLT_ entries and class names. But they aren't working the way they should atm?

Well there is a class called ControllerSchemes, which also references stuff like "HeliUp", only you haven't posted details of that class. So I guessed you either forgot to post it, or didn't know it existed in the first place?

It's a bit to big to post it all, but this what it looks like:

Class ControllerSchemes
       {
       defaultScheme="Default";
       defaultSchemeMovementLeftBrakeTriggerAccTrigger="Default";
       defaultSchemeMovementLeftBrakeTriggerAccButton="Default";
       defaultSchemeMovementLeftBrakeButtonAccTrigger="Default";
       defaultSchemeMovementLeftBrakeButtonAccButton="Default";
       defaultSchemeMovementRightBrakeTriggerAccTrigger="Default";
       defaultSchemeMovementRightBrakeTriggerAccButton="Default";
       defaultSchemeMovementRightBrakeButtonAccTrigger="Default";
       defaultSchemeMovementRightBrakeButtonAccButton="Default";
       Class Default
               {
               name="Default Scheme";
               Class Gamepad
                       {
                       Class ButtonDeadZones : ButtonDeadZonesDefault
                               {
                               deadZone_LeftTrigger[]={192,128};
                               deadZone_RightTrigger[]={80,64};
                               };

                       Class ThumbStickDeadZones
                               {
                               leftX=0.21;
                               leftY=0.23;
                               rightX=0.21;
                               rightY=0.23;
                               };

                       Class Actions
                               {
                               ToggleWeapons[]={"0x00050000 + 3"};
                               DefaultAction[]={"0x00050000 + 13"};
                               ReloadMagazine[]={"0x00050000 + 2"};
                               LockTarget[]={};
                               RevealTarget[]={"0x00050000 + 12"};

Share this post


Link to post
Share on other sites

I was looking through the ControllerSchemes class but so far i thought this is only relevant game controllers setup as it's subclasses references to Gamepad, Joystick and wheel. So i didn't see the relevance for keyboard setup.

If you have informations about it i would love to hear these.

Share this post


Link to post
Share on other sites
If you have informations about it i would love to hear these.

Nope, afraid not.

Custom key mappings is something I would like to do at some point. So I was curious enough to check through my config files, to see if there was anything obvious.

Have you checked the config in memory once the game is running, to see if all your additions are present? Obviously class GLT_Falcon_EVO is there, as seen in your screen shot. But what about the rest of it?

Share this post


Link to post
Share on other sites

Ok, the useractiongroups wasn't loaded at first. I've inherited my GLT_Falcon_EVO class from the class air and then it showed up. Looks like this now:

class UserActionGroups {
class Air;
class GLT_Falcon_EVO: Air {
	name = "[GLT] F-16C Evolution Controls";
	group[] = {
		"GLT_Headup", 
		"GLT_Headdown", 
		"HeliUp", 
		"HeliDown", 
		"HeliThrottlePos", 
		"HeliThrottleNeg", 
		"HeliLeft", 
		"HeliRight", 
		"HeliCyclicLeft", 
		"HeliCyclicRight", 
		"HeliRudderLeft", 
		"HeliRudderRight", 
		"HeliForward", 
		"HeliBack", 
		"HeliFastForward", 
		"LeanLeft", 
		"LeanRight", 
		"LandGear", 
		"LandGearUp", 
		"FlapsDown", 
		"FlapsUp", 
		"GetOut", 
		"Eject"
	};
};
};

The rest of the config is loaded and a isClass check aswell as getArray/getText checks showed positive results.

However, both custom actions (GLT_Headup, GLT_Headdown) don't show up in the options menu.

Share this post


Link to post
Share on other sites

One point was missing for me.

How does the engine know that "heliUP" has to be shown as "Increase thrust" ?

So i started a search and found follwing entry in the

file "Dta\languagecore\stringtable.xml":

-

<Key ID="[color=darkgreen][b]str_usract_heli_up[/b][/color]">
 <Original>[b][color=darkgreen]Increase thrust[/color][/b]</Original> 
  <German>Schub erhöhen</German> 
  <English>Increase thrust</English> 
  <Italian>Aumenta spinta</Italian> 
  <Spanish>Aumentar propulsión</Spanish> 
  <French>Augmenter gaz</French> 
  <Czech>Zvýšit výkon</Czech> 
  <Russian>Увеличить Ñ‚Ñгу</Russian> 
  <Polish>Śmigłowiec w górę</Polish> 
  <Hungarian>Tolóerő növelése</Hungarian> 
</Key>

Can see a lot of "str_usract_*" (think usract => UserActions) in there. But now I ask me.. how does the engine translate "HeliUp" to "str_usract_heli_up" or at least "heli_up" ?

Another suggestion:

I don't think that you need changes in the "CfgAction" class. There is also no define for "HeliUp". The Names wich are defined there by default, are all for the actionmenu. And I don't think that you want to steer your plane over the actionmenu.. ;).. but let me think... would be funny... :D

Edited by HeliJunkie

Share this post


Link to post
Share on other sites

@HeliJunkie

Thanks for your input. Take a look at this:

class SitDown : None {
	priority = 0.1;
	shortcut = "SitDown";
	show = 0;
	text = $STR_ACTION_SITDOWN;
	textDefault = $STR_ACTION_SITDOWN;
};

Also an action that doesn't show up in the action menu but it still has a text entry. My first idea was that the strings for the controls setup were taken from these entries.

Share this post


Link to post
Share on other sites

OK... see what you meen.

But I think the "show=0" will hide the action from the action menu.

I think it is defined so you can use it with the action command and "show=0" to hide it from the actionmenu.

Can see a lot of "str_usract_*" (think usract => UserActions) in there. But now I ask me.. how does the engine translate "HeliUp" to "str_usract_heli_up" or at least "heli_up" ?

Maybe it has something to do with the casing of the letters. The useraction are spelled like "HeliUp" in the class "UserActionGroups/Air/group" and are defined as "str_usract_heli_up" in stringtable.xml. Some more examples I verified:

HeliDown = str_usract_heli_down

HeliFastForward = str_usract_heli_fast_forward

HeliCyclicLeft = str_usract_heli_cyclic_left

From Basic Inf:

ToggleRaiseWeapon = str_usract_toggle_raise_weapon

Maybe you should also change your custom Name from "GLT_HeadUp" to "GltHeadUp" (think you should avoid underscores). And then use "str_usract_glt_head_up" in the stringtable.xml.

Do you think it's worth a try ?

Share this post


Link to post
Share on other sites

@HeliJunkie

These are just localizations and not of any importance for the functionality. The "Show = 0" indeed defines if the action is available in the action menu or only through keystrokes/controller buttons.

The action command uses action classnames. And underscores in classnames shouldn't be a problem at all.

Your thoughts are good and always welcome, keep it comin.

Share this post


Link to post
Share on other sites
Myke;1798721']@HeliJunkie

....

The action command uses action classnames. And underscores in classnames shouldn't be a problem at all.

....

Of course are underscores valid for classnames.

But if the engine would translate the classname uppercase to <UnderscoreLowercase> it would be confusing if the classname inherit a lowercase. That was the reason why I mentioned not to use underscores for this classnames.

But....

I opened the arma2oa.exe (V1.55) in a hex-editor and found all the useraction names in there as clear strings. So I think you won't be able too add any own useraction because it seems that the names are hardcoded into the .exe-file and you will not be able to configure some custom ones.

You will be able to build some own new "UserActionGroups" but only with the given useractions.

And if new useractions would be possible, in the next step, how would you tell the engine to use the new useractions for your vehicle ??? Useractions are bound to vehicle classes (like aircraft, vehicle, infantry). So you must create a new vehicle class ... and sorry... but that would go to far for me.

Think it was a great idea, but it won't be possible. Sorry.

Share this post


Link to post
Share on other sites

@HeliJunkie

i'm affraid that it will turn out that you are correct but right now i'm not willing to give up on it. Hopefully one of the Devs might show up here and clarify what could be done and what not.

:EDITH:

Take a look at this:

http://media.realitymod.com/news/arma/prarma_07/pr_mainmenu_controls.jpg >100kb

Edited by [FRL]Myke

Share this post


Link to post
Share on other sites

Indeed. Too bad they sit on their knowledge. Would be nice if they could share a bit.

Share this post


Link to post
Share on other sites

You cannot define your own input actions. The list of actions is hardcoded in the engine.

Share this post


Link to post
Share on other sites

Thanks Suma, not the answer i hoped for but now we know for sure. However, i would be curious what the PR pic shows there.

Share this post


Link to post
Share on other sites
i would be curious what the PR pic shows there.

Probably just shifted some of the hardcoded user defined actions into another group.

Share this post


Link to post
Share on other sites

Would be nice if BIS could make own cfgActions possible. Also voted the CIT ticket up.

Configwise it seems that not much would have to be added:

class CfgActions {
class None;
class GLT_Headup : None {
	priority = 0.1;
	show = 0;
	shortcut = "GLT_Headup";
	text = "Move head up";
	textDefault = "Move head up";
};
class GLT_Headdown : None {
	priority = 0.1;
	show = 0;
	shortcut = "GLT_Headdown";
	text = "Move head down";
	textDefault = "Move head down";
};
};

In here, just two additional values "condition" and "statement" would be required. The userAction classname could be used to link a action group to a vehicle class.

@Suma

Any chance? ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×