Jump to content
anfo

Prevent looting of AI

Recommended Posts

Hi

This topic is widely covered in other threads, but I seem to need to splice code from each one to have a desirable outcome. Essentially I would like:

 

BLUFOR player CAN loot dead BLUFOR player/AI

BLUFOR player CANNOT loot dead OPFOR AI

 

I found the following code, which I feel is a good starting point (credit unknown author):

// DELETE ALL WEAPONS & AMMO
addMissionEventHandler ["EntityKilled", {

	params ["_killed", "_killer", "_instigator"];
	
	if (isPlayer _killed) exitWith {};
	if !(_killed isKindOf "Man") exitWith {};
	
	// HANDLE OPFOR
	if (side _killed == east) then {
	
		removeAllWeapons _killed;									//
		removeAllItems _killed;										// Question below
		removeAllAssignedItems _killed;									//
		deleteVehicle (nearestObject [_killed, "WeaponHolderSimulated"]);				// Would like to keep this to delete weapon
		
	};

Regarding the removeAll commands, can an "Inventory opened" eventHandler be injected to deny access instead?

So in summary, BLUFOR player kills OPFOR AI, player sees no weapon to pickup and inventory is inaccessible.

 

Thank you.

Share this post


Link to post
Share on other sites

@pierremgiSorry, irresponsible of me. When you wrote before:

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

I thought we had hit a wall. I should have mentioned that this fell short of my requirements, but I didn't, so I apologise. It wasn't my intention to offend although I can understand how I did.

  • Like 2

Share this post


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

In fact, you need a workaround (one more) for that. The reason why I opened a new topic.

 

I wasn't aware of that either.

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

×