Results 1 to 3 of 3
  1. #1
    spe3dy12's Avatar
    Join Date
    Jul 2016
    Gender
    male
    Location
    Under your table.
    Posts
    14
    Reputation
    10
    Thanks
    10

    Post Coding - Introduction

    Hello MPGH Members,

    I've created this thread as a tutorial for those who want to hack/mod.

     


    > To start, download Visual Studio [Any year version or type].

    Terraria is a .exe game which you may have to decompile, or you can download source code files from this website, and once you've acquired the source code, you can start modding the game!

    > Firstly, load up the .sln or .csproj file that comes with the source code, this will open up in Visual Studio once you've downloaded it. You'll be able to see all kinds of files you can edit to modify your gaming experience, but code can be hard to understand in a complex game, so you will be learning new things while you start coding.

    > We want the game to run flawlessly and smoothly, so we want to get the errors out the way.

    > Copy your "Content" folder, steam_api.dll, CSteamworks.dll and steam_appid.txt located in:
    C:\Program Files*\Steam\steamapps\common\Terraria\
    The contents folder contains all the images and sounds for the game. Without these, the game can't run properly.

    * Can be "Program Files(x86)"

    > Open Visual Studio and find this line of code located in Terraria.Social.SocialAPI.cs.
    Code:
                {
                    SocialAPI.LoadSteam();
                }
                foreach (ISocialModule current in SocialAPI._modules)
                {
                    current.Initialize();
                }
    > You want to comment out SocialAPI.LoadSteam(); by putting 2 forward slashes in from of it [//]. What this will do is cut the connection from Terraria connecting with Steam, this doesn't need to be done but is useful if your making a modding client.

    > You're ready to begin with modding!


     

    The menu text are in the bottom left and right corner, which you can edit to fit your client, e.g. naming your client and putting the version.
    > To accomplish this you need to find the current version number, which is in a variable.
     

    > Constants are values or strings you can change all the time.
    e.g.

    Code:
    public static string versionNumber = "v1.3.2.1";
    In this example, "string" is a sequence of characters, numbers etc.
    "string" can also be "int" meaning integer, which can be a number.

    This constant can be referred to later on as "versionNumber" instead of v1.3.2.1 and having to change it all every time the game updates.

    If you use constants, to change the version, all you have to do is replace "v1.3.2.1" which is pretty simple stuff but it's a very powerful skill in C#.

    So to change the text isn't just simply changing the versionNumber, as the versionNumber is referred in many other things other than the menu text.
    What you need to do is find the exact few lines of code that make up the menu text:

    > To do this, hold Ctrl+F, and type in "versionNumber". Keep on clicking the "Find Next" until you stumble to these lines of code:

    Code:
                    Vector2 origin3 = Main.fontMouseText.MeasureString(Main.versionNumber);
                    origin3.X *= 0.5f;
                    origin3.Y *= 0.5f;
                    Main.spriteBatch.DrawString(Main.fontMouseText, Main.versionNumber, new Vector2(origin3.X + (float)num107 + 10f, (float)Main.screenHeight - origin3.Y + (float)num108 - 2f), color12, 0f, origin3, 1f, SpriteEffects.None, 0f);
     

    > Vector2 is, simply just both 2 values instead of 3, (2D).

    > Main.fontMouseText is the text font that the game uses to make the text, called Andy.

    > Main.versionNumber is that constant that we were talking about earlier, and instead we can put anything else, or maybe another constant that we can change later on.

    > The next two lines of code are pretty simple, the X and the Y for origin3, (bottom-left corner).

    > The next line is pretty long, but it's simply just all the things needed for making UI.

    > The code we want to change is [Main.versionNumber] which we can replace to anything like "My modding client v1.0" but make sure to put "".
    > My recommendation is to make this a variable so we can change it. My constant name is going to be: hackVersionNumber; Simple and short and easily able to understand. So what we want to do change it to Main.hackVersionNumber but we need to define it because the program doesn't understand what the line of text means.
     

    > To define a constant, we need to scroll all the way up to the top of the page and type in:
    Code:
            private const string hackVersionNumber = "My modded client v1.0";
    Make sure it's near "versionStringBecauseTheyreTheSame" where all the other constants are.
    Just click the line of code and press enter twice, and type it in.

    When you debug the game (by pressing the Debug button at the top-middle) the "v1.3.2.1" should be replaced with whatever text you did in the variable.


    I hope you've enjoyed modding and reading this thread, ask any questions if your having trouble and I'll be creating many more in the time to come.
    ~Cya

  2. The Following 3 Users Say Thank You to spe3dy12 For This Useful Post:

    Dexter (07-25-2016),LorestO (10-25-2016),sponers (11-17-2016)

  3. #2
    Dexter's Avatar
    Join Date
    Aug 2015
    Gender
    male
    Location
    I post to increase postcount
    Posts
    1,566
    Reputation
    273
    Thanks
    9,271
    Thanks for sharing.

  4. #3
    LorestO's Avatar
    Join Date
    Mar 2014
    Gender
    male
    Location
    Russia
    Posts
    2
    Reputation
    10
    Thanks
    0
    Thanks you. I'm waiting a new threads! Dat amazing! Can u make tutorial "how to make: one click - kill enemy?" or "how to make: mouse lighting" or "how to make: item spawner"? That very cool!

Similar Threads

  1. [Tutorial] [ Viral code and computer viruses ] An introduction
    By .::SCHiM::. in forum C++/C Programming
    Replies: 14
    Last Post: 06-19-2016, 12:24 AM
  2. Replies: 37
    Last Post: 06-20-2006, 04:24 PM
  3. Pre-Regerstration - E3 Codes
    By Dave84311 in forum WarRock - International Hacks
    Replies: 67
    Last Post: 06-13-2006, 08:06 AM
  4. hi can any1 help me make or find a cheat code
    By CrUsHa in forum WarRock - International Hacks
    Replies: 3
    Last Post: 05-19-2006, 04:39 PM
  5. a Couple WPE Weapon codes?
    By phil823 in forum WarRock - International Hacks
    Replies: 16
    Last Post: 02-10-2006, 02:14 PM