Jump to content
Sign in to follow this  
SIlenceFiction

Restricting Virtaul Arsenal Items to Soldier Type

Recommended Posts

So basically, Im working on editing a certain mission and I got to the point that I need to restrict items to each soldier class/type (Missile Specialist, Automatic Rifleman, Engineer, Combat Life Saver, Designated Marksman, Sniper, etc) and I have no idea how.

My goal is to achieve that only a missile specialist will be able to see AT launchers, or only the Sniper will be able to acquire Sniper Rifles, etc...

I would very much appreaciate your help with that, my skype is in my profile so you can contact me there if you feel like it :rolleyes:

Thanks for everyone in advance :D

Share this post


Link to post
Share on other sites

Well you can black/whitelist the arsenal

https://community.bistudio.com/wiki/Arsenal

After that you just have to put it so that it recognizes the class names of the soldiers and loads the specifick gear

maybe like this:

if (player == "B_Soldier_AT_F") then {bis functions with the array of gear here}

something like this i think. might be more briliant scripters here that would find a better way

  • Like 1

Share this post


Link to post
Share on other sites
Well you can black/whitelist the arsenal

https://community.bistudio.com/wiki/Arsenal

After that you just have to put it so that it recognizes the class names of the soldiers and loads the specifick gear

maybe like this:

if (player == "B_Soldier_AT_F") then {bis functions with the array of gear here}

something like this i think. might be more briliant scripters here that would find a better way

And I put that in the INIT line of the Virtual Arsenal box, right?

Share this post


Link to post
Share on other sites
And I put that in the INIT line of the Virtual Arsenal box, right?

No, you need to run it on each client. So you could run it from your init.sqf:

if (!isDedicated) then {
//run your code here
};

Share this post


Link to post
Share on other sites
No, you need to run it on each client. So you could run it from your init.sqf:

if (!isDedicated) then {
//run your code here
};

OK, thank you two very much, I will try that and I will post an update afterwards.

Meanwhile I would be glad to hear more ideas. :)

Share this post


Link to post
Share on other sites
Well you can black/whitelist the arsenal

https://community.bistudio.com/wiki/Arsenal

After that you just have to put it so that it recognizes the class names of the soldiers and loads the specifick gear

maybe like this:

if (player == "B_Soldier_AT_F") then {bis functions with the array of gear here}

something like this i think. might be more briliant scripters here that would find a better way

No, you need to run it on each client. So you could run it from your init.sqf:

if (!isDedicated) then {
//run your code here
};

OK, I tried to do that, and resulted with no success. It only shows the items that I have on me.

This it the line from the init.sqf file:

if (player == "B_Soldier_SL_F") then {[ vabox, [ "U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector" ], true] call BIS_fnc_addVirtualItemCargo;};

And this is the code I use to spawn the Virtual Arsenal:

this addAction ["Virtual Arsenal",{["Open",false] spawn BIS_fnc_arsenal}];

What have I done wrong?

Share this post


Link to post
Share on other sites

you don't need the addaction. the 4th parameter of the addVirtualItem cargo is the addaction and is by defaukt true. if you pt an addaction with open,true than you wil whipe the VA clean again after you filled it up basicly

Share this post


Link to post
Share on other sites
you don't need the addaction. the 4th parameter of the addVirtualItem cargo is the addaction and is by defaukt true. if you pt an addaction with open,true than you wil whipe the VA clean again after you filled it up basicly

If I'll set it to "Open",true then every single item/weapon/etc will be in the VA, which I don't want.

Share this post


Link to post
Share on other sites
you don't need the addaction. the 4th parameter of the addVirtualItem cargo is the addaction and is by defaukt true. if you pt an addaction with open,true than you wil whipe the VA clean again after you filled it up basicly

I tried so many things so far, and none of them worked, I have absolutely no idea how to go on from here.

Share this post


Link to post
Share on other sites

Okay you will have to do it like this out of my head:

If (!isDedicated) then
{
   if (player == "B_Soldier_SL_F") then 
       {[vabox,["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector"]] call BIS_fnc_addVirtualItemCargo};
};

put an ammobox called vabox and that should be it. there is no need to put a call bis_fnc_arsenal as the 4th parameter of the addVirtualItemCargo enables a addaction to the box by default. when putting in open,false you will clear the box again after it loaded the whitelisted stuf.

Share this post


Link to post
Share on other sites
Okay you will have to do it like this out of my head:

If (!isDedicated) then
{
   if (player == "B_Soldier_SL_F") then 
       {[vabox,["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector"]] call BIS_fnc_addVirtualItemCargo};
};

