Jump to content
jakeplissken

Calling function with description.ext. Need help with parameters.

Recommended Posts

I have the bis_fnc_prepareAO function working in my mission from description.ext. I am running it locally from the mission as it is rewritten to spawn Project OPFOR units.

 

class CfgFunctions
{
   class foreign_invasion_altis
   {
       tag = "foreign_invasion_altis";

       class Spawning
       {
           file = "foreign_invasion_altis\functions";
           class PrepareAO    {
               description = "This is a function that spawns AI.";
			   file = "functions\fn_PrepareAO.sqf";
           };
       };
   };  
};

But I need to add parameters.

 

I call it like this

 

11 call foreign_invasion_altis_fnc_prepareAO;

 

But it will not spawn any AI as it is not getting any parameters. I am just confused as to what I need to change to fix this.

 

Thanks.

Share this post


Link to post
Share on other sites

Should work fine, are you sure the file and folder are correctly named (case sensitive)?

Also check out the ingame functions viewer and set it to mission config file, your foreign_invasion_altis_fnc_PrepareAO function should show up there, with the contents of the fn_PrepareAO.sqf.

About the parameters, how does the fn_PrepareAO.sqf look like?

 

Cheers

Share this post


Link to post
Share on other sites

Main parameter in the function is this.

 

BIS_PAO_patrolIndex = _this;

 

Which works with this.

 

	// random patrols
	if (triggerText _x == "GEN_infantry") then {
		_x spawn {
			waitUntil {!isNil "BIS_fps_simulSteps"};
			_basePos = position _this;
			_rad = (triggerArea _this) select 0;
			_sideIndex = ["WEST", "EAST", "GUER"] find ((triggerActivation _this) select 0);
			_correctSide = [WEST, EAST, RESISTANCE] select _sideIndex;
			deleteVehicle _this;
			_oldFPSStep = BIS_fps_simulSteps;
			while {TRUE} do {	// no need to test every frame, use Simulation Manager test loops instead
				waitUntil {BIS_fps_simulSteps > _oldFPSStep};
				if ({(_x distance _basePos) < (2000 + _rad) && ((_x distance _basePos) >= (1000 + _rad) || time < 5) && !(vehicle _x isKindOf "Air")} count units group player > 0) exitWith {};
				_oldFPSStep = BIS_fps_simulSteps;
			};
			for [{_x = 1}, {_x <= (_rad / (125 / BIS_PAO_patrolIndex))}, {_x = _x + 1}] do { // parameter BIS_PAO_patrolIndex here.
				_pos = [_basePos, random _rad, random 360] call BIS_fnc_relPos;
				_newGrp = grpNull;
				if (random 1 > 0.75) then {	// some launchers here and there
					_newGrp = [_pos, _correctSide, (BIS_PAO_specialPatrols select _sideIndex) select floor random count BIS_PAO_specialPatrols] call BIS_fnc_spawnGroup;
				} else {
					_newGrp = [_pos, _correctSide, (BIS_PAO_footPatrols select _sideIndex) select floor random count BIS_PAO_footPatrols] call BIS_fnc_spawnGroup;
				};
				{_x call BIS_PAO_corpseRemoval} forEach units _newGrp;
				[_newGrp, _rad] spawn {
					_oldFPSStep = BIS_fps_simulSteps;
					while {TRUE} do {	// no need to test every frame, use Simulation Manager test loops instead
						waitUntil {BIS_fps_simulSteps > _oldFPSStep};
						if ({(_x distance leader (_this select 0)) < (4000 + (_this select 1))} count units group player == 0) exitWith {};
						_oldFPSStep = BIS_fps_simulSteps;
					};
					{deleteVehicle _x} forEach units (_this select 0);
					deleteGroup (_this select 0);
					BIS_fps_rescanNewObjects = TRUE;
				};
				if ((random 1) > 0.75) then {	// some groups will actively hunt the players
					_wp = _newGrp addWaypoint [position leader _newGrp, 0];
					_wp setWaypointType "GUARD";
				} else {
					{
						_wp = _newGrp addWaypoint [_basePos, _rad];
						_wp setWaypointType "MOVE";
						_wp setWaypointSpeed "LIMITED";
						_wp setWaypointBehaviour "SAFE";
					} forEach [1, 2, 3, 4, 5];
					_wp = _newGrp addWaypoint [waypointPosition [_newGrp, 1], 0];
					_wp setWaypointType "CYCLE";
				};
			};
			BIS_fps_rescanNewObjects = TRUE;
		};
	};

But I hardcode the value like this.

 

BIS_PAO_patrolIndex = 12;

 

And it does not spawn any infantry at all. I guess this function does not like being edited.

Edited by jakeplissken
Edit code, add clarification.

Share this post


Link to post
Share on other sites

Ah, now I see that you're trying to make BIS functions do to your bidding, not the easiest task since it's convoluted as hell to look through and most of the time linked to be used with modules/triggers.

Might be better off making your own populate ao function.

 

Cheers

Share this post


Link to post
Share on other sites

Why don't you create your own groups in cfgGroups and use them in the BI module?

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

×