• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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).
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
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.
Top