adding new keboard button to the game_ui -1 reply

Please wait...

amit1234

Slightly cooler than a n00b

50 XP

17th January 2006

0 Uploads

34 Posts

0 Threads

#1 12 years ago

Hi all, can I add to the game_ui entity another keyboard button ? (for example when the user press on 'g' something happens).




ArChNeMiSiS

Slightly cooler than a n00b

50 XP

20th December 2005

0 Uploads

44 Posts

0 Threads

#2 12 years ago

Probably with coding....do you mean like come up with some different sort of action...not one that already exists? Say...being able to fly?....or rolling? If thats the case then you will need coding.




amit1234

Slightly cooler than a n00b

50 XP

17th January 2006

0 Uploads

34 Posts

0 Threads

#3 12 years ago

I mean a key that will throw an output event when it is pressed, thats all. Do you know what changes I need to do in the code in order to do so ?




mastergohanzero

I'm too cool to Post

50 XP

13th January 2006

0 Uploads

12 Posts

0 Threads

#4 12 years ago

I've been trying to figure this out as well.




amit1234

Slightly cooler than a n00b

50 XP

17th January 2006

0 Uploads

34 Posts

0 Threads

#5 12 years ago

In order to add a new keyboard button into game_ui, I made some changes in the code. Unfortunately something is wrong and the new key isn't working. I am going to write the changes need to be done in order to add the new key, and I will appreciate it if someone finds out what is wrong or missing. In game_ui.cpp: COutputEvent m_pressedAttack2; COutputEvent m_pressedRonenKey; // addition DEFINE_OUTPUT( m_pressedAttack2, "PressedAttack2" ), DEFINE_OUTPUT( m_pressedRonenKey, "PressedRonenKey" ), // addition [COLOR=green] [/COLOR] if ( pPlayer->m_afButtonPressed & IN_ATTACK2 ) { m_pressedAttack2.FireOutput( pPlayer, this, 0 ); } if ( pPlayer->m_afButtonPressed & IN_RONENKEY ) // addition { m_pressedRonenKey.FireOutput( pPlayer, this, 0 ); } In in_buttons.h: #define IN_BULLRUSH (1 << 22) #define IN_RONENKEY (1 << 23) // addition [COLOR=green] [/COLOR] In in_main.cpp kbutton_t in_graph; kbutton_t in_ronenkey; // addition void IN_ZoomDown(void) {KeyDown(&in_zoom);} void IN_ZoomUp(void) {KeyUp(&in_zoom);} void IN_RonenKeyUp(void) {KeyUp(&in_ronenkey);} // addition void IN_RonenKeyDown(void) {KeyDown(&in_ronenkey);} // addition CalcButtonBits( bits, IN_ZOOM, s_ClearInputState, &in_zoom, bResetState ); CalcButtonBits( bits, IN_RONENKEY, s_ClearInputState, &in_ronenkey, bResetState ); // addition static ConCommand startzoom("+zoom", IN_ZoomDown); static ConCommand endzoom("-zoom", IN_ZoomUp); static ConCommand startronenkey("+ronenkey", IN_RonenKeyDown); // addition static ConCommand endronenkey("-ronenkey", IN_RonenKeyUp); // addition

[COLOR=green] [/COLOR]

In input.h: extern kbutton_t in_back; extern kbutton_t in_ronenkey; // addition

[COLOR=green] [/COLOR]

In kb_act.lst: (find this file in the script directory of your mod) "+klook" "#Valve_Keyboard_Look_Modifier" "+ronenkey" "ronen key" // addition

[COLOR=green] [/COLOR]

In base.fgd: Copy this file and change its name (for example to base2.fgd). Then add this fgd to hammer instead the original one (you can't edit the original base.fgd file). In the game_ui definition: output PressedAttack2(void) : "Fired whenever the player presses the secondary attack key." output PressedRonenKey(void) : "Fired whenever the player presses the ronenkey." // addition

In config.cfg (in the cfg directory of your mod):

bind "o" "+ronenkey"