[General] Items for NPC

Status
Not open for further replies.
Level 6
Joined
Jan 31, 2014
Messages
67
I'm creating a NPC who goes from place to place(done this).
Takes items and comes back to his spawn place to deliver them.
I need help with NPC taking the items.(Items are dropped with trigger)
Like- A hunter comes to wolf, kills it and takes his meat (Meat is dropped with trigger).
 
You need to trigger the unit to pick an item within range.
STEPS:
- Create a trigger (lets call it pickItem)
- Create a region within the NPC
- Pick every item in the region
- Order NPC to pick the item
  • Events
  • Conditions
  • Actions
    • Set tempPoint = Position of NPC
    • Set yourRegion = Region centered at tempPoint with size (600, 600)
    • Item - Pick every item in yourRegion and do (Actions)
      • Loop - Actions
        • Unit - Order NPC to Right-Click (Picked Item)
    • Custom script: call RemoveLocation(udg_tempPoint)
    • Custom script: call RemoveRect(udg_yourRegion)
Basically, running
  • Trigger - Run pickItem <gen> (ignoring conditions)
will make your NPC look for items nearby.

Just putting the "Trigger - Run pickItem <gen> (ignoring conditions)" in a trigger will make the NPC pick items.
Or you can put a periodic event in the pickItem trigger if you want.
 
Last edited:
Status
Not open for further replies.
Back
Top