Jump to content
Sign in to follow this  
kamaradski

Select all gear classnames per playerside

Recommended Posts

Hi All,

I have read many posts and topics about this without reaching a solid solution.

For my PvP mission i want to restrict loadout to all weapons available to the player side. Meaning in the ammoboxes\VAS\VA\loadout selector i need to make available only the items from the same side as the player.

All available hacks involve making a huge complicated item lists and a major effort to keeping them updated amongst arma3 versions. Surely there must be a easier way ?

KR

Kamaradski

Share this post


Link to post
Share on other sites
All available hacks involve making a huge complicated item lists and a major effort to keeping them updated amongst arma3 versions. Surely there must be a easier way ?

I think that this is only solution because CfgWeapons doesn't contain variables on which to determine sides of weapons. So you need create arrays of weapons for each side and choose them depending on side of player.

Share this post


Link to post
Share on other sites

Weapons by themselves do not have a side attribute in their config.

The only thing that I could imagine here would be to loop through the config entrys of all soldiers on a side and generate a list based on their default equipment.

Could be a bit slow though.

Share this post


Link to post
Share on other sites
Hi All,

I have read many posts and topics about this without reaching a solid solution.

For my PvP mission i want to restrict loadout to all weapons available to the player side. Meaning in the ammoboxes\VAS\VA\loadout selector i need to make available only the items from the same side as the player.

All available hacks involve making a huge complicated item lists and a major effort to keeping them updated amongst arma3 versions. Surely there must be a easier way ?

KR

Kamaradski

That's because a huge complicated list is probably the best way of doing it.

Share this post


Link to post
Share on other sites

You could iterate through cfgVehicles, filter out men and side, and put their primary weapon into an array.

private ["_weaponArray","_cfgArray"];  

_weaponArray = [];
_cfgArray = "( 
(getNumber (_x >> 'scope') >= 2) && 
{getNumber (_x >> 'side') == 1 && 
{getText (_x >> 'vehicleClass') == 'Men' &&
{count (getArray (_x >> 'weapons')) > 2 &&
{_weaponArray pushBack (getArray (_x >> 'weapons') select 0);
			   true}
			}
		}   
	} 
)" configClasses (configFile >> "CfgVehicles"); 

diag_log  format ["%1", _weaponArray];

Hope that helps.

Edited by Iceman77

Share this post


Link to post
Share on other sites

Iceman77 thanks for taking the time to reply with a concrete solution !

Just looking at your code (in the office right now) i can see that this might actually produce the required results, and i will experiment with this a little bit once i get home.

Though you posted the only working solution so far, it still is only a workaround in my opinion, and a lot of unneeded processing for a simple task.

To configure the Virtual Arsenal box with this system will take several iterations of this loop, and possible a huge impact on performance when used on a busy server.

Linking to the Talk-page i opened on the Virtual Arsenal wiki, i wonder if a simple change in the BIS functions, or the cfgVehicles system would be more effective: https://community.bistudio.com/wiki/Talk:Arsenal

Anyone coming across this thread please discuss options and thoughts on the topic, so we can maybe come to a real solution in the future...

Share this post


Link to post
Share on other sites

You may need to tinker to include handguns and secondary weapons. Anyhow, it's a solid start. I posted a request ticket ages ago to give weapons a "default side". I think just about anything in the game should have a side to reference seeing how it makes things much easier than layers of filtering.

Share this post


Link to post
Share on other sites

Yeh, thats exactly what I meant :)

To configure the Virtual Arsenal box with this system will take several iterations of this loop, and possible a huge impact on performance when used on a busy server.

You don't necessarily have to do that. (unless you want it to be flexible with mods)

You could always pre-generate the list with a script and then simply paste the generated list directly into your code.

Share this post


Link to post
Share on other sites

You could always pre-generate the list with a script and then simply paste the generated list directly into your code.

Yes possible, but it should not be needed/required, any arma update to the classnames or weapons will break the list and would need manual correction again. I think this here is a problem that would require a solution from BIS side.

@iceman: is that ticket still open, so we can give it some upvotes ?

Also i didnt yet managed to find the time to play with your posted solution, but hope to be able to do so tonight :)

Share this post


Link to post
Share on other sites

Again done.

On a second thought:

Could we not loop through "CfgVehicles == WEST" and list all items/gear attached to the classes ?

Share this post


Link to post
Share on other sites

Yeah we could. We could even cycle through the crates =). They do have a side, but they're all side 3 (civ). LOL

Edited by Iceman77

Share this post


Link to post
Share on other sites

After experimenting with the scripted solutions for this, I am deffo not impressed. It is relatively slow and resource heavy. So in the end i am again building some complicated list :(

On the (small) bright side however i decided to create a notepad++ highlighter for classnames only. This will help other people to quickly check their list against the known validated side-affinity. It's only a work around but might be useful for other people with the same problem.

It will be distributed as part of my current highlighter, and i would ask people to get involved and help me keep it up to date, by logging tickets in the feedback tracker of any missing or wrongly assigned classnames.

(code is not yet online, until i have created a good base for initial distribution, so probably by the end of the week, something should be there)

https://bitbucket.org/kamaradski/sqf-syntax-highlighter-npp

Share this post


Link to post
Share on other sites

Oh dude sweet. I love people who take the time to make good syntax highlighter for sqf. I'm using KK's atm. It's easy on the eyes but I'll give yours a go.

Share this post


Link to post
Share on other sites

Like I said before: Make it so the script runs only once, generates the list, copies it to your clipboard and you can then safe it in some sort of config file.

That should be be easy enough and eliminates the need to generate the list every time or to modify it by hand.

If you're using some sort of database addon, you could make it even easier to handle.

ps.: If you haven't done so already: give poseidon a try. I'm a big fan of NPP, but poseidon is simply alot better for anything arma-related.

Share this post


Link to post
Share on other sites

I tried poseidon aaagggges ago and it nearly blinded me hehe. I wouldn't minjd giving it another try though. Is there a more "mild" highlighter available for it? Cheers.

Share this post


Link to post
Share on other sites

You could use the white color scheme. Maybe that one suits you more.

Share this post


Link to post
Share on other sites

I tried white too I believe. It was the actual print was overwhelming for me. Atleast at the time. Gonna give it another go though.

Share this post


Link to post
Share on other sites

not sure if the problem is already solved. A potential simple solution would be to place units with according equipment on the map and have a script go through their gear and create the list at mission start (and delete the units if required).

Disadvantage: you need to place units with according gear (would be an issue with mods that do not provide units)

Advantage: fail save solution for side specific equipment, you get even more control of gear for side

commands that can be useful for this: allUnits or playableUnits and side

Edited by quiet_man

Share this post


Link to post
Share on other sites

Why not just iterate through men types in the cfg and store their weapons? Or do the same thing except with crates contents. My 2C

Share this post


Link to post
Share on other sites

Yup, iterating over the config-classes does the same thing, without having to spawn them.

Crate contents sound like a good idea, it's surely faster than parsing all the units.

It might not be as flexible in terms of mod-support though.

Share this post


Link to post
Share on other sites
Why not just iterate through men types in the cfg and store their weapons? Or do the same thing except with crates contents. My 2C

Oh I agree. I don't see "my" solution as better, specifically if you want all gear of a side. I just wanted to give an alternative and sometimes he might not want ALL gear and placing a unit on the map might still be simpler than writing a "filter"?

I remember a few mission used this way in the past to allow people to simply tailor the mission by swapping units in the editor.

Edited by quiet_man
make it simpler to read

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  

×