Jump to content
zagor64bz

Help a noob with class CfgFunctions in description

Recommended Posts

Hi guys,

I have 2 scripts from Cobra running in my WIP mission:COB extraction and COB_HALO.

They work fine on their own, but together they conflict on mission loading(in editor).

In my description.ext if I write this:

 

class CfgFunctions 

{

#include "COB\functions\cfgFunctions.hpp"

};

#include "COB_HALO\functions\cfgFunctions.hpp"

 

I have this error: COB_HALO\function\cfgFunctions.hpp, line 10:cfgFunctions:member already defined.

 

If I write like this:

 


class CfgFunctions 

{

#include "COB\functions\cfgFunctions.hpp"

#include "COB_HALO\functions\cfgFunctions.hpp"

};

 


it will load but HALO will not work.(team get teleported)

 

NOTE: both COB folder contain a cfgFunctions.hpp files.

 

Hope my English is clear enough. 

Share this post


Link to post
Share on other sites

The error indicates you are probably trying to define

class cfgFunctions { ... };

twice in your description.ext. Based on the error report, the second definition is probably in the "COB_HALO\functions\cfgFunctions.hpp" file.

If you open the "COB_HALO\functions\cfgFunctions.hpp" file and remove these lines:

class cfgFunctions {

and the trailing

};

.

Then use the second cfgFunctions definition you posted and let us know how it works...

Share this post


Link to post
Share on other sites

Both cfgfFunctions files probably use the same class inside them.

 

Eg.

class COB 

    {
        tag = "COB";
        class functions 
         {
             file = "bla\bla";
             class  blabla.bla {};
         };
};
 
that might be a prob too
  • Like 1

Share this post


Link to post
Share on other sites

Thank you

 

The error indicates you are probably trying to define

class cfgFunctions { ... };

twice in your description.ext. Based on the error report, the second definition is probably in the "COB_HALO\functions\cfgFunctions.hpp" file.

If you open the "COB_HALO\functions\cfgFunctions.hpp" file and remove these lines:

class cfgFunctions {

and the trailing

};

.

Then use the second cfgFunctions definition you posted and let us know how it works...

Thank you Tyger!

Still, no luck! not working! Error on loading...

 let me post both cfgFunctions:

----------------------------------------------------------------------------------------------------------------------------------------------------

COB (extraction):

class COB 
{
        tag = "COB";
        class functions 
               {
                    file = "COB\functions";
                    class extraction {description = "Creates the extraction helicopter"};
                    class addWaypoint {description = "Creates the waypoints"};
               };
};
class RUBE 
{
            tag = "RUBE";
            class functions 
             {
                    file = "COB\functions";
                    class randomCirclePositions {description = "Generate random positions around a center position within the given limitations"};
              };
};
------------------------------------------------------------------------------------------------------------------------------------------------------
 
 
COB_HALO:
 
class CfgFunctions 
{
             class COB 
             {
                    class functions 
                    {
                           class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
                           class saveLoadOut {file = "COB_HALO\functions\fn_saveLoadOut.sqf"};
                    };
               };
};
//// in red the ones that I removed!
--------------------------------------------------------------------------------------------------------------------------------------------------
 
Off course, now is telling me that "class COB" already exist...
 
Did I misunderstood something?

Share this post


Link to post
Share on other sites

 

Both cfgfFunctions files probably use the same class inside them.

 

Eg.

class COB 

    {
        tag = "COB";
        class functions 
         {
             file = "bla\bla";
             class  blabla.bla {};
         };
};
 
that might be a prob too

 

Yap...what should I do?

Rename cfgFunctions? 

Edited by zagor64bz

Share this post


Link to post
Share on other sites

Rename the class COB bit

 

or replace the #include for :-

 

 class COB2 
             {
                    class functions 
                    {
                           class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
                           class saveLoadOut {file = "COB_HALO\functions\fn_saveLoadOut.sqf"};
                    };
               };

Share this post


Link to post
Share on other sites

Ok..this is what I did so far:

 

renamed the COB bit like you suggested:

 

class CfgFunctions 
{
class COB2 
{
class functions 
{
class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
class saveLoadOut {file = "COB_HALO\functions\fn_saveLoadOut.sqf"};
};
};
};
 
THEN...my description.ext:
 
