Skip to content

NPC Actors

Overview

NPCs are interactable characters with nameplates, circular interaction sphere support, and optional vendor or exchange contracts. AMIPBaseInteractable is the base for any overlap-based interactable (sphere, interaction definitions). AMIPOnlyOwnerInteractableInitially restricts interaction until the owning controller is set. AMIPBaseNPC adds NPC-specific data (MIPNPCInfoAsset), nameplate, vendor/exchange tags, and dialogue/quest integration. AMIPBaseNPCWithStorage adds storage (IMIPStorageAssetInterface). UMIPBaseNPCInteractableComponent is the PC-side component that implements IMIPInteractableComponentInterface for NPC interaction flows.

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
AMIPBaseInteractable Public/Interaction/Interactable/MIPBaseInteractable.h
AMIPOnlyOwnerInteractableInitially Public/Interaction/Interactable/MIPOnlyOwnerInteractableInitially.h
AMIPBaseNPC Public/NPC/MIPBaseNPC.h
AMIPBaseNPCWithStorage Public/NPC/MIPBaseNPCWithStorage.h
UMIPBaseNPCInteractableComponent Public/NPC/Component/MIPBaseNPCInteractableComponent.h

AMIPBaseInteractable

  • Base: AActor; IInteractInterface, IMIPCursorHittableInterface (GetCursorHittableType → Interactable).
  • Components: SphereComponent (overlap).
  • Data: InteractionInstancesDefinitionAsset – defines which interaction options (tags, instances) this actor exposes.
  • IInteractInterface: InteractThisObject_Implementation, EndInteractThisObject_Implementation, GetInteractionInstanceDefinitions(), GetInteractableLocation_Implementation(), GetInteractableSphereComponent_Implementation().
  • Flow: BeginPlay/BeginDestroy; OnBeginOverlap/OnEndOverlap add/remove overlapping controller; InteractThisObjectServer/Client; CanPlayerInteract (BlueprintNativeEvent). RemoveOverlappingController, DestroyInteractable(). OnReceivedControllerChanged for owner.
  • Helpers: GetActorAsPawn, GetControllerFromActor, GetPCFromInteractionComponent, GetGM, GetPickupSpawner (for item drops). OnInteractableBeginOverlap/OnInteractableEndOverlap (BlueprintNativeEvent).

AMIPOnlyOwnerInteractableInitially

  • Base: AMIPBaseInteractable. Restricts interaction until the actor has an owning controller (e.g. pickup only for the player who triggered it initially). Used as base for pickups and loot that are “owned” until collected or released.

AMIPBaseNPC

  • Base: AMIPBaseInteractable; ICircularInteractionSphereInterface, IActorWithNameplateInterface, IOutliningInterface, IMIPVendorInterface, IMIPExchangeInterface.
  • Components: SkeletalMeshComponent (Mesh), CapsuleComponent; NameplateWidgetComponent. ArrowComponent (editor only).
  • Data: NPCInfoAsset (UMIPNPCInfoAsset) – NPC info (FMIPNPCInfo); GetNPCInfo().
  • Nameplate: SetNameplateWidgetComponent, GetNameplateWidgetComponent, GetNameplateWidgetClass, GetOverrideRelativeLocation, GetOverridePivotLocation, GetNamesForNameplate_Implementation. NameplateOverrideRelativeLocation, NameplateOverridePivot (EditDefaultsOnly). GetAllMeshes_Implementation for outline.
  • Interaction: GetInteractionInstanceDefinitions() from asset; GetNPCInteractionInstanceDefinitions(). InteractThisObject_Implementation, EndInteractThisObject_Implementation (override).
  • Circular sphere: GetCircularInteractionSphereAttachmentInfo_Implementation (FCircularInteractionSphereAttachmentStruct).
  • Vendor: GetVendorTag(), GetVendorUniqueInventoryTag() (IMIPVendorInterface).
  • Exchange: GetExchangeTag() (IMIPExchangeInterface).
  • Delegate: FClientNPCBeginInteracting(NPC).

AMIPBaseNPCWithStorage

  • Base: AMIPBaseNPC; IMIPStorageAssetInterface. NPC that provides a storage inventory (e.g. stash, vendor repurchase list). Storage data typically comes from the same or a related data asset.

UMIPBaseNPCInteractableComponent

  • Base: UMIPBasePlayerControllerComponent; IMIPInteractableComponentInterface. Attached to the player controller; initializes the interaction listener object and implements OnInteractionTag, OnInteractedClient/Server, OnEnd*. Used when the player interacts with an NPC (dialogue, quest, vendor, exchange). See interfaces (IMIPInteractableComponentInterface).

Integration

  • UMIPInteractionComponent – Overlap and InteractThisObject/EndInteract flow; GetInteractionInstanceDefinitions from actor.
  • UMIPStoragesManagerComponent – NPC storage IMC for NPCs with storage; vendor/repurchase.
  • UMIPBaseQuestComponent – Accept/complete quests at NPCs; NPC nameplate status (quest icon).
  • UMIPNPCsManager (GameState) – Caches/registers NPCs for quest and world logic.
  • Data assets: MIPNPCInfoAsset, MIPInteractionInstanceDefinitionAsset, MIPNPCSecondaryActionAsset for dialogue and secondary actions.