[Tutorial] Adding hotkeys for custom characters

Post Reply
User avatar
EPR89
Posts: 1845
Joined: Mon Oct 15, 2012 8:57 am
Location: Germany

[Tutorial] Adding hotkeys for custom characters

Post by EPR89 » Tue Mar 24, 2015 6:08 am

So I just had a conversation on Steam about switching to custom characters.

It's relatively simple and I think a bunch of guys have probably done it before, but I thought I'd post a tutorial about it, so that everyone can quickly switch to his or her favourite custom character.

In this example I will use Exampleman by Markuss. This character needs to be installed manually, but it comes packed into a Data folder that uses the same structure used by the SUMLauncher. If you use another character, use appropriate paths and names.
I'm writing this tutorial using a209. In later versions some things might change, especially the line numbers I will bring up. So keep that in mind too.
Also, get Notepad++. It's a free text editor and it will make your life much easier.

Let's get started!
First of all, make a copy of your aschar.as file (in Data/Sripts). That's just a backup in case you mess up so bad that the game crashes. :lol:
Now, open the original aschar.as file with your text editor. You will have to add a hotkey and define what it does.

Adding a hotkey:
Hotkeys are listed starting at line 1758 and their actions are defined starting at line 1824.

So let's define a new key. After the rabbot_key (1764) line insert this line:

Code: Select all

string LULZ_key = "g";
The finished thing should look like this.

Code: Select all

string rabbot_key = "7";
string LULZ_key = "g";
string misc_key = "b";
You can call the key anything and you can define any key on your keyboard. G was free for me, so I have used that one.


Defining the new key's function:
Now, after the string that defines what the rabbot_key (now line 1905) does, insert this section (I'll post it together with the rabbot_key string, in order to make it clearer how the brackets need to be set):

Code: Select all

        if(GetInputPressed(this_mo.controller_id, rabbot_key)){
            SwitchCharacter("Data/Characters/rabbot.xml");	
        }
        if(GetInputPressed(this_mo.controller_id, LULZ_key)){
            SwitchCharacter("Data/Custom/markuss/ExampleMan/XMLFiles/ExampleMan_AnimList.xml");	
        }
Careful! In the path you have to use these separators: "/"
When you copy the path from the Windows explorer you usually have these ones: "\"
They can't be read by the game. Also, start the path with the Data Folder, not with "C:/Steam" or anything like that. The game can only read the game's directory.

Save the file.
Done!

One last thing: You can do all these edits while the game is running. As soon as you save the, file the changes are in effect. That way you can test different keys directly. And in case the game gives you an error you can try to fix it or CTRL+Z your way back to safety. :D

And that's it.
Enjoy quick access to your favourite character.

EDIT: Previously I had used C for the new hotkey. By default, C deactivates the combat AI. That's why I have now changed it to G.

Post Reply