class CfgFunctions 
{
#include "COB\functions\cfgFunctions.hpp"
#include "COB_HALO\functions\cfgFunctions.hpp"
};
 
 
class CfgSounds {
 sounds[] = {}; 
class C130_exit {
sound[] = {"COB_HALO\sounds\C130_exit.wss", 100, 1};
titles[] = {};
};
class close_chute {
sound[] = {"COB_HALO\sounds\close_chute.ogg", 10, 1};
titles[] = {};
};
class flapping {
sound[] = {"COB_HALO\sounds\flapping.ogg", 10, 1};
titles[] = {};
};
class open_chute {
sound[] = {"COB_HALO\sounds\open_chute.ogg", 10, 1};
titles[] = {};
};
};
 
Load fine, EXTRACTION is working, but HALO NOT!!! still teleporting.
 
 
Thank you all!
 
 

 

Share this post


Link to post
Share on other sites

Try description.ext 

 

class CfgFunctions 
{
#include "COB\functions\cfgFunctions.hpp"
class COB2 
{
class functions 
{
class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
class saveLoadOut {file = "COB_HALO\functions\fn_saveLoadOut.sqf"};
};
};
};
  • Like 1

Share this post


Link to post
Share on other sites

 

Try description.ext 

 

class CfgFunctions 
{
#include "COB\functions\cfgFunctions.hpp"
class COB2 
{
class functions 
{
class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
class saveLoadOut {file = "COB_HALO\functions\fn_saveLoadOut.sqf"};
};
};
};

 

Sorry, not working. Still teleporting...

Share this post


Link to post
Share on other sites

Sounds like there may be an issue with fn_halo.sqf. Can you post the function and how you're calling it?

Share this post


Link to post
Share on other sites

Sounds like there may be an issue with fn_halo.sqf. Can you post the function and how you're calling it?

Sure!

 

/*
File: fn_halo.sqf
Version: 1.5
 
Author(s): cobra4v320 - effects adapted from old halo.sqs, sounds from freesound.org
 
Description: HALO jumping (works with AI soldiers). Set the altitude of the HALO, add a chemlight,
save your backpack loadout, auto open your parachute at 150m, and add a backpack to the front
of your unit.
 
Parameters:
0: UNIT - (object) the unit that will be doing the HALO
1: (optional) ALTITUDE  - (number) the altitude where the HALO will start from
2: (optional) CHEMLIGHT - (boolean) true if the units will use chemlights
3: (optional) SAVELOADOUT - (boolean) true to save the units backpack and gear
4: (optional) AUTOOPEN -(boolean) true to auto open parachute at 150m
5: (optional) ADDPACK - (boolean) true to add a backpack to the front of the unit
 
Example(s):
[this] call COB_fnc_HALO
[this, 2000, true, true, false, true] call COB_fnc_HALO
*/
if (!isServer || isDedicated) exitWith {};
 
//Parameters
private ["_unit","_altitude","_chemLight","_saveLoadOut","_autoOpen","_addPack"]; 
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_altitude = [_this, 1, 3000, [3000]] call BIS_fnc_param;
_chemLight = [_this, 2, false, [false]] call BIS_fnc_param;
_saveLoadOut = [_this, 3, true, [true]] call BIS_fnc_param;
_autoOpen = [_this, 4, false, [false]] call BIS_fnc_param;
_addPack = [_this, 5, true, [true]] call BIS_fnc_param;
 
//Validate parameters
if (isNull _unit) exitWith {"Unit parameter must not be objNull. Accepted: OBJECT" call BIS_fnc_error};
if (_altitude < 500) exitWith {"Altitude is too low for HALO. Accepted: 500 and greater." call BIS_fnc_error};
 
//create a log entry
["HALO function has started"] call BIS_fnc_log;
 
if (isPlayer _unit) then {
cutText ["", "BLACK FADED",999];
[_unit] spawn {
 
private "_unit";
_unit  = _this select 0;
 
sleep 2;
 
"dynamicBlur" ppEffectEnable true;   
"dynamicBlur" ppEffectAdjust [6];   
"dynamicBlur" ppEffectCommit 0;     
"dynamicBlur" ppEffectAdjust [0.0];  
"dynamicBlur" ppEffectCommit 5;  
 
cutText ["", "BLACK IN", 5];
 
playSound "C130_exit"; //play c130 sound (too be deleted)
 
while {animationState _unit != "para_pilot" && alive _unit} do {
playSound "flapping"; //play flapping sound
sleep 7.7;
};
};
};
 
if (_saveLoadOut && !isNull (unitBackpack _unit)) then {
[_unit,_addpack] call COB_fnc_saveLoadOut; //save gear and addpack to front of unit
} else {
_unit addBackpack "B_parachute"; //add the parachute if unit has no backpack
};
 
