Hi, I'm creating a little arcade/custom mod in which one of the race has a Command Center, and can only build from it, but it can only build right next to itself. The created structure can also only create a structure right beside itself, and so on. This mechanic is already implemented (although its a little goofy). The problem is, I need those buildings to create a continuous line, a Power Supply line.
I created a search area + apply behavior effect, and Morph skills, so when building has behavior false, building morphs into an Inactive state, and when the behavior is applied, it transforms back. The first Behavior comes from the CC, and: if caster unit has the behavior-> it can cast the skill. The problem is, when I severe the power line's connection with the CC (removing 1 building from the line), the power supply keeps itself on, since the can apply the behavior to each other.
I have no idea how to solve this. Is there a validator that effect can not be applied to creator of unit? Or what could I possibly do? No, I won't accept defeat and cry in the corner! Ok, I maybe will.
with triggers you can constantly start at the CC, get all next buildings, power them (add behaviour, remove from unit group of all buildings of player) then get all buildings next to these buildungs and so on, when the alogrithm is finished, unpower al remaining buildings in the unit group.
each time a unit is destroyed you have to run this algo.
if you ask for a data only solution, i cannot think of one for now.
It's fine with triggers, but could you tell me the method in a bit more detail. I think the way I did it is very inefficient and buggy.
NOTE: The CC is not pre-placed, it is created when the player enters the game (its a start location building [I have no idea what the official name of these buildings are])
you said everything already works until a building gets destroyed. now this is our event where we start. now create an action called StartLink. StartLink adds all buildings into a global unitgroup variable and then calls a new action called UnitLink which takes a unit as parameter. You call this action with the command center. within unitlink you check if the unit is in the global unitgroup, if no do nothing, if yes remove the unit from the unigroup, add power behaviour and call unitlink with all units close to the unit, thats it.
Hi, I'm creating a little arcade/custom mod in which one of the race has a Command Center, and can only build from it, but it can only build right next to itself. The created structure can also only create a structure right beside itself, and so on. This mechanic is already implemented (although its a little goofy). The problem is, I need those buildings to create a continuous line, a Power Supply line.
I created a search area + apply behavior effect, and Morph skills, so when building has behavior false, building morphs into an Inactive state, and when the behavior is applied, it transforms back. The first Behavior comes from the CC, and: if caster unit has the behavior-> it can cast the skill. The problem is, when I severe the power line's connection with the CC (removing 1 building from the line), the power supply keeps itself on, since the can apply the behavior to each other.
I have no idea how to solve this. Is there a validator that effect can not be applied to creator of unit? Or what could I possibly do? No, I won't accept defeat and cry in the corner! Ok, I maybe will.
with triggers you can constantly start at the CC, get all next buildings, power them (add behaviour, remove from unit group of all buildings of player) then get all buildings next to these buildungs and so on, when the alogrithm is finished, unpower al remaining buildings in the unit group.
each time a unit is destroyed you have to run this algo. if you ask for a data only solution, i cannot think of one for now.
@FunkyUserName: Go
It's fine with triggers, but could you tell me the method in a bit more detail. I think the way I did it is very inefficient and buggy.
NOTE: The CC is not pre-placed, it is created when the player enters the game (its a start location building [I have no idea what the official name of these buildings are])
The community project made a power line system a while ago. It is under my data assets if it still works.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
@dragozal: Go
you said everything already works until a building gets destroyed. now this is our event where we start. now create an action called StartLink. StartLink adds all buildings into a global unitgroup variable and then calls a new action called UnitLink which takes a unit as parameter. You call this action with the command center. within unitlink you check if the unit is in the global unitgroup, if no do nothing, if yes remove the unit from the unigroup, add power behaviour and call unitlink with all units close to the unit, thats it.
Event -> StartLink -> UnitLink (CC) -> UnitLink (a), UnitLink (b) ...
Thank you very much for the responses, I'll try to figure it out using the data you provided :D Thank you very very much!