Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
BlackSheep

ACE Feature & mission parameter

Recommended Posts

Hi i trying to deal with ACE features via mission parameter, but i can't get them work.

Here is what i did :o

description.ext:

/* description.ext */

class Header {
gameType = Coop;
minPlayers = 1;
maxPlayers = 2;
};

// ============================================================================================

onLoadMission = "# Params Template";
OnLoadMissionTime = True;

// ============================================================================================

respawn = "base";
disabledAI = 0;
showCompass = 1;
showWatch = 1;
showGPS = 1;
showMap = 1;

// ============================================================================================

#include "Rsc\Parameters.hpp"

// ============================================================================================

Parameters.hpp:

/* Parameters */

class params {

   class BS_Time { //paramsArray[0]
           title = "Daytime";
           values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};			
           texts[] = {"00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"};
		default = 6;
	};

class BS_ViewDistance { //paramsArray[1]
           title = "Range of sight";
           values[] = {1000,1500,2000,2500,3000,3500,4000,4500,5000,6000,7000,8000,10000};             
		texts[] = {"1000m", "1500m", "2000m", "2500m", "3000m", "3500m", "4000m", "4500m", "5000m", "6000m", "7000m", "8000m", "10000m"};
           default = 2500;			
	}; 

class BS_TerrainGrid { //paramsArray[2]
           title = "Terrain detail";
           values[] = {3.125, 6.25, 12.5, 25, 50};
           texts[] = {"Very high", "High", "Normal", "Low", "Very low"};
		default = 25;
       };

class BS_Wounds { //paramsArray[3]
           title = "(ACE) Enable Wounding System";
		values[] = {0,1};
		texts[] = {"No", "Yes"};
		default = 1;
       };

class BS_Wounds_AI { //paramsArray[4]
           title = "(ACE) Enable Wounding System (AI)";
		values[] = {0,1};			
		texts[] = {"No", "Yes"};
		default = 1;
       };

class BS_Wounds_time { //paramsArray[5]
           title = "(ACE) Wounds Timeout";
		values[] = {120, 240, 360, 480};			
		texts[] = {"2min.", "4min.", "6min.", "8min."};
		default = 360;
       };

class BS_Wounds_Spect { //paramsArray[6]
           title = "(ACE) Enable Spectator";
		values[] = {0,1};			
		texts[] = {"No", "Yes"};
		default = 1;
       };

class BS_Talk { //paramsArray[7]
           title = "(ACE) Player Talk";
		values[] = {0,1};			
		texts[] = {"No", "Yes"};
		default = 1;
       };

};

Init.sqf:

/* Init.sqf */

private ["_i","_paramName","_c","_h"];
diag_log format ["############## %1 ##############", missionName];
diag_log [diag_frameno, diag_ticktime, time, "Executing Init.sqf"];

// Parameter
// Code from Killswitch
if (isNil "param1" && isNumber(missionConfigFile/"defValueParam1")) then
{
	param1 = getNumber (missionConfigFile/"defValueParam1");
};

if (isNil "param2" && isNumber(missionConfigFile/"defValueParam2")) then
{
	param2 = getNumber (missionConfigFile/"defValueParam2");
};

if (isNil "paramsArray") then
{
	paramsArray=[];

	if (isClass (missionConfigFile/"Params")) then
	{
		_c=count (missionConfigFile/"Params");
		for [ {_i=0}, {_i<_c}, {_i=_i+1} ] do
		{
			_paramName = (configName ((missionConfigFile >> "Params") select _i));
			paramsArray=paramsArray+[ getNumber (missionConfigFile >> "Params" >> _paramName >> "default") ];
		};
	};
	_c=count paramsArray;
	if (isNil "param1" && _c>0)then{param1=paramsArray select 0};
	if (isNil "param2" && _c>1)then{param2=paramsArray select 1};
};

if (isServer) then {

SkipTime (paramsArray select 0);
SetViewDistance (paramsArray select 1);
SetTerrainGrid (paramsArray select 2);
if ((paramsArray select 3) == 0) then { {ace_sys_wounds_enabled = false} else {ace_sys_wounds_enabled = true}; publicVariable "ace_sys_wounds_enabled" };
if ((paramsArray select 4) == 0) then { {ace_sys_wounds_noai = false} else {ace_sys_wounds_noai = true}; publicVariable "ace_sys_wounds_noai" };
if ((paramsArray select 6) == 0) then { {ace_sys_wounds_withSpect = false} else {ace_sys_wounds_withSpect = true}; publicVariable "ace_sys_wounds_withSpect" };
if ((paramsArray select 7) == 0) then { {ace_sys_aitalk_talkforplayer = false} else {ace_sys_aitalk_talkforplayer = true}; publicVariable "ace_sys_aitalk_talkforplayer" };

};

Thanks for any help and advice :)

Edited by BlackSheep
Topic title

Share this post


Link to post
Share on other sites

I would rename this thread "Help placing modules dynamically via parameters" instead of "ACE" anything as that'll just get your thread closed. :)

Share this post


Link to post
Share on other sites

Thanks for the hint, have changed the title as you suggested it. ;)

### Edit ###

Looks like i can't change the topic title :confused:

Edited by BlackSheep

Share this post


Link to post
Share on other sites

I found this post in the ACE Wagn today

Enable/Disable wounds based on mission parameter

In the description.ext add:

class Extended_PreInit_EventHandlers {
  class mission_name { // Replace mission_name with name of your mission
     serverInit = "if (params select 10) then { ace_sys_wounds_enabled = true;publicVariable 'ace_sys_wounds_enabled' }";
  };
};

http://ace.dev-heaven.net/wagn/Wounding_System#Enable/Disable%20wounds%20based%20on%20mission%20parameter

So here is my attempt from the description.ext :

/* description.ext */

class Header {
gameType = Coop;
minPlayers = 1;
maxPlayers = 2;
};

// ============================================================================================

onLoadMission = "# Params Template";
OnLoadMissionTime = True;

// ============================================================================================

respawn = "base";
disabledAI = 0;
showCompass = 1;
showWatch = 1;
showGPS = 1;
showMap = 1;

// ============================================================================================

#include "Rsc\Parameters.hpp"

// ============================================================================================

class Extended_PreInit_EventHandlers {

  class BS_Time {
     serverInit = "";

  };

  class BS_ViewDistance {
     serverInit = "";
  };


  class BS_TerrainGrid {
     serverInit = "";
  };

  class BS_Wounds {
     serverInit = "if ((paramsArray select 3) == 0) then { {ace_sys_wounds_enabled = false} else {ace_sys_wounds_enabled = true}; publicVariable 'ace_sys_wounds_enabled' }";
  };

  class BS_Wounds_AI {
     serverInit = "if ((paramsArray select 4) == 0) then { {ace_sys_wounds_noai = false} else {ace_sys_wounds_noai = true}; publicVariable 'ace_sys_wounds_noai' }";
  };

  class BS_Wounds_time {
     serverInit = "";
  }; 

  class BS_Wounds_Spect {
     serverInit = "if ((paramsArray select 6) == 0) then { {ace_sys_wounds_withSpect = false} else {ace_sys_wounds_withSpect = true}; publicVariable 'ace_sys_wounds_withSpect' }";
  };

  class BS_Talk {
     serverInit = "if ((paramsArray select 7) == 0) then { {ace_sys_aitalk_talkforplayer = false} else {ace_sys_aitalk_talkforplayer = true}; publicVariable 'ace_sys_aitalk_talkforplayer' }";
  }; 

};

But it does not work for me :confused:

What i doing wrong ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

×