if (_chemLight) then {
[_chemLight,_unit] spawn {
private ["_chemlight","_unit","_light"];
_chemLight = _this select 0;
_unit   = _this select 1;
 
_light = "chemlight_red" createVehicle [0,0,0]; //create the chemlight
_light attachTo [_unit,[-0.07,0.1,0.25],"head"]; //attach light to helmet
_light setVectorDirAndUp [[0,1,-1],[0,1,0.6]]; //set vector dir and up
 
waitUntil {animationState _unit == "para_pilot"};
_light attachTo [vehicle _unit,[0,0.14,0.84],"head"]; 
_light setVectorDirAndUp [[0,1,-1],[0,1,0.6]];
 
waitUntil {isTouchingGround _unit || getPos _unit select 2 < 1};
deleteVehicle _light; //delete the chemlight
};
};
 
_unit setPos [getPos _unit select 0, getPos _unit select 1, _altitude]; //Set the altitude of the HALO jump
 
if (!isPlayer _unit) then {
_unit allowDamage FALSE; //god mode :)
_unit switchMove "HaloFreeFall_non"; //place the AI into the free fall animation
_unit disableAI "ANIM"; //disable the AI animation so they cant switch back to standing
};
 
if (isPlayer _unit) then {
[_unit,_autoOpen] spawn {
private ["_unit","_autoOpen"];
_unit  = _this select 0;
_autoOpen = _this select 1;
 
if (_autoOpen) then {
waitUntil {getPos _unit select 2 < 150 || animationState _unit == "para_pilot" && alive _unit};
_unit action ["OpenParachute", _unit]; //open parachute if 150m above ground
};
 
waitUntil {animationState _unit == "para_pilot"};
// Parachute opening effect for more immersion
playSound "open_chute"; //play chute opening sound
setAperture 0.05; 
setAperture -1;
"DynamicBlur" ppEffectEnable true;  
"DynamicBlur" ppEffectAdjust [8.0];  
"DynamicBlur" ppEffectCommit 0.01;
sleep 1;
"DynamicBlur" ppEffectAdjust [0.0]; 
"DynamicBlur" ppEffectCommit 3;
sleep 3;
"DynamicBlur" ppEffectEnable false;
"RadialBlur" ppEffectAdjust [0.0, 0.0, 0.0, 0.0]; 
"RadialBlur" ppEffectCommit 1.0; 
"RadialBlur" ppEffectEnable false;
};
};
 
[_unit] spawn {
private "_unit";
_unit = _this select 0;
 
waitUntil {isTouchingGround _unit || getPos _unit select 2 < 1 && alive _unit}; //wait for unit to touch ground
 
if (!isPlayer _unit) then {
_unit enableAI "ANIM";  //enable the animations
_unit setPos [getPos _unit select 0, getPos _unit select 1, 0]; //this removes the unit from the parachute
_unit setVelocity [0,0,0]; //set speed to zero
_unit setVectorUp [0,0,1]; //set the unit upright
sleep 1;
_unit allowDamage TRUE; //allow unit to be damaged again
} else {
// Parachute closing effect for more immersion
playSound "close_chute";//play chute closing sound
cutText ["", "BLACK FADED", 999];
sleep 2;
cutText ["", "BLACK IN", 2];
 
_unit setDamage 0; //heal the unit to 100% in case of injury
};
};
 
//create a log
["HALO function has completed"] call BIS_fnc_log;
 
//Return Value
_unit
 
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 
Calling with:
 
