Jump to content
Sign in to follow this  
igneous01

Check isclass inside description.ext

Recommended Posts

Ive been trying to get this to work but i keep getting the same error:

line 53: '/Weapons.if': '(' encountered instead of '='

this is what i was using to check if a weapon addon exists, and then add it to gear selection during briefing if it does. Its near the end of my class weapons list.

if (isClass(configFile >> "CfgWeapons" >> "UKF_L115A3_wdl")) then {
 class UKF_L115A3_wdl {count = 1;};
};

Is this possible to do? I really want to make my mission more addon compatible if a user is using custom weapons

Share this post


Link to post
Share on other sites

Change isClass to count. Something like this:

if (count(configFile >> "CfgWeapons" >> "UKF_L115A3_wdl") > 0) then

Let me know if that doesn't do it for you.

Here is a function I wrote 3 months ago that will fill an ammo crate with a list of guns if the addons are currently loaded for each. It also adds some ammunition automatically.

private ["_box","_arrayGuns","_cfg"];

_box		= _this select 0;
_arrayGuns	= _this select 1;

{
private["_gun","_quantity","_cfg","_mags"];
_gun 		= _x select 0;
_quantity	= _x select 1;
_cfg			= configFile >> "CfgWeapons" >> _gun;
// verify weapon exists (if count > 0) then add weapon and magazines to _box
if (count _cfg > 0) then
{
	_box addWeaponCargo [_gun,_quantity];
	_mags = getArray (_cfg >> "magazines");
	{
		_box addMagazineCargo [_x, (8 * _quantity)];
	} forEach _mags;
};
} forEach _arrayGuns;

You could call it like this:

_arrayGuns = [["RH_acreotech",3],["RH_hk417sgl",1],["RH_masacog",2]];
[ammoBox, _arrayGuns] call AZC_fnc_loadWeapons;

The separate array is not necessary, just easier to understand. The number after each weapon name is quantity desired. 'ammoBox' is the name of an ammoBox.

Also, make sure to change the call AZC_fnc_loadWeapons to whatever you call the script, if you use it. It could be execVM 'scriptname.sqf'.

Edited by AZCoder
Additional Info

Share this post


Link to post
Share on other sites

just tried it and same error message. Can you not do control structures or logic statements inside the description.ext?

maybe theres another way to import them into the gear selection screen in the briefing.

Thanks for the ammo crate script, but its not quite what im looking for, I want the player to choose his loadout at the briefing screen so it looks more nicer.

Share this post


Link to post
Share on other sites
Can you not do control structures or logic statements inside the description.ext?

The script he gave you is meant for an sqf file.

And as far as I know, description only takes class definitions and preprocessor commands.

Share this post


Link to post
Share on other sites

yea i tried it, got an error saying some input after EOF, so im guessing you cannot do evaluation inside the class itself, however you can do it outside the class, but then you cant import it into the class list.

i guess ill just do a workaround using an empty ammocrate and import any addon weapons in there if they exist.

thanks for the help guys

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
Sign in to follow this  

×