put an ammobox called vabox and that should be it. there is no need to put a call bis_fnc_arsenal as the 4th parameter of the addVirtualItemCargo enables a addaction to the box by default. when putting in open,false you will clear the box again after it loaded the whitelisted stuf.

When you explain it with examples its the best! Thanks, I'll try that and I will let you know. :)

Share this post


Link to post
Share on other sites
Okay you will have to do it like this out of my head:

If (!isDedicated) then
{
   if (player == "B_Soldier_SL_F") then 
       {[vabox,["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector"]] call BIS_fnc_addVirtualItemCargo};
};

put an ammobox called vabox and that should be it. there is no need to put a call bis_fnc_arsenal as the 4th parameter of the addVirtualItemCargo enables a addaction to the box by default. when putting in open,false you will clear the box again after it loaded the whitelisted stuf.

I tried it out, and sadly it didn't work, I even copy-pasted your code to see if it works but it doesn't.

Link for my init.sqf: http://pastebin.com/0jNJFTfE

Share this post


Link to post
Share on other sites
I tried it out, and sadly it didn't work, I even copy-pasted your code to see if it works but it doesn't.

Link for my init.sqf: http://pastebin.com/0jNJFTfE

Okay you will have to do it like this out of my head:

If (!isDedicated) then
{
   if (player == "B_Soldier_SL_F") then 
       {[vabox,["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector"]] call BIS_fnc_addVirtualItemCargo};
};

put an ammobox called vabox and that should be it. there is no need to put a call bis_fnc_arsenal as the 4th parameter of the addVirtualItemCargo enables a addaction to the box by default. when putting in open,false you will clear the box again after it loaded the whitelisted stuf.

Do you have any idea why this happens?

Share this post


Link to post
Share on other sites

Working on it when i have a fix for you I'll post it ;)

Share this post


Link to post
Share on other sites

Change the line:

if (player == "B_Soldier_SL_F") then

to

if (typeof player == "B_Soldier_SL_F") then

Share this post


Link to post
Share on other sites
Change the line:

if (player == "B_Soldier_SL_F") then

to

if (typeof player == "B_Soldier_SL_F") then

IT WORKS! I really appreciate all the time you have invested to make it work for me! Thank you so much! :D

Share this post


Link to post
Share on other sites
Working on it when i have a fix for you I'll post it ;)
Change the line:

if (player == "B_Soldier_SL_F") then

to

if (typeof player == "B_Soldier_SL_F") then

So, I encountered another problem, if someone enters my server after the mission started, its like hes ignoring all of the commands in the file.

I went to the init.sqf file and put this line:

[] execVM "Soldier_Gear_Restriction.sqf";

Maybe that's the problem...

So if someone enters the server in the timeout before the mission has began, all of the gear restriction will work, but if they enter the server after the mission has began, nothing is working for them in that file.

paste bin of Soldier_Gear_Restriction.sqf:

http://pastebin.com/94u0chpT

Can you guys spot the problem?

Share this post


Link to post
Share on other sites

this sounds as a jip problem. unfortunatly i suck at jip meself........

Share this post


Link to post
Share on other sites
this sounds as a jip problem. unfortunatly i suck at jip meself........

Sorry to be the noob here, but what is jip?

Share this post


Link to post
Share on other sites

Join in progress... players don't need to be in the lobby at mission start. Can come and go.

Share this post


Link to post
Share on other sites
Join in progress... players don't need to be in the lobby at mission start. Can come and go.

I see, thanks for the explanation.

Share this post


Link to post
Share on other sites

you could just tell them to use only role appropriate weaponry,, and if it's on a public server with large numbers of unknown players runing around, just add role specific ammoboxes that can only be accesed by those roles.

Share this post


Link to post
Share on other sites
So, I encountered another problem, if someone enters my server after the mission started, its like hes ignoring all of the commands in the file.

I went to the init.sqf file and put this line:

[] execVM "Soldier_Gear_Restriction.sqf";

Maybe that's the problem...

So if someone enters the server in the timeout before the mission has began, all of the gear restriction will work, but if they enter the server after the mission has began, nothing is working for them in that file.

paste bin of Soldier_Gear_Restriction.sqf:

http://pastebin.com/94u0chpT

Can you guys spot the problem?

you could just tell them to use only role appropriate weaponry,, and if it's on a public server with large numbers of unknown players runing around, just add role specific ammoboxes that can only be accesed by those roles.

If you will have a look at the pastebin you will see that I have done that already, its just problem with the file being applied on players joining after the mission started, cause I can see they wear the default gear of the class and the Arsenal is not working for them.

Share this post


Link to post
Share on other sites

Put your code in initPlayerLocal.sqf instead of init.sqf

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  

×