this addAction ["<t color="#001eff"">" + "HALO JUMP", "scripts\flagHALO.sqf]; on a flagpole)
 
But maybe you should take a look at the mission I posted. There's every script I'm using.

Share this post


Link to post
Share on other sites

He needs to rebuild the functions  structure because there are more the same  classes with different file path, inside each frameworks.
 
Extraction:

class COB 
{
	tag = "COB";
	class functions 
		{
			file = "COB\functions";
			class extraction {description = "Creates the extraction helicopter"};
			class addWaypoint {description = "Creates the waypoints"};
		};
};
class RUBE 
{
	tag = "RUBE";
	class functions 
		{
			file = "COB\functions";
			class randomCirclePositions {description = "Generate random positions around a center position within the given limitations"};
		};
};

HALO:

	class COB 
	{
		class functions 
		{
			class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
			class paradrop {file = "COB_HALO\functions\fn_paradrop.sqf"};
		};
	};

He could split together functions by using different class name or the same path instead.

  • Like 1

Share this post


Link to post
Share on other sites

He needs to rebuild the functions  structure because there are more the same  classes with different file path, inside each frameworks.

 

Extraction:

class COB 
{
	tag = "COB";
	class functions 
		{
			file = "COB\functions";
			class extraction {description = "Creates the extraction helicopter"};
			class addWaypoint {description = "Creates the waypoints"};
		};
};
class RUBE 
{
	tag = "RUBE";
	class functions 
		{
			file = "COB\functions";
			class randomCirclePositions {description = "Generate random positions around a center position within the given limitations"};
		};
};

HALO:

	class COB 
	{
		class functions 
		{
			class HALO {file = "COB_HALO\functions\fn_halo.sqf"};
			class paradrop {file = "COB_HALO\functions\fn_paradrop.sqf"};
		};
	};

He could split together cfgfunctions by using different class name or the same path instead. Each way needed  to edit the related script too.

Thank you DAVIDOSS.

Sound more challenging than I can manage after all. Maybe it will be easier to look for a different HALO or EXTRACTION script. Suggestion? 

Share this post


Link to post
Share on other sites

This is much more easy that looks like

 

To do:

I assume you have no more others functions and sounds classes. If so edit and mix.

 

 in description.ext

class CfgFunctions {
	
	class COB {
	
		tag = "COB";
			class functions {
			
				file = "COB\functions";
				class extraction {description = "Creates the extraction helicopter"};
				class addWaypoint {description = "Creates the waypoints"};
				class HALO {file = "COB\functions\fn_halo.sqf"};
				class paradrop {file = "COB\functions\fn_paradrop.sqf"};
			};
	};
	
	class RUBE {
	
		tag = "RUBE";
			class functions {
			
				file = "COB\functions";
				class randomCirclePositions {description = "Generate random positions around a center position within the given limitations"};
			};
	};
};

class CfgSounds 
{
	sounds[] = {}; 
	class C130_exit 
	{
		sound[] = {"COB\sounds\C130_exit.wss", 50, 1};
		titles[] = {};
	};
	class flapping 
	{
		sound[] = {"COB\sounds\flapping.ogg", 10, 1};
		titles[] = {};
	};
	class open_chute 
	{
		sound[] = {"COB\sounds\open_chute.ogg", 10, 1};
		titles[] = {};
	};
	class para_pilot 
	{
		sound[] = {"COB\sounds\para_pilot.ogg", 10, 1};
		titles[] = {};
	};
	class close_chute 
	{
		sound[] = {"COB\sounds\close_chute.ogg", 10, 1};
		titles[] = {};
	};
};

Then move all stuff  from COB_HALO in COB directory.

Delete empty COB_HALO directory.

Delete COB/FUNCTIONS/cfgFunctions.hpp file.

 

Thats all.

Enjoy.

  • Like 1

Share this post


Link to post
Share on other sites

This is much more easy that looks like

 

To do:

I assume you have no more others functions and sounds classes. If so edit and mix.

 

 in description.ext

class CfgFunctions {
	
	class COB {
	
		tag = "COB";
			class functions {
			
				file = "COB\functions";
				class extraction {description = "Creates the extraction helicopter"};
				class addWaypoint {description = "Creates the waypoints"};
				class HALO {file = "COB\functions\fn_halo.sqf"};
				class paradrop {file = "COB\functions\fn_paradrop.sqf"};
			};
	};
	
	class RUBE {
	
		tag = "RUBE";
			class functions {
			
				file = "COB\functions";
				class randomCirclePositions {description = "Generate random positions around a center position within the given limitations"};
			};
	};
};

class CfgSounds 
{
	sounds[] = {}; 
	class C130_exit 
	{
		sound[] = {"COB\sounds\C130_exit.wss", 50, 1};
		titles[] = {};
	};
	class flapping 
	{
		sound[] = {"COB\sounds\flapping.ogg", 10, 1};
		titles[] = {};
	};
	class open_chute 
	{
		sound[] = {"COB\sounds\open_chute.ogg", 10, 1};
		titles[] = {};
	};
	class para_pilot 
	{
		sound[] = {"COB\sounds\para_pilot.ogg", 10, 1};
		titles[] = {};
	};
	class close_chute 
	{
		sound[] = {"COB\sounds\close_chute.ogg", 10, 1};
		titles[] = {};
	};
};

Then move all stuff  from COB_HALO in COB directory.

Delete empty COB_HALO directory.

Delete COB/FUNCTIONS/cfgFunctions.hpp file.

 

Thats all.

Enjoy.

LADIES AND GENTLEMAN.....WE HAVE A WINNER!!!!!

 

Work like a charm!!!!

Thank,THANK you Davidoss!!!

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

×