How to extend Behaviours?

Users who are viewing this thread

Obviously extending MBSubModuleBase is easy to do and gets recognized easily. On the other hand extending CampaignBehaviorBase doesn't seem to be that straight forward, my methods overriding any functions there don't get called, but I do see people doing it. Is there something obvious I miss? Thanks!
 
Solution
Did you add the mission behaviour? Here's an example from a chipmunk cheering mod I'm playing around with for fun. It's in my SubModule class.

C#:
public override void OnMissionBehaviourInitialize(Mission mission)
{
    // Field Battle
    if(mission.HasMissionBehaviour<FieldBattleController>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());

    // Custom Battle
    if(mission.HasMissionBehaviour<CustomBattleMissionSpawnHandler>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());
}
Actually extending the behavior method is only a part of it. Behaviors are registered in the game and those registered calls are the one making your mod used.
That exactly why i'm working on a loader that handles this for you. If you want to make the work on your own you should check the campaign object and all that is related to behavior listeners, and you should call those modification in the OnGameInitializationFinished part of the submodule.

Here is a post with my loaders and informations of how it works and how to load modules without using it if you wish.
 
Upvote 0
Did you add the mission behaviour? Here's an example from a chipmunk cheering mod I'm playing around with for fun. It's in my SubModule class.

C#:
public override void OnMissionBehaviourInitialize(Mission mission)
{
    // Field Battle
    if(mission.HasMissionBehaviour<FieldBattleController>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());

    // Custom Battle
    if(mission.HasMissionBehaviour<CustomBattleMissionSpawnHandler>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());
}
 
Upvote 0
Solution
Did you add the mission behaviour? Here's an example from a chipmunk cheering mod I'm playing around with for fun. It's in my SubModule class.

C#:
public override void OnMissionBehaviourInitialize(Mission mission)
{
    // Field Battle
    if(mission.HasMissionBehaviour<FieldBattleController>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());

    // Custom Battle
    if(mission.HasMissionBehaviour<CustomBattleMissionSpawnHandler>())
        mission.AddMissionBehaviour(new Controllers.FieldBattleCheerController());
}

Thank you, sir!
 
Upvote 0
Back
Top Bottom