Jump to content
Sign in to follow this  
Kierrin

having trouble with arrays and a3wasteland

Recommended Posts

I am trying to modify part of a3wasteland altis, currently no matter what type of territory you capture you get whatever the default payout is,  I am trying to make the payout system take into account the categories listed in the territories.sqf file. My intent is to take information from a couple different arrays and put them into one then from the one use an if then and count to separate it all into different variables to apply the payout bonuses and then calculate the new payouts, currently what I have is:

	ownerType = [];

{
	_territoryName = _x select 0;
		
	if ((_x select 0) isEqualTo _territoryName) exitWith

	{
	ownerType pushback [_territoryName, config_territory_markers select 3, 1];
        };

//diag_log debug delete before release!
diag_log ownerType;

} forEach currentTerritoryDetails;

and the error I keep getting is:

22:14:26 Error in expression <territoryName, config_territory_markers select 3, 1];
};

diag_log ownerType;
} >
22:14:26   Error position: <select 3, 1];
};

diag_log ownerType;
} >
22:14:26   Error select: Type code, expected Array,String,Config entry
22:14:26 File \mpmissions\A3Wasteland_v1.3b.Altis\territory\server\territoryPayroll.sqf, line 64

any help would be greatly appreciated as id like to learn more about scripting

 

also Id post this on the a3wasteland altis forums but their site seems to be down/moved, goes to a domain page if anyone has a working link to them id appreciate that aswell.

Share this post


Link to post
Share on other sites
Guest

It seems your array is defined as code so like this myarr = {1,2,3}. Instead it should be defined like this myarr = [1,2,3]

 

EDIT : By myarr I mean config_territory_markers. As Tajin said you may provide us the snippet where it is defined.

Share this post


Link to post
Share on other sites

config_territory_markers

 

that one is to blame, but we don't see how it is defined in your snippet.

Share this post


Link to post
Share on other sites

thanks for the fast replies I never would have guessed that was the issue.

 

 

so unless im way off base on how this works it becomes a global variable in config.sqf down at the bottom.

// Towns and cities array
cityList = compileFinal preprocessFileLineNumbers "mapConfig\towns.sqf";

config_items_jerrycans_max = compileFinal "1";
config_items_syphon_hose_max = compileFinal "1";

config_refuel_amount_default = compileFinal "0.25";
config_refuel_amounts = compileFinal str
[
	["Kart_01_Base_F", 1],
	["Quadbike_01_base_F", 0.5],
	["Tank", 0.1],
	["Air", 0.1]
];

// NOTE: Player saving and money settings moved to external config (A3Wasteland_settings\main_config.sqf), default values are set in server\default_config.sqf

// Is player saving enabled?
// config_player_saving_enabled = compileFinal "0";

// How much do players spawn with?
// config_initial_spawn_money = compileFinal "100";

config_territory_markers = compileFinal preprocessFileLineNumbers "mapConfig\territories.sqf";

inside territories.sqf looks like this

[
	["TERRITORY_THRONOS_CASTLE", "Thronos Castle", 500, "CASTLE"],
	["TERRITORY_KASTRO_CASTLE", "Kastro Castle", 500, "CASTLE"],
	["TERRITORY_UNNAMED_CASTLE", "112-087 Castle", 500, "CASTLE"],
	["TERRITORY_PYRGOS_CASTLE", "Pyrgos Castle", 500, "CASTLE"]
]

for the sake of space ive condensed it to just the castle category

Share this post


Link to post
Share on other sites

sorry harmdhast I didnt see your reply before my last post, I assumed it loaded as a string because of the [ ] and the general format of the file. is there a way to make this load as a string? or another way to point at the last category in the file?

Share this post


Link to post
Share on other sites
Guest

Just being dumb as fk as usual.

Your method is ok you just need to call your variable with call because of it being compileFinaled

hint str call config_territory_markers 

;)

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  

×