Jump to content
soundblaster

Disable looting gear from corpses

Recommended Posts

Well I would get current magazine type, remove all magazines and add couple of current magazines back.

Keep it simple. 

  • Like 1

Share this post


Link to post
Share on other sites

Not a bad idea.

 

Try this:

addMissionEventHandler ["EntityKilled", {
    params["_killed"];
    private ["_allmags","_uniquemags"];
    if (_killed isKindOf "Man") then {
        _allmags = magazines _killed;
        _uniquemags = _allmags arrayIntersect _allmags;
        _allmags = _allmags - _uniquemags - _uniquemags;
        {
            _killed removeMagazine _x;
        } forEach _allmags;
    };
}];

Not the most elegant solution but it should leave only 2 of each type of magazine and remove all others.

  • Like 1

Share this post


Link to post
Share on other sites

 

Modified mine which seems to be sufficient enough (tested)


 

Player addEventHandler ["inventoryOpened",{
  params ["_plyr","_cont"];
  [ _plyr, _cont ] spawn {
    params ["_plyr","_cont"];
    waitUntil {!isnull findDisplay 602};
    if (!isNull _cont && {cursorTarget isKindOf _x} count ["CAManBase","WeaponHolderSimulated"] > 0) then {
      (findDisplay 602) closeDisplay 2
    }
  }
}];

inGameUISetEventHandler ["action",
  " _cont = _this select 0;
    _act = _this select 3;
    if  ( {cursorTarget isKindOf _x} count ['CAManBase','weaponHolderSimulated'] > 0
     && _act in ['Rearm','TakeWeapon','Gear','Inventory']
    ) then {true} else {false}
  "
];

 

  • Like 2

Share this post


Link to post
Share on other sites

really nice guys! I look forward to trying these out later... much like I have been all thread [thumbsUp]

Share this post


Link to post
Share on other sites
35 minutes ago, Cpt.Price21 said:

Could you tell nightvision id too ? İ mean number of slot nv goggles ?

 

Share this post


Link to post
Share on other sites
On 10/28/2017 at 12:02 AM, pierremgi said:

 

Modified mine which seems to be sufficient enough (tested)

 

 

@pierremgi Bit on the late side, but I tried this today and I like it very much. Would it be too difficult to add the possibility of ignoring a side, e.g. blufor?

  • Like 1

Share this post


Link to post
Share on other sites

Looting on BLUFOR only:

 

Spoiler

 


Player addEventHandler ["inventoryOpened",{
  params ["_plyr","_cont"];
  [ _plyr, _cont ] spawn {
    params ["_plyr","_cont"];
    waitUntil {!isnull findDisplay 602};
    if (!isNull _cont && {!(cursorObject isKindOf "CAManBase" && [cursorObject,true] call BIS_fnc_objectSide isEqualTo WEST) or cursorObject isKindOf "weaponHolderSimulated"}) then {
      (findDisplay 602) closeDisplay 2
    }
  }
}];

inGameUISetEventHandler ["action",
  " _cont = _this select 0;
    _act = _this select 3;
    if  ( (cursorObject isKindOf 'CAManBase' && !([cursorObject,true] call BIS_fnc_objectSide isEqualTo WEST)) or cursorObject isKindOf 'weaponHolderSimulated'
      && _act in ['Rearm','TakeWeapon','Gear','Inventory']
    ) then {true} else {false}
  "
];

 

 

 

 

The loot on BLUFOR corpse is now possible but you need to aim an accurate area of the corpse. If the primary weapon is too close, it may fails. Try it also farer or nearer.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

@pierremgi
If you are still interested in further developing this code, the blufor is allowed to loot blufor, but not opfor aspect of the script works well. A strange side effect of the script however, is no inventory in crate or vehicle is accessible now! 😊

Share this post


Link to post
Share on other sites

Should work with:

 

Player addEventHandler ["inventoryOpened",{ 
  params ["_plyr","_cont"]; 
  [ _plyr, _cont ] spawn { 
    params ["_plyr","_cont"]; 
    waitUntil {!isnull findDisplay 602}; 
    if (!isNull _cont && (cursorTarget distanceSqr _plyr < 16) && {!(_cont isKindOf "ReammoBox_F" or [_cont,true] call BIS_fnc_objectSide isEqualTo WEST) && !(_cont isKindOf "groundWeaponHolder")}) then { 
      (findDisplay 602) closeDisplay 2 
    } 
  } 
}]; 
 
