Jump to content
razzored

Mission params / spawn AI module setting

Recommended Posts

Hey i cannot find anything regarding the functions, classes, values ect surrounding the spawn AI module.

I’m working on a mission with 2 custom AI factions spawning and fighting for control, however since it is PVP PVE I want players to be able to select amount of AI in parameters.. not sure how to go about it though.

so far in the module it’s set to 20 manpower per faction, I ofc would want more options like 

5,10,20default,30,40 ect.

I already know the basics of setting up description.ext Params.. but I cannot find enough data on the Ai module to even begin figuring out what to do🤷🏼‍♂️
Any help is much appreciated.

Share this post


Link to post
Share on other sites
_mySpawnAIModule setVariable ["manpowerCap",50];

See a3\modules_f_heli\misc\functions\modulespawnai\main.sqf for the main loop that looks after the spawn AI modules.

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Larrow said:

_mySpawnAIModule setVariable ["manpowerCap",50];

See a3\modules_f_heli\misc\functions\modulespawnai\main.sqf for the main loop that looks after the spawn AI modules.

 

Thanks for the quick reply!

So something like this? This is the best attempt i could come up with in regards of using the Params setup.
Not sure what's wrong, but i cannot test if the setting works, since the "params" button does not show up in game..

This is ofc from (description.ext).
 

Spoiler

class Params
{
	class WestAI
	{
		title = "USMC AI";
		texts[] = {"Morning","Day","Evening","Night"};
		values[] = {10,15,20,30,50};
		default = 20;
		function = "_spawnAI_module_West setVariable ["manpowerCap",(_this select 0)]"; 
	};
	class EastAI
	{
		title = "Insurgent AI";
		texts[] = {10,15,20,30,50};
		values[] = {6,12,18,0};
		default = 20;
		function = "_spawnAI_module_East setVariable ["manpowerCap",(_this select 0)]"; 
	};	
	class Daytime
	{
		title = "Time";
		texts[] = {"Morning","Day","Evening","Night"};
		values[] = {6,12,18,0};
		default = 12;
		function = "BIS_fnc_paramDaytime"; 
		isGlobal = 0; 
	};
	class ViewDistance
	{
		title = "View distance (in metres)";
		values[] = {500,1000,2000,5000};
		default = 1000;
		file = "setViewDistance.sqf"; // 
	};
};

 

 

Share this post


Link to post
Share on other sites

hold on, im trying something else... _spawnAI_Module_east setvariable is not a function.. running it in a SQF and using "file" command instead, i have the options now.. just gotta see if it works 🙂

Share this post


Link to post
Share on other sites

Alright, my setup is not working right, i can get the params up and make a selection, but it seems the enemy manpower is the same, regardless.
This is what i've done so far. (the modules are called spawnAI_module_West and spawnAI_module_East).

 

Description.ext

Spoiler

class Params
{
	class WestAI
	{
		title = "USMC AI";
		texts[] = {5,10,15,20,30,50};
		values[] = {5,10,15,20,30,50};
		default = 20;
		file = "AIWEST.sqf"; 
	};
	class EastAI
	{
		title = "Insurgent AI";
		texts[] = {5,10,15,20,30,50};
		values[] = {5,10,15,20,30,50};
		default = 20;
		file = "AIEAST.sqf"; 
	};	
	class Daytime
	{
		title = "Time";
		texts[] = {"Morning","Day","Evening","Night"};
		values[] = {6,12,18,0};
		default = 12;
		function = "BIS_fnc_paramDaytime"; 
		isGlobal = 0; 
	};
	class ViewDistance
	{
		title = "View distance (in metres)";
		values[] = {500,1000,2000,5000};
		default = 1000;
		file = "setViewDistance.sqf"; 
	};
};

 

 

AIWEST.sqf
 

Spoiler

_spawnAI_module_West setVariable ["manpowerCap",(_this select 0)];

 

 

AIEAST.sqf

Spoiler

_spawnAI_module_East setVariable ["manpowerCap", (_this select 0)];

 

 

Share this post


Link to post
Share on other sites

So, i think i got it working? its hard to say since 5 manpower does not equal 5 soldiers..
The way the  "manpower" system works is kind of odd, with it being more equipment based?
Anycase, right now i used params to set 1 faction to 5 manpower and they have 15 units, the other i set to 50 and they have like 30 units and a few being spawned still.

What i did to fix was this, feel free to use or correct if i made any mistakes.
 

Description.EXT

Spoiler

