1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Making a custom key usable for a class

Discussion in 'Modding Help' started by Frikman, Aug 5, 2016.

  1. Frikman

    Frikman Bison Rider

    Messages:
    162
    Hello, I'd like to know if there's a way to make a class use a custom key for making an action. For now I know LMB is key_action1, RMB is key_action2 and SPACE is key_action3, but is there a way for setting, for example, R to be key_action4 or just using key_r altoguether?
     
  2. makmoud98

    makmoud98 You are already DEAD Forum Moderator Staff Alumni Tester

    Messages:
    586
    these are the available keys
    [​IMG]
    i think key_taunts is v
    --- Double Post Merged, Aug 5, 2016, Original Post Date: Aug 5, 2016 ---
    actually you can also use CControls like this
    [​IMG]
    you need to do the stuff at the top because CControls is like a clientside thing
     
  3. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Note: you probably want to sync the buttonpress somehow if anything at all client or server side is going to rely on it. If it's just for a menu for that player only then feel free to not, but if it's going to be used for like, jumping or something, either send a cmd for the action, or use a bool or tag property representing the current state of the key.
     
    makmoud98 likes this.
  4. Frikman

    Frikman Bison Rider

    Messages:
    162
    I actually found a way of making it work using this code, which is pretty similar to what makmoud said.
    Code:
    if (getControls().isKeyJustPressed( KEY_KEY_R ))
    Although it works, it doesn't allow me to use keys like shift or control. Do they have a special name or just can't be used?
     
  5. makmoud98

    makmoud98 You are already DEAD Forum Moderator Staff Alumni Tester

    Messages:
    586
    open Enums.txt inside of ../KAG/Manual/interface