• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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