Overriding classes



  • I’m trying to override a class in:

    steamapps\common\chivalrymedievalwarfarebeta\Development\Src\AOC\classes

    but I’m not sure what the process is. I know how to code so actually making the changes isn’t a problem, but I don’t know how to test the changes as I go along, or even how to make the game use my class instead of the one I’m overriding.

    Sorry if this is covered somewhere, but I couldn’t find it. Any help would be appreciated.

    edit
    More detail: I want to use a subclass of AOCAICombatController.uc for bots when we’re in FFA mode.



  • Hi, I’m sure I will get around to making a guide for this at one point.

    For now I’ll say this: Your entry point is always a game-mode. Override AOCFFA with a new game-type, then you have to follow along the chain to your AOCAICombatController, overriding as you go.

    Found out what class chooses to use AOCAICombatController, and override it, then find out which class uses that class and override it (You don’t need to override all instances of every class, think about what is relevant). Your goal is to get back to your new game-mode. You can then load your gametype with “open AOCFFA-Moor_P?game=ScriptPackageName.MyCustomFFAMode,” replacing with your specifics appropriately, of course.

    Hopefully that makes sense. Unfortunately there’s not common method for doing this, and some classes may be easier to override than others. Good luck!



  • @NabsterHax:

    Hi, I’m sure I will get around to making a guide for this at one point.

    For now I’ll say this: Your entry point is always a game-mode. Override AOCFFA with a new game-type, then you have to follow along the chain to your AOCAICombatController, overriding as you go.

    Found out what class chooses to use AOCAICombatController, and override it, then find out which class uses that class and override it (You don’t need to override all instances of every class, think about what is relevant). Your goal is to get back to your new game-mode. You can then load your gametype with “open AOCFFA-Moor_P?game=ScriptPackageName.MyCustomFFAMode,” replacing with your specifics appropriately, of course.

    Hopefully that makes sense. Unfortunately there’s not common method for doing this, and some classes may be easier to override than others. Good luck!

    Thanks for the great response Nabster. I was hoping for some kind of dependency injection to avoid having to override classes just to change a dependency, but nevermind! :D


Log in to reply