Jump to content
Sign in to follow this  
odium

Restricted/allowed weapons for coop

Recommended Posts

Hi guys,

I need your help. After hours of searching for a script to permit or restrict specific weapons or items for specific players in a coop-mission, I tried to learn from Xenos Domination. But I failed, it's just too complex.

All I want is a simple script, so that players cannot use foreign weapons and use only the one, they have from the beginning or I have defined. For example, the PRC-343 from ACRE should not be allowed, if they found it on the body of a dead enemy.

I found this thread, but there you need to define every weapon on the map a specific player (e.g. the sniper) may not use.

Anybody has an idea?

Share this post


Link to post
Share on other sites

Not tested but I would start from here:

{
   if ((side _x == east) && ("ACRE_PRC343" in (weapons _x))) then {
_x removeWeapon "ACRE_PRC343";
};
} foreach allUnits;

You probably will have to define either what they can use or what they can't use. Only way I can think to get around it is to build 2 arrays containing all the weapons for each sides playable units. You then check if west or east picks up an enemy weapon and remove it. Of course you will then have to limit the contents of the ammo boxes to items in those arrays.

{
if ((_x isKindOf "US_Soldier_Sniper_EP1") && (primaryWeapon _x != "M107") || (primaryWeapon _x != "M110_NVG_EP1") || (primaryWeapon _x != "BAF_LRR_scoped"))
then {
_pWeapon = primaryWeapon _x;
_magazineClass = currentMagazine _x;
_x removeMagazines _magazineClass;
_x removeWeapon _pWeapon;
hint "Sniper weapons restricted";
};
} foreach allUnits;

The above limits the US Sniper to 3 kinds of primary weapon, if he picks up anything else it gets removed. You will need to incorporate those into a loop so it checks all the time.

Edited by PELHAM

Share this post


Link to post
Share on other sites

i believe that you can "lock" soldiers and ammo crates just like you can vehicles, so players cant go through their inventory when their dead. mabey it obly works in sp idk

Share this post


Link to post
Share on other sites

You could remove everything from the dead, try this from Demonised:

place this in init.sqf or a trigger:

_null = [] execVM "remove.sqf";

remove.sqf

while {true} do {
_deadlist = [];
{if !(isPlayer _x) then {_deadlist = _deadlist + [_x]}} forEach allDead;
sleep 5.0;
{removeallweapons _x; removebackpack _x} forEach _deadlist;
};

http://forums.bistudio.com/showthread.php?p=1967951&highlight=lock+dead#post1967951

Share this post


Link to post
Share on other sites

jut to clarify - do you want rank related restriction or player related restriction, if player restriction pelhams way is quick and easy.

only problem - if you use a global cargo fully loaded, your player (if he does not meet the said requirements) will quickly remove and drop the said weapon, which becomes annoying. you may need to ammend a weapons crate to highlight - if said player then show said weapons - need to create weapons crate local if this is the case.

hope this helps - if rank related i can post this for you.

Share this post


Link to post
Share on other sites

Thank you guys so far. :)

Pelhams script will work. My idea was that we start with specific weapons and I don't like it, when we use russian weapons after some hours.

I will use a mix of forbidden weapons and enemys, whose items will be deleted, after they are dead.

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  

×