Starcraft – Probe returning: From which mineral field it gathered resources

galaxy-editorstarcraft-2

If I have a Probe returning with minerals back to the base (Issued order "ProbeHarvest",1), how do I know where it was mining from?
I would like to write a trigger which orders the probe to return back to the mineral field early.

To clarify: I have a trigger whose action is one of those:

  • order to return resources back to Nexus:

    TriggerAddEventUnitOrder(null, "ProbeHarvest", 1)

  • used an ability to return resources back to Nexus:

    TriggerAddEventUnitAbility(null, "ProbeHarvest", 1, c_abilHarvestStageApproachDropOff, false)

and in the trigger action I want to learn were it was mining from.

Note: I know how learn when the probe is approaching the mineral field TriggerAddEventUnitOrder(null, "ProbeHarvest", 0), but I don't need that information at that time.

Best Answer

You will need to read up on Units (anything you can click on). Each unit has an ID.

Next, you will have to use a trigger. When a harvester starts to harvest from a mineral patch, you will make a trigger that assigns that harvester to the mineral patch.

You can learn the basics of triggers here.

So once a probe starts harvesting, you can trigger a countdown or whatever you have in mind. Then in that trigger you will command it to go back to the ID it just harvested from which can be found from the resources it is currently gathering or the X/Y axis on the map (I'm also assuming there are other ways to get the ID of what it came from)

Related Topic