Here is an example of counting marines 2 spaces away from the triggering unit.
Variable - MarineGroup = (Marine units in (Region((Position of (Triggering unit)), (((Unit type of (Triggering unit)) Radius) + 2.0))) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
Variable - Set marines in range = (Number of Living units in (MarineGroup))
Variable "MarineGroup" is of the type Unit Group.
Variable "marines in range" is of the type int.
so basicly after setting the needed variables with this you can do:
(This next bit is manually written and not copy/paste from the trigger editor)
if
Conditions
And
(marines in range>0)
....
Then
Actions
remove (random unit from unit group (marinegroup)) from the game
remove ....
Create 1 UpgradedMarine
Edit:
If you want to keep track of how many ingredients are ingame and where then what jcraigk says is better.
@DaBernMon: Go
items on the ground are units.
Here is an example of counting marines 2 spaces away from the triggering unit.
Variable - MarineGroup = (Marine units in (Region((Position of (Triggering unit)), (((Unit type of (Triggering unit)) Radius) + 2.0))) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
Variable - Set marines in range = (Number of Living units in (MarineGroup))
Variable "MarineGroup" is of the type Unit Group.
Variable "marines in range" is of the type int.
so basicly after setting the needed variables with this you can do:
(This next bit is manually written and not copy/paste from the trigger editor)
Edit:
If you want to keep track of how many ingredients are ingame and where then what jcraigk says is better.