Jump to content

Recommended Posts

Hello,

I would like to add weapon restrictions to specific classes. For example only AT's can carry launchers, only engineers can carry explosive charges and only medics can carry medkits. In my mission, players will be given a virtual arsenal at the start, but I don't want them to pick up anything they are not supposed to later on. So the restrictions should always apply. I have seen a few topics on how to restrict the arsenal but that is not going to work.

Does anybody know how I can do that?

Thank you

Share this post


Link to post
Share on other sites

See

 

Combine that with typeOf unit or roleDescription or something. 

 

Share this post


Link to post
Share on other sites

That's not enough if you can grab what you want during game.

The way seems to be a loop (0.5 or 1 sec. , no need to run that on each frame) with a code removing undue magazines and weapons, per type of player.

Share this post


Link to post
Share on other sites

Thank you. A loop does sound like a pretty good solution. Should I run the loop in initPlayer? Also, is there a way I can display a little message to the players if some of their items/weapons have been removed because they are not suited for their role? For example "Weapon or item in your inventory does not fit your role and has been removed."

Share this post


Link to post
Share on other sites

Yes, initPlayerLocal.sqf is the right place. And right place also for such hint (effects_local.gif)

 

Share this post


Link to post
Share on other sites

My inventory clean function is called from inventory closed, take, arsenal closed & fired event handlers (the last one doesn't really have to be there)

Share this post


Link to post
Share on other sites

I was thinking of using getUnitLoadout to get the player's loadout, and then using BIS_fnc_inString to look for each of the restricted weapons, one by one. If it returns true, I can remove the weapon. But that idea is going to take a really long time to code, is there a faster way that I can compare player's invenotries to the restricted weapons list?

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

×