[System Request] Auto-Gathering of items

Gwafu

Active Member
Reaction score
12
I'm making a shooting map. (Instead of right-click move, it will use arrow keys)
What I need is that when a hero walks over an item, it will automatically get it.


  • If the hero has a full inventory, it won't get the item.
  • If it comes across a gold coin (bullets in the game) it will pick it.

Thank you :)
 

SaintMorose

New Member
Reaction score
26
How do items spawn? just randomly dropped or are they triggered?

If you can create them by trigger; add this to the end of your creating items trigger

CountItems is an IntegarVar with initial value "1".
Items is an ItemArrayVar.

Trigger:
  • Item Create
    • Events
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Last created item))
      • Set Items[CountItems] = (Last created item)
      • Unit - Create 1 Item-Dummy for Neutral Passive at TempPoint facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to CountItems
      • Trigger - Add to Item Pickup <gen> the event (Unit - A unit comes within 100.00 of (Last created unit))
      • Set CountItems = (CountItems + 1)
      • Custom script: call RemoveLocation (udg_TempPoint)


Event is probably units dies then randomly roll for an item.

If units can drop Items that you want others to be able to pick up you'll need to add it to that trigger as well. Though keep in mind you'll need something to prevent dropped items from immediately being picked up.

Trigger:
  • Item Pickup
    • Events
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempUGroup = (Units within 150.00 of TempPoint matching (((Unit-type of (Matching unit)) Equal to Item-Dummy) and ((Custom value of (Matching unit)) Greater than 0)))
      • Unit Group - Pick every unit in TempUGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of items carried by (Triggering unit)) Less than 6
            • Then - Actions
              • Hero - Give Items[(Custom value of (Picked unit))] to (Triggering unit)
              • Unit - Set the custom value of (Picked unit) to 0
              • Unit - Add a 1.00 second Generic expiration timer to (Picked unit)
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call DestroyGroup (udg_TempUGroup)


Once again needs you to edit it to also work on stack-able / resource items.

But all the basics should be there and it should be MUI and leak free.
 

Gwafu

Active Member
Reaction score
12
in the map, the guns and ammos are in the base. There are also scattered guns/ammos on the field.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top