- Joined
- Jan 16, 2008
- Messages
- 156
Hi everyone,
I'm helping out a bit with a SC2 map and created a trigger for an extension mod that would go through melee maps and make every base have a single gas (ie delete one of the gas geysers).
I've spent a bit of time on it and it doesn't work properly, it seems to randomly delete geysers. I'm sure there is a bug somewhere I am not seeing, so I'd appreciate if someone else would look it over:
The idea here is to pick every geyser and add it to a unit group, and also index every geyser in an array. Then I loop through every indexed gas geyser in the array and for each indexed gas geyser I loop through all the units in the gas unit group. If the geysers aren't the same (the indexed geyser isn't the same unit as one picked in the unit group) and are within a certain distance, it deletes one of them.
Thanks for any and all info.
I'm helping out a bit with a SC2 map and created a trigger for an extension mod that would go through melee maps and make every base have a single gas (ie delete one of the gas geysers).
I've spent a bit of time on it and it doesn't work properly, it seems to randomly delete geysers. I'm sure there is a bug somewhere I am not seeing, so I'd appreciate if someone else would look it over:
Code:
Gas Delete
Events
Game - Map initialization
Local Variables
Gas = (Empty unit group) <Unit Group>
GasIndex = 0 <Integer>
GasUnit = No Unit <Unit[100]>
Conditions
Actions
Unit Group - Pick each unit in (Vespene Geyser units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Gas
Variable - Set GasIndex = (GasIndex + 1)
Variable - Set GasUnit[GasIndex] = (Picked unit)
Unit Group - Pick each unit in (ProtossVespeneGeyser (Unknown) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Gas
Variable - Set GasIndex = (GasIndex + 1)
Variable - Set GasUnit[GasIndex] = (Picked unit)
Unit Group - Pick each unit in (PurifierVespeneGeyser (Unknown) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Gas
Variable - Set GasIndex = (GasIndex + 1)
Variable - Set GasUnit[GasIndex] = (Picked unit)
Unit Group - Pick each unit in (ShakurasVespeneGeyser (Unknown) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Gas
Variable - Set GasIndex = (GasIndex + 1)
Variable - Set GasUnit[GasIndex] = (Picked unit)
Unit Group - Pick each unit in (Vespene Geyser (Space Platform) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Gas
Variable - Set GasIndex = (GasIndex + 1)
Variable - Set GasUnit[GasIndex] = (Picked unit)
General - Pick each integer from 1 to GasIndex, and do (Actions)
Actions
Unit Group - Pick each unit in Gas and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked unit) != GasUnit[(Picked integer)]
1 <= (Distance between (Position of (Picked unit)) and (Position of GasUnit[(Picked integer)])) <= 100
Then
Unit Group - Remove GasUnit[(Picked integer)] from Gas
Unit - Remove GasUnit[(Picked integer)] from the game
Else
The idea here is to pick every geyser and add it to a unit group, and also index every geyser in an array. Then I loop through every indexed gas geyser in the array and for each indexed gas geyser I loop through all the units in the gas unit group. If the geysers aren't the same (the indexed geyser isn't the same unit as one picked in the unit group) and are within a certain distance, it deletes one of them.
Thanks for any and all info.