pxd2050 Posted April 7, 2023 Share Posted April 7, 2023 (edited) sorry ,title can't post. I try many times. "Can container be active and exchange with actor (no player)?" in game, container can be active and exchange with player, but can't exchange with other actor.can help me, thank you. function OnEquipped(actor akActor) ObjectReference CrossHairRef = Game.GetCurrentCrosshairRef() ObjectReference playerref = game.GetPlayer() as ObjectReference if akActor == game.GetPlayer() DRScBodyNPCOpenSD.Play(akActor as ObjectReference) akActor.EquipItem(aaaMRbohARM as form, true, true) game.DisablePlayerControls(false, false, false, false, false, true, true, false, 0) utility.Wait(0.0100000) If (CrossHairRef as actor) && (CrossHairRef != playerref) String ActorName = (CrossHairRef as actor).GetActorBase().GetName() aaaMRbohContREF.Activate(CrossHairRef, false) debug.notification("Exchange Target :" + ActorName) else aaaMRbohContREF.Activate(playerref, false) debug.notification("Exchange Target :player") endif utility.Wait(0.0100000) game.EnablePlayerControls(false, false, false, false, false, true, true, true, 0) akActor.UnequipItem(aaaMRbohARM as form, false, true) endIf endFunction Edited April 7, 2023 by pxd2050 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 7, 2023 Share Posted April 7, 2023 NPCs cannot interact with containers. Not sure what you are wanting to do. There may be workarounds depending on what you want to achieve. Link to comment Share on other sites More sharing options...
pxd2050 Posted April 8, 2023 Author Share Posted April 8, 2023 NPC 无法与容器交互。 不知道你想做什么。根据您要实现的目标,可能会有解决方法。Thank you for your reply.I want to create a box specifically designed to hold armors (or other types, such as wigs), and then assign armors to NPCs. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 8, 2023 Share Posted April 8, 2023 Get the target NPCHave the player put items for the target NPC into the containerTransfer the items via script from the container to the NPC.RemoveItem is your friend here. If desired, have the target NPC walk to the container and play an idle that looks as if they are digging through the container. Link to comment Share on other sites More sharing options...
pxd2050 Posted April 8, 2023 Author Share Posted April 8, 2023 Get the target NPCHave the player put items for the target NPC into the containerTransfer the items via script from the container to the NPC.RemoveItem is your friend here. If desired, have the target NPC walk to the container and play an idle that looks as if they are digging through the container.Transfer the items via script from the container to the NPC.I don't quite understand how to do it. Is there a similar script? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 9, 2023 Share Posted April 9, 2023 Script on the container: ScriptName SomeContainerScript Extends ObjectReference : ^ change the name of the script as necessary FormList Property myList Auto ; ^ fill with an initially empty form list Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akSourceContainer == Game.GetPlayer() ; ^ if the player added the item myList.AddForm(akBaseItem) ; ^ add the item to the list EndIf EndEvent After obtaining the target NPC, could be a spell that the player casts at the NPC or it could be an SKSE key press that grabs the crosshair target. Either way the following custom function could be used. Just be sure to pass the correct data into the parameters. Function MoveItemsToNPCFromContainer(ObjectReference myContainer, FormList myFormList, Actor myNPC) myContainer.RemoveItem(myFormList,999,false,myNPC) ; ^ moves up to 999 instances of each item in the list from the container to the NPC myFormList.Revert() ; ^ clears the form list of script added entries making room for gear for the next NPC EndFunction This could also be done within a dialog fragment if you'd prefer to use dialog to obtain the target actor. But if done via dialog fragment remove the function wrapper and just use the two internal lines. Link to comment Share on other sites More sharing options...
pxd2050 Posted April 9, 2023 Author Share Posted April 9, 2023 Thank you very much. I can always get a perfect response from you. Try your method later. Link to comment Share on other sites More sharing options...
Recommended Posts