maxarturo Posted September 14, 2020 Share Posted September 14, 2020 Good evening. For the sake of optimizing and script's lightness. Is there a way to "LOCK" a weapon on an npc without using papyrus, the npc should use 'ONLY' the given weapon and non other. I currently have this in the npc's script, and i'm wondering if by doing it in another way can help get rid of it, not that is not working. EVENT OnLoad() Self.EquipItem(MyWeapon, True) ENDEVENT EVENT OnObjectEquipped(Form akBaseObject, ObjectReference akReference) If ( !akBaseObject as Weapon == MyWeapon ) Self.EquipItem(MyWeapon, True) EndIf ENDEVENT Thank you. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 14, 2020 Share Posted September 14, 2020 (edited) The only way to make sure they use that weapon would be to do either what you are doing or ensure that no other weapon ever gets added to their inventory (which would also require a script). Sorry, I think in this case you'll need to use the script. EDIT: typos Edited September 14, 2020 by IsharaMeradin Link to comment Share on other sites More sharing options...
maxarturo Posted September 14, 2020 Author Share Posted September 14, 2020 (edited) Unfortunately, i can't forbid players from not adding weapons to the npc's inventory, in this case 'Bows'. I'm working on a 'Mini Deployable Droid' with multiple functions, the "Dwarven X Sonic Ballista", but except the fact that you need to give / provide him with its special 'Ammo' (10 varieties to construct), the droid can also serve as a 'Mule', it has a 350 points of carrying weight. The droid's inventory can be accessed even when the droid is in the player's inventory, and this was from the beginning 1 of the 3 base ideas for this droid, so removing it is out of the question. I just posted the questions since i have never made a 'follower mod' and maybe an experienced in the field modder or anyone with the knowhow (if there is one), could point me to the door. The script as it is now, i'm almost finished with the whole construction, it's working flawlessly, but i'm still looking for ways to cut down anything that can be cut. Thank you for your interest IsharaMeradin. Edited September 15, 2020 by maxarturo Link to comment Share on other sites More sharing options...
ReDragon2013 Posted September 16, 2020 Share Posted September 16, 2020 AddInventoryEventFilter() should work for your droid ; https://forums.nexusmods.com/index.php?/topic/9113018-alternative-for-this-script-function/ FormList PROPERTY myList auto ; all items that NPC may receive from player ; maxarturo wrote: "Unfortunately, i can't forbid players from not adding weapons to the npc's inventory" ; -- EVENTs -- EVENT OnInit() ; https://www.creationkit.com/index.php?title=AddInventoryEventFilter_-_ObjectReference self.AddInventoryEventFilter(myList) ENDEVENT EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) Debug.Notification("Inventory open for player") ELSE Debug.Notification("Activated by something..") Debug.Trace(self+" Activated by " +akActionRef) ENDIF ENDEVENT Link to comment Share on other sites More sharing options...
NexusComa2 Posted September 16, 2020 Share Posted September 16, 2020 Old script that only lets you add one type of item to a container. Sure you could modify this a player scriptand make it so the player could only have what objects you state. Scriptname Ship00_OneObjectOnly extends ObjectReference;* One Object Only * By: NexusComa * ; nexusmods.comMiscObject Property ObjectType Auto;Event OnInit() GoToState("Done")EndEvent;Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If(akBaseItem!=(ObjectType)) Self.RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer) EndifEndEvent;State Done ;do nothingEndState Link to comment Share on other sites More sharing options...
maxarturo Posted September 17, 2020 Author Share Posted September 17, 2020 (edited) Thanks ReDragon and NexusComa2 for your reply. But i was looking to find any other way to do this without using 'Papyrus' and not to replace it with something more expensive. This is way more cheap... EVENT OnObjectEquipped(Form akBaseObject, ObjectReference akReference) If ( !akBaseObject as Weapon == MyWeapon ) Self.EquipItem(MyWeapon, True) EndIf ENDEVENT ...from what ReDragon suggested, not that is not working, but something like this will add extra weight in an already heavy / long script. Thank you both. Edited September 17, 2020 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts