Can I set an AI faction with mission parameters?

  1. 7 years ago

    Hey everyone,

    I've been making a mission for a week for me and my buddies to play, and it's coming along nicely. But, one thing I've started doing is adding the ability to customize certain aspects of the missions. The one thing EVERYONE wanted is the ability to choose the insurgent faction, so we can switch the enemy team depending on what mods we are running.

    But, I can't figure out how to do this. I've got the parameters and everything set up, but I've searched and searched again and can't find any way to get the Military AI Commander module to use a value from a parameter.

    description.ext:

    class Params
    {
    	class InsTeam
    	{
    		title = "Insurgents";
    		texts[] = {"FIA", "Syndikat"};
    		values[] = {OPF_G_F,IND_C_F};
    		default = OPF_G_F;
    		isGlobal = 0;
    	};
    };

    Setting the "Override Factions" line to "InsTeam" call BIS_fnc_getParamValue does not work. It just tries to use the code as a faction name. Can anyone help me out? Is it even possible?

    Thanks!

  2. Why not just do it the easy way and have two different mission PBO's, where the missions are identical aside from the insurgent faction?

  3. @HeroesandvillainsOS  Why not just do it the easy way and have two different mission PBO's, where the missions are identical aside from the insurgent faction?

    I considered it, and while certainly easier, I really want to be able to just use parameters. I'm still constantly updating scripts and adding new features, and I don't want to have to update 3-5 missions every time.

  4. Fair enough. I can definitely see why that would be easier. I'm not sure if it's possible but you're posting in the right place so good luck.

  5. Edited 7 years ago by SpyderBlack723

    Not really going to be easy because this data is stored in the mission.sqm seeing as how it's in a module.

    You would need to run code on pre or post init (and hope that mission parameter data is already initialized by this point), grab your parameter value, and then loop through all modules, finding and modifying the OPCOM module you wish to customize.

 

or Sign Up to reply!