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

HowTo - getting Mods to run in your server

Discussion in 'Modding Help' started by Strathos, Oct 8, 2013.

  1. Strathos

    Strathos KAG Guard Tester

    Messages:
    198
    The steps can vary from mod to mod, but in all cases: all modifications or additions should be placed into their own folder, then inside the Mods folder and finally activated via the mods.cfg file. The exception is maps, which can go in the Base/Maps folder.
    Any activated mods will be transfered to the clients when they connect to your server.
    mods folder!.png
    Code:
    Mod path example: "/KAG-Beta/Mods/YourMod/YourScript.as"
    Overriding default scripts
    Consider YourMod folder as if it actually were the Base folder. Files in YourMod folder will 'override' default Base files if they have matching relative paths. So if you modify an existing file, such as KnightLogic.as you should place it in "../Mods/YourMod/Entities/Characters/Knight/" for it to run over the default script.
    In this case it would be a good practice for modders to provide a zip file with all the files in their corresponding folders so it's just necessary to unzip it @ the Mods folder.

    New, non-default scripts
    For new scripts you need to specify when they are ran inside an appropriate cfg file, usually gamemode.cfg or class.cfg/item.cfg such as Archer.cfg or Ballista.cfg. Look for the "scripts =" list and add the script filename there. The modder should clarify which scripts (if any) got to be added to the lists.
    knight scripts list.png

    Let's take as an example Dash.as. It's a class-related script that adds a new ability and we want to enable it for Knights and Archers, so we will include "Dash.as;" in the scripts list of copies of Archer.cfg and Knight.cfg that will be placed in their respective relative paths inside "../Mods/Dash/".

    We end up with:
    "../Mods/Dash/Entities/Characters/Knight/Knight.cfg" <- add Dash.as in the scripts list
    "../Mods/Dash/Entities/Characters/Archer/Archer.cfg" <- add Dash.as in the scripts list
    "../Mods/Dash/Dash.as" <- Path doesn't matter because it's not replacing any default file

    Loading custom Gamemode Rules

    This doesn't work for now using the Mods folder because server_autostart.as won't find rules there. It's possible to use a custom DefaultStart.as script, but it's hackish and at the moment I can't get it to work for clients.

    Activating the Mod(s)
    Pretty straight forward: edit mods.cfg and add to the list the folder name of each of the mods you want to enable.

    Starting the server

    Once the files are in place and the mod activated you can start your server using the default autoconfig and autostart. It should automatically detect the mods and send them to clients when they join.

    ~ ~ ~
    This is guide is bound to contain errors, but hopefully it helped more than confused. I will be updating/extending it.
     
    Last edited: Oct 8, 2013
    zerd, BlueLuigi, kilmanio and 3 others like this.
  2. sinnertie

    sinnertie Ministry of Hatred Forum Moderator Donator Tester
    1. PumpkinStars - [Pk#] - Inactive

    Messages:
    252
    Great work! That might solve my problem with Dash mod and I will finally get it working as well as @kaizokuroof and other people. I would suggest to stick this topic.
     
    Last edited: Oct 8, 2013
  3. jackitch

    jackitch :(){ :|: & };: Global Moderator Donator Tester
    1. SharSharShar - [SHARK]

    Messages:
    249
    Advice taken

    //stickified

    EDIT:
    I think this does work, I just placed a custom (FFA) folder in Base/Rules and put Base/Rules/foldername/ in my autoupdate_ignore_custom.cfg file. I also put the DefaultStart.as in there as well to get the right loaders for it. It works fine as I can tell, although the icon for the mode shows as a question mark (no big deal).

    As far as I know, it must work for clients bc people have been able to play on my server just fine without my server having anything in the mods folder.

    If what I said doesn't make sense, ping me on IRC and I'll walk you through it.
     
    Last edited: Oct 8, 2013
    sinnertie likes this.
  4. SirLoading

    SirLoading Bison Rider

    Messages:
    22
    If you have gamemode.cfg file placed in KAG/Mods/SomeMod/Gamemode, instead of writing name of already existing Gamemode in autoconfig.cfg file, write there:
    Code:
    sv_gamemode = ../../Mods/SomeMod/Gamemode
     
  5. nirvanajm

    nirvanajm Builder Stabber

    Messages:
    8
    Hey SirLoading! i found the same solution (but i think you forgot Rules folder : sv_gamemod = ../../Mods/SomeMod/Rules/Gamemode
    You can do same thing with sv_mapcycle (only if map_cycle is in Mod and not in right place) or leave blank to use mapcycle in Rules/Gamemode folder (this is right place)

    For now i dont use this solution but im using script made by norill (thanks norill) that fix the default starter issu (his problem is that it dont use gamemod.cfg in Mod/ folder but only in Bases/ folder) . So you need to put this files "DefaultStart.as"

    in Mods/YourMod/Scripts/Default/DefaultStarter.as
    The only condition for it to run properly is that your Mod name is same as your game rules (for example you need to have ../Mods/GAMEMOD1/Rules/GAMEMOD1

    And so your able to put in autoconfig.cfg >>> sv_gamemode = GAMEMOD1
    DOnt forget to modify this : "gamemode_name = GAMEMOD1" >>> in the files ../Mods/GAMEMOD1/Rules/GAMEMOD1/gamemod.cfg so everyone is happy :D

    This is DefaultStart.as
    Code:
    // default startup functions for autostart scripts
    
    #include "Default/DefaultGUI.as"
    #include "Default/DefaultLoaders.as"
    
    void RunServer()
    {
        if (getNet().CreateServer())
        {
            if(LoadMapCycle( "../Mods/" + sv_gamemode + "/Rules/" + sv_gamemode + "/gamemode.cfg" )){
                LoadRules( "../Mods/" + sv_gamemode + "/Rules/" + sv_gamemode + "/gamemode.cfg" );
            } else {
                LoadRules(  "Rules/" + sv_gamemode + "/gamemode.cfg" );  
            }
    
            if (sv_mapcycle.size() > 0) {
                LoadMapCycle( sv_mapcycle );
            } else {
                if(!LoadMapCycle( "../Mods/" + sv_gamemode + "/Rules/" + sv_gamemode + "/mapcycle.cfg" ))
                    LoadMapCycle( "Rules/" + sv_gamemode + "/mapcycle.cfg" );
            }
            //LoadDefaultMapLoaders();
            LoadNextMap();
        }
    }
    
    void ConnectLocalhost()
    {
        getNet().Connect( "localhost", sv_port );
    }
    
    void RunLocalhost()
    {
        RunServer();
        ConnectLocalhost();
    }
    
    void LoadDefaultMenuMusic()
    {
        CMixer@ mixer = getMixer();  
        if (mixer !is null)
        {
            mixer.ResetMixer();
            mixer.AddTrack( "Sounds/Music/KAGWorldIntroA.ogg", 0 );
            mixer.FadeInRandom(0, 0.1f );
        }
    }
    
     
    FranticIch and Inferdy like this.
  6. Blue_Tiger

    Blue_Tiger Bison Rider Tester

    Messages:
    899
    Hi.

    I know this is a huge bump, but this is really confusing for me and I need some help.

    I downloaded the .as file from https://forum.kag2d.com/threads/make-archer-hotkeys-for-arrow-types.19924/ and made a mod folder called 'archer', put in there CustomArcherHotkeys.as and folders Entities->Characters->Archer->Archer.cfg which has the following code:

    Code:
    # general
    
    $name                                            = archer
    @$scripts                                        = RunnerDefault.as;
                                CustomArcherHotkeys.as;
    and my mods.cfg has code:

    Code:
    # Add mods (directory names) from /Mods directory to be used by this game
    # use line breaks between mods eg.
    # Optionally add " = devName:modName" after the directory (where devName and
    # modName refer to the mod's registration info - the developer and the modURL)
    # to enable auto-updating via the Web API (if that is available for the mod)
    
    archer;
    I don't see the problem here, and this is really confusing as I don't know the syntax at all to try to fix it.
     
  7. Skinney

    Skinney THD Team THD Team Forum Moderator Tester

    Messages:
    468
    The string you use in Mods.cfg should be exactly the same as your folder name. Since the mod you're trying to load is named "archer", the line in mods.cfg should be "archer" and not "archer;".
     
  8. Blue_Tiger

    Blue_Tiger Bison Rider Tester

    Messages:
    899
    I changed that, but it still doesn't seem to work. Maybe the .as file is outdated =/.

    Edit: Ok, so I realised this is specifically for servers, so I attempted it in solo mode and it worked - would I have to do the same outside of the mod folder?

    Edit: I put the .as file in 'Base' and nothing happens.
    --- Double Post Merged, Oct 17, 2014, Original Post Date: Oct 16, 2014 ---
    Does anyone know where I would have to put files in order for them to work as a client-side mod rather than a server-side one?
    --- Double Post Merged, Apr 14, 2015 ---
    Hey, I was just messing about with some files to see what I could do, but for some reason no mods are able to run when I play in sandbox mode - is this changed? I don't want to run a local server just to test stuff. I was doing just as I was when I was posting 6 months ago and it was working fine then.

    Thanks.
     
  9. darkmetaknight

    darkmetaknight Catapult Fodder

    Messages:
    6
    So I searched the forums, but there didn't seem to be an answer to this...
    How would you go about making custom maps load up on a server? I got a custom map pack but I have no idea where to put it, how to get it to load on the server or...Anything really.

    Edit:
    Never mind, found the wiki. ::):
     
    Last edited: Jun 19, 2015