Page 1 of 1

Question: How do I prevent NPCs from picking up weapons?

PostPosted: Fri Dec 03, 2010 4:37 am
by Naazhe Perezz
Gentlemen. (And Ladies.) I've pored through the GECK website, searched the forums (and yes, Google as well), and I haven't been able to figure this out on my own. So, without further ado:

I have been working on a companion mod, and there is a recurring problem that I can't figure my way around. I want my companion to always use the same weapon (which, for mod purposes, has extremely low damage to avoid accidental kills). Every time I'm in combat, though, my companion will pick up a weapon as soon as it drops and switch to it.

My question, then, is twofold:
1) Is there a way to prevent NPCs from picking up items (e.g. weapons) altogether?
2) If not, is there a way to ensure my companion doesn't ever switch to a different weapon?

Question: How do I prevent NPCs from picking up weapons?

PostPosted: Fri Dec 03, 2010 5:13 am
by Cedric Pearson
You can use the no unequip flag and your companion will not be able to drop the item or switch it for another.

http://geck.gamesas.com/index.php/EquipItem

The way I do it is to use an empty container which the player activates through an option in the NPCs menu. Then ref walk the container to get the base object, remove it from the container, and force equip it on your NPC. It's wise to write an option to unequip the item also if you ever want to switch them.

You could also just attach a script to your companions weapon that checks if it is equipped, and if not forces it using the flag. No FOSE needed for this option but it's less desirable to me.

Question: How do I prevent NPCs from picking up weapons?

PostPosted: Fri Dec 03, 2010 3:54 am
by Allison C
You can use the no unequip flag and your companion will not be able to drop the item or switch it for another.

http://geck.gamesas.com/index.php/EquipItem

The way I do it is to use an empty container which the player activates through an option in the NPCs menu. Then ref walk the container to get the base object, remove it from the container, and force equip it on your NPC. It's wise to write an option to unequip the item also if you ever want to switch them.

You could also just attach a script to your companions weapon that checks if it is equipped, and if not forces it using the flag. No FOSE needed for this option but it's less desirable to me.


I ended up having to go the script route, using equipitem with the no unequip flag was giving the same behavior. Thanks for your help!

Now, if only they had a way to set a reference's name independent of the base actor...

Question: How do I prevent NPCs from picking up weapons?

PostPosted: Thu Dec 02, 2010 4:04 pm
by Sharra Llenos
Depending on what your doing, you could use http://geck.gamesas.com/index.php/GetContainer.

Usefull if the script is on the weapon, and the weapon is in the inventory of the actor you want to get the reference of.