Jump to content
pionr

Disabling gear for particular NPCs

Recommended Posts

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

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.

  • Thanks 1

Share this post


Link to post
Share on other sites

i have a trouble)

Spoiler

Tqj4yLXeWsQ.jpg

Edit: I restarted the game and it worked, but I can still loot

Share this post


Link to post
Share on other sites
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
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

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

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

Reviving-the-Monster-Project-the-Franken

 

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

×