inGameUISetEventHandler ["action", 
  " _cont = _this select 0; 
    _act = _this select 3; 
    if  (_act in ['Rearm','TakeWeapon','Gear','Inventory'] && (cursorTarget distanceSqr player < 16) && {!(_cont isKindOf 'ReammoBox_F' or [_cont,true] call BIS_fnc_objectSide isEqualTo WEST) && !(_cont isKindOf 'groundWeaponHolder')} 
    ) then {true} else {false} 
  " 
];

 

EDITED

This script disable also the loot for weapons on ground (except if inside a blufor corpse inventory).
This script enable the loot for weapons on ground except for those belonging to a non-BLUFOR corpse inventory.
For BLUFOR corpse, you will not grab the primary weapon on ground but you can pick it in inventory.

All crates are enabled.

 

There is no immediate solution to make difference between a blufor gun and opfor gun.

(Giving a side to weapons will be a future topic).

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

Should work

 

Thank you, will give it a shot and report back 😀

Share this post


Link to post
Share on other sites
On 12/7/2019 at 11:43 PM, pierremgi said:

EDITED

This script disable also the loot for weapons on ground (except if inside a blufor corpse inventory).
This script enable the loot for weapons on ground except for those belonging to a non-BLUFOR corpse inventory.
For BLUFOR corpse, you will not grab the primary weapon on ground but you can pick it in inventory.

All crates are enabled.

 

There is no immediate solution to make difference between a blufor gun and opfor gun.

(Giving a side to weapons will be a future topic).

 

As promised but not delivered. Bug found and reproduced in the following order:

1. Blufor Player can open own inventory,

2. Blufor Player checks EAST/GUER AI corpse inventory - blocked as designed,

3. Now Player cannot open own inventory.

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

I don't understand.

 

The test I set up, was me killing an EAST and GUERRILA AI. Before I kill them, I can access my own inventory. After I kill them I can't access their inventory (good!). However, after I kill them, I can't access my own inventory.

Share this post


Link to post
Share on other sites
1 hour ago, anfo said:

 

The test I set up, was me killing an EAST and GUERRILA AI. Before I kill them, I can access my own inventory. After I kill them I can't access their inventory (good!). However, after I kill them, I can't access my own inventory.

I can't reproduce that. Do you have a video? There is no reason for such change in behavior!

Which script are you using?

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Do you have a video?

 

I will produce a video

 

Looks like I owe you my second apology.😞 Perhaps it was a late night of editing or any other flimsy reason, but it appears to work now. Sorry to set off a false alarm, I guess I should have double checked.
It seems the only issue was the dead blufor weapon being inaccessible, but I am appreciative none the less. 🙂

Share this post


Link to post
Share on other sites

Just a point. The contextual BI menu like ream, take weapon, gear  (with icons in middle on screen) are based on cursortarget. For some reason, you can access to these menus if the container (crate/corpse/vehicle) in behind you. Imho, it's a BI bug. CursorObject could be better but... not used by BI.

If I don't want to have a cheat when the container is behind the player, I must work with cursortarget also.
It's a choice:

- use of cursorObject for a better aiming of the container, but BI allows you some unwanted menu when the container is behind you;

- use of cursortarget to be compliant with BI action menus, then you'll fail to open your own inventory, if any blocked container is behind you. This is the option I opted for.

  • Like 2

Share this post


Link to post
Share on other sites

I see what you might be saying. I was possibly briefly looking at a corpse when I attempted to open my own inventory?

Share this post


Link to post
Share on other sites
4 hours ago, anfo said:

I see what you might be saying. I was possibly briefly looking at a corpse when I attempted to open my own inventory?

Not briefly. With BI, you can look at a corpse even if the corpse is behind you. (same for crates or vehicles). That's a problem.
There is a distance condition, fortunately.

Share this post


Link to post
Share on other sites

Is it possible to prevent the looting of just the uniform?  We have a custom uniform for an AI "faction" on our Exile servers that we don't want players to have.  

Share this post


Link to post
Share on other sites
6 hours ago, TroyT said:

Is it possible to prevent the looting of just the uniform?  We have a custom uniform for an AI "faction" on our Exile servers that we don't want players to have.  

 

Sure But it's not exactly the same problem because you want to access the inventory and avoid a shift between you uniform and the uniform on the corpse (if the class is met).

 

Share this post


Link to post
Share on other sites

I'll create a new topic.

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

×