pionr 0 Posted May 24, 2020 Hello, I'm new here and my English is not very good, I will be short, there is a mission where there will be some dead NPCs as decoration. And here's the problem how to make these NPCs can not be loot. But other NPCs that will play with you, you can loot. Share this post Link to post Share on other sites
Erwin23p 34 Posted May 25, 2020 So if I understand correctly, you want to make some dead corpses unlootable, but if one of your npc teammates dies, you can loot them? You could force close player invetory: Put this in the non lootable npc: this setvariable ["lootable",false,true]; and then add this to the init.sqf player addEventHandler ["InventoryOpened", { _lootable = (_this select 1) getVariable ["lootable", true]; if !_lootable then {true}; }]; With the set variable, you're assigning that npc the variable lootable, a false boolean, then in the init you're adding an eventhandler to the player that when he opens the inventory it will check if that npc is lootable or not through the above assigned variable, and if it results false, it will override the open inventory action by doing anything. 1 Share this post Link to post Share on other sites
pionr 0 Posted May 26, 2020 i have a trouble) Spoiler Edit: I restarted the game and it worked, but I can still loot Share this post Link to post Share on other sites
pionr 0 Posted May 26, 2020 7 hours ago, Erwin23p said: So if I understand correctly, you want to make some dead corpses unlootable, but if one of your npc teammates dies, you can loot them? Yes, that's right Share this post Link to post Share on other sites
pionr 0 Posted May 26, 2020 9 hours ago, Erwin23p said: Put this in the non lootable npc: this setvariable ["lootable",false,true]; and then add this to the init.sqf player addEventHandler ["InventoryOpened", { _lootable = (_this select 1) getVariable ["lootable", true]; if !_lootable then {true}; }]; I did exactly as it was written. But nothing works, I can also loot the NPC Share this post Link to post Share on other sites
Erwin23p 34 Posted May 26, 2020 Well I don't know why it isn't working, I tried it in multiplayer with a friend and it's working well... Share this post Link to post Share on other sites
pionr 0 Posted May 26, 2020 A very strange story, yesterday nothing worked, today it already works and I didn't even change anything, just started the game. Thank you so much for your help! Spoiler Share this post Link to post Share on other sites