I'm trying to construct a simple trigger that won't let a player build a command center within a radius of 20 of another command center, regardless of who owns it. The trigger I'm using is as follows:
EventsUnit-AnyUnitisissuedanordertoSCV-BuildCommandCenterLocalVariablesConditions1<=(NumberofLivingunitsin(CommandCenterunitsin(Region((Targetpointfor(Triggeringorder)),20.0))ownedbyplayerAnyPlayermatchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount))<=100ActionsUnit-Order(Triggeringunit)to(SCV-Cancel)(ReplaceExistingOrders)Unit-Order(Triggeringunit)to(Stop)(ReplaceExistingOrders)Unit-Cancelprogressbarof((Triggeringunit))slot1UI-Display"You can't place a new colony that c..."andplayUI_GenericErrorfor(Allplayers)
Unfortunately, every I issue an order to an SCV to build a command center within 20 units of another unit, the order always gets canceled as if the unit type check failed, regardless of whether or not any of the nearby units are actually command centers. Attempting various different formulations (Pick Every Unit, and canceling the order if any are Command Centers, for instance) yield the same result. The funny thing is, it works fine if, e.g., there are a couple of other marines or SCVs in the target location, and they have to move out of the way first; the type check goes through fine, and construction only fails if the target location is within 20 units of another command center. That makes me think it's some kind of bug, but I can't figure out a workaround or an alternate way to construct the trigger to avoid it.
First of all, don't be too surprised if I'm wrong with this, i recently started toying with the editor in an attempt to recreate one of my favorite broodwar maps, so yeah. xD Anyways, I would honestly mess around with this line "(Number of Living units in (Command Center units in (Region((Target point for (Triggering order)), 20.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount))" considering that in your post it actually says it's following what you want it to. First you say that it's 20 of any unit, than it says within 20 units length away from another CC. So maybe just tweak with the "20.0" or the "with at most Any Amount". Sorry if I am completely wrong. >.>;;
just a simple idea, unable to test it rigth now, but isn't it possible to copy the prevent command center from the mineral patches to the command center? this would easily prevent building them next to each other
I'm trying to construct a simple trigger that won't let a player build a command center within a radius of 20 of another command center, regardless of who owns it. The trigger I'm using is as follows:
Unfortunately, every I issue an order to an SCV to build a command center within 20 units of another unit, the order always gets canceled as if the unit type check failed, regardless of whether or not any of the nearby units are actually command centers. Attempting various different formulations (Pick Every Unit, and canceling the order if any are Command Centers, for instance) yield the same result. The funny thing is, it works fine if, e.g., there are a couple of other marines or SCVs in the target location, and they have to move out of the way first; the type check goes through fine, and construction only fails if the target location is within 20 units of another command center. That makes me think it's some kind of bug, but I can't figure out a workaround or an alternate way to construct the trigger to avoid it.
First of all, don't be too surprised if I'm wrong with this, i recently started toying with the editor in an attempt to recreate one of my favorite broodwar maps, so yeah. xD Anyways, I would honestly mess around with this line "(Number of Living units in (Command Center units in (Region((Target point for (Triggering order)), 20.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount))" considering that in your post it actually says it's following what you want it to. First you say that it's 20 of any unit, than it says within 20 units length away from another CC. So maybe just tweak with the "20.0" or the "with at most Any Amount". Sorry if I am completely wrong. >.>;;
just a simple idea, unable to test it rigth now, but isn't it possible to copy the prevent command center from the mineral patches to the command center? this would easily prevent building them next to each other
Change this:
To this:
The command center the SCV is building counts.