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

Post » Fri Dec 03, 2010 4:37 am

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?
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Fri Dec 03, 2010 5:13 am

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.
User avatar
Cedric Pearson
 
Posts: 3487
Joined: Fri Sep 28, 2007 9:39 pm

Post » Fri Dec 03, 2010 3:54 am

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...
User avatar
Allison C
 
Posts: 3369
Joined: Mon Dec 18, 2006 11:02 am

Post » Thu Dec 02, 2010 4:04 pm

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.
User avatar
Sharra Llenos
 
Posts: 3399
Joined: Wed Jan 17, 2007 1:09 pm


Return to Fallout 3