class Params
{
	class WestAI0
	{
		title = "USMC AI";
		texts[] = {5,10,15,20,30,50};
		values[] = {5,10,15,20,30,50};
		default = 20;
	};
	class EastAI1
	{
		title = "Insurgent AI";
		texts[] = {5,10,15,20,30,50};
		values[] = {5,10,15,20,30,50};
		default = 20;
	};	
	class Daytime2
	{
		title = "Time";
		texts[] = {"Morning","Day","Evening","Night"};
		values[] = {6,12,18,0};
		default = 12;
		function = "BIS_fnc_paramDaytime"; 
		isGlobal = 0; 
	};
	class ViewDistance3
	{
		title = "View distance (in metres)";
		values[] = {500,1000,2000,5000};
		default = 1000;
		file = "setViewDistance.sqf"; 
	};
    class Weather4
    {
		title = "Weather";
		values[] = {0,1,2,3};
		texts[] = {"Clear","Cloudy","Stormy","Foggy"};
		default = 0;
	};		
    class Respawns5
    {
		title = "USMC Points";
		texts[] = {"50","100","200","300"};		
		values[] = {50,100,200,300};
		default = 200;		
	};		
    class Respawns6
    {
		title = "Insurgent Points";
		texts[] = {"50","100","200","300"};		
		values[] = {50,100,200,300};
		default = 200;			
	};
};

 

 

 

Init (the part handling manpower)

Spoiler

switch (paramsarray select 0) do {
  case 5: { _spawnAI_module_West setVariable ["manpowerCap",5]; };
  case 10: { _spawnAI_module_West setVariable ["manpowerCap",10]; };     
  case 15: { _spawnAI_module_West setVariable ["manpowerCap",15]; };
  case 20: { _spawnAI_module_West setVariable ["manpowerCap",20]; };
  case 30: { _spawnAI_module_West setVariable ["manpowerCap",30]; }; 
  case 50: { _spawnAI_module_West setVariable ["manpowerCap",50]; };
};

switch (paramsarray select 1) do {
  case 5: { _spawnAI_module_East setVariable ["manpowerCap",5]; };
  case 10: { _spawnAI_module_East setVariable ["manpowerCap",10]; };     
  case 15: { _spawnAI_module_East setVariable ["manpowerCap",15]; };
  case 20: { _spawnAI_module_East setVariable ["manpowerCap",20]; };
  case 30: { _spawnAI_module_East setVariable ["manpowerCap",30]; }; 
  case 50: { _spawnAI_module_East setVariable ["manpowerCap",50]; };



🙂

Also thank you @Larrow You are the person making this mission possible for me as every bit of research i have done, i seem to have hit posts where your answer was THE answer 🙂 

Share this post


Link to post
Share on other sites

New problem.
Everything works now..
 Except the AI isn't spawning when mission is ran on dedicated server.
Any clues how to call the variables publicly or whatever needs to be done to fix that?

Share this post


Link to post
Share on other sites

haha thanks Larrow, i looked into one of your old threads and found the answer i was looking for.
Legend.

Share this post


Link to post
Share on other sites

Glad you found a solution. I just have one thing to suggest here that is not critical and won't change the behaviour of your script, but I think it will somehow make the script a wee bit "better-looking" ;). In your init, you could avoid using a switch statement and try something like

// Get manpowers
private _westManPower = paramsarray select 0; // West manpower
private _eastManPower = paramsarray select 1; // East manpower

// Set the variables
_spawnAI_module_West setVariable["manpowerCap", _westManPower]; // Set west manpower variable
_spawnAI_module_East setVariable["manpowerCap", _easManPower]; // Set east manpower variable

Or, even shorter could be

// Set the variables
_spawnAI_module_West setVariable["manpowerCap", paramsarray select 0]; // Set west manpower variable
_spawnAI_module_East setVariable["manpowerCap", paramsarray select 1]; // Set east manpower variable

Happy ArmA 🙂.

  • Like 1

Share this post


Link to post
Share on other sites
Spoiler
21 hours ago, ZaellixA said:

Glad you found a solution. I just have one thing to suggest here that is not critical and won't change the behaviour of your script, but I think it will somehow make the script a wee bit "better-looking" ;). In your init, you could avoid using a switch statement and try something like



// Get manpowers
private _westManPower = paramsarray select 0; // West manpower
private _eastManPower = paramsarray select 1; // East manpower

// Set the variables
_spawnAI_module_West setVariable["manpowerCap", _westManPower]; // Set west manpower variable
_spawnAI_module_East setVariable["manpowerCap", _easManPower]; // Set east manpower variable

Or, even shorter could be



// Set the variables
_spawnAI_module_West setVariable["manpowerCap", paramsarray select 0]; // Set west manpower variable
_spawnAI_module_East setVariable["manpowerCap", paramsarray select 1]; // Set east manpower variable

Happy ArmA

🙂

THANKS 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×