Jump to content
Sign in to follow this  
fortun

How to Disable looting/Looting gear from killed players

Recommended Posts

Hello! Working on a really good idea i got yesterday. Problem is in this mission, that i want to disable the ability for me and my group/m8s to loot other players. Just use the things they have and use the things they find in boxes. But can't find anything about how to make that work. Anyone?

In short terms, How to disable squad/group to loot killed AI players?

Share this post


Link to post
Share on other sites

Didn't I hear that if you force a ragdoll animation the body can't be revived/looted? Maybe you could look into that.

Share this post


Link to post
Share on other sites
Hello! Working on a really good idea i got yesterday. Problem is in this mission, that i want to disable the ability for me and my group/m8s to loot other players. Just use the things they have and use the things they find in boxes. But can't find anything about how to make that work. Anyone?

In short terms, How to disable squad/group to loot killed AI players?

Put this in the init.sqf of your mission folder.

{_x addeventhandler ["killed",{
_this spawn {_unit = _this select 0; removeallweapons _unit;removeallassigneditems _unit;clearmagazinecargo _unit;sleep 120; deletevehicle _unit};
}];
} forEach allUnits;

this bit removes dead bodies after 120 seconds. Increase the timer to suit, or remove it completely if you don't want to use it.

sleep 120; deletevehicle _unit

Share this post


Link to post
Share on other sites
Put this in the init.sqf of your mission folder.

{_x addeventhandler ["killed",{
_this spawn {_unit = _this select 0; removeallweapons _unit;removeallassigneditems _unit;clearmagazinecargo _unit;sleep 120; deletevehicle _unit};
}];
} forEach allUnits;

this bit removes dead bodies after 120 seconds. Increase the timer to suit, or remove it completely if you don't want to use it.

sleep 120; deletevehicle _unit

Many thanks for that script!

Just some things

I want to have so that the player don't even can loot the uniform/vest or anything from killed players, will look a bit ridicilous if i added removeuniform to the script, having the players "naked" when they are dead. Is there any other way i can do so weapons - vests can't be looted without having players naked when dead?

Also, is it able to get the script so i still can loot my groups dead players for their gear?

Share this post


Link to post
Share on other sites

BUMP

Any new idea on this how to do so the player can't pick up gear on dead people? I want my mission to be self-found in boxes and cargos only.

Share this post


Link to post
Share on other sites

I need something like this but for dead players... Basically I want to make something so when a player die they keep there Items on their body but players cant access the gear of the dead body.. The reason for this Is because I am making a mod that has medic classes that use MediKits to revive and heal players but I dont want players to loot dead players and pick it up... I also dont want the item to be deleted incase another medic revives the dead medic... cant have them medikits been deleted :S

Share this post


Link to post
Share on other sites

I need something like this but for dead players... Basically I want to make something so when a player die they keep there Items on their body but players cant access the gear of the dead body.. The reason for this Is because I am making a mod that has medic classes that use MediKits to revive and heal players but I dont want players to loot dead players and pick it up... I also dont want the item to be deleted incase another medic revives the dead medic... cant have them medikits been deleted :S

 

Delete the item at the death. Re-add it at revive?

Share this post


Link to post
Share on other sites

How would you do that?

 

For player units:

 

onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
player removeItem "Medikit";

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

Share this post


Link to post
Share on other sites

Just tested this and its messed my Inventory selection script. Using the above now makes players spawn with a default loadout and not one they selected, I am guessing thats down to this section "call BIS_fnc_loadInventory;" anyway to avoid losing my custom loadouts?

 

Here is how I use my loadouts:

 

Loadout.sqf

class WEST2
	{
		displayName = "Engineer"; // Name visible in the menu
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; // Icon displayed next to the name
		// Loadout definition, uses same entries as CfgVehicles classes
		weapons[] = {
			"arifle_Mk20_GL_F",
			"launch_RPG32_F",
			"hgun_ACPC2_F",
			"Rangefinder"
		};
		Backpack[] = {
			"B_TacticalPack_blk"
		};
		magazines[] = {
			"30Rnd_556x45_Stanag",
			"30Rnd_556x45_Stanag",
			"30Rnd_556x45_Stanag",
			"30Rnd_556x45_Stanag",
			"30Rnd_556x45_Stanag",
			"30Rnd_556x45_Stanag",
			"9Rnd_45ACP_Mag",
			"9Rnd_45ACP_Mag",
			"9Rnd_45ACP_Mag",
			"MiniGrenade",
			"RPG32_F",
			"RPG32_F",
			"RPG32_F"
		};
		items[] = {
			"ToolKit",
			"ItemMap",
			"ItemCompass",
			"ItemWatch",
			"ItemRadio",
			"ItemGPS"
		};
		linkedItems[] = {
			"V_PlateCarrier2_blk",
			"G_Combat",
			"H_Watchcap_blk",
			"acc_pointer_IR",
			"optic_Hamr"
		};
		uniformClass = "U_I_G_resistanceLeader_F";
	};

And here are the calls used:

initServer.sqf:

// Loadouts
WaitUntil {Sleep 1; Local Player};
    _gear = [west, "west1"] call BIS_fnc_addRespawnInventory; //Assault BluFor
    _gear = [west, "west2"] call BIS_fnc_addRespawnInventory; //Engineer BluFor
    _gear = [west, "west3"] call BIS_fnc_addRespawnInventory; //Sniper BluFor
    _gear = [west, "west4"] call BIS_fnc_addRespawnInventory; //Medic BluFor
    _gear = [west, "west5"] call BIS_fnc_addRespawnInventory; //Support BluFor
	
    _gear = [east, "east1"] call BIS_fnc_addRespawnInventory; //Assault OpFor
	_gear = [east, "east2"] call BIS_fnc_addRespawnInventory; //Engineer OpFor
    _gear = [east, "east3"] call BIS_fnc_addRespawnInventory; //Sniper OpFor
	_gear = [east, "east4"] call BIS_fnc_addRespawnInventory; //Medic OpFor
    _gear = [east, "east5"] call BIS_fnc_addRespawnInventory; //Support OpFor

would I just replace call BIS_fnc with mine like "call BIS_fnc_addRespawnInventory;" Or something like that?

  • Like 1

Share this post


Link to post
Share on other sites

Ok just tried a few things and it seems to work as intended. Thought I would post this in case anybody ever want to do the same thing.

 

onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
player removeItem "Medikit";
player removeItem "Toolkit";

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] BIS_fnc_addRespawnInventory;

Also the ToolKit does get deleted and I guess I will see if it get given back once revived later once I find a revive script. Thanks for helping :)

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  

×