Create a Power User behaviour that has the Level From Source Count flag enabled. Set it that it disables your Buff behaviour when the level is 0 or 2. Give both behaviours to your unit. This way when there is no power the buff is disabled, with a single source it is level 1 and enabled and with more than a single power source it will be level 2 and disabled again.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
a problem is that it says "unpowered" ingame at units who receives the Power User buff (Near the Armor/Damage icons), which will likely appear confusing for players. "What? Why is my unit unpowered? LOOL"
My initial solution was like this:
The Pylon has a search effect that periodically checks for nearby units and adds a buff to them. That buff has a maximum stack count of 2. It also has a Unit Compare Behavior Count validator that checks if there are 2 buffs at the same unit at the same time. If so, the buffs are removed/disabled.
In this way, a unit can receive a buff when close to a power field, but if it is standing inside two power fields, the buff gets disabled. The buff lasts maybe 0,5 seconds or something, so if the unit walks out a power field then it is disabled due to the duration.
I thought this would work, but it does not... Any ideas on how to make it work in this manner?
Yep, the buff that is added to units from Pylons have the field "Maxmium Stack Count Per Caster" set to 1 and the field "Maxmium Stack Count" set to 2.
I have the Unit Compare Behavior Count validator set to equal 1. That validator is added to the buff that is added to units from the Pylon. (I have tested the validator in the disable and in the remove field)
Edit: Ha! I found a solution! I made the Pylon add both the REAL buff to units AND a dummy buff to units... The real buff has a validator that checks how many dummy buffs are on the unit... If there are 2 dummy buffs, the real buff is removed... Seems to work fine now : D
We can use the Pylon as an example:
If a unit stands near 1 Pylon power field, that unit receives a buff.
If a unit stands near 2 or more Pylon power fields, that unit receives NO buff.
So if there are many Pylons packed together, they give no buffs. Only Pylons that stand alone give buffs.
I can not get this to work. >.<
Is it even possible to make?
Create a Power User behaviour that has the Level From Source Count flag enabled. Set it that it disables your Buff behaviour when the level is 0 or 2. Give both behaviours to your unit. This way when there is no power the buff is disabled, with a single source it is level 1 and enabled and with more than a single power source it will be level 2 and disabled again.
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
Thanks for your suggestion Doctor,
a problem is that it says "unpowered" ingame at units who receives the Power User buff (Near the Armor/Damage icons), which will likely appear confusing for players. "What? Why is my unit unpowered? LOOL"
My initial solution was like this:
The Pylon has a search effect that periodically checks for nearby units and adds a buff to them. That buff has a maximum stack count of 2. It also has a Unit Compare Behavior Count validator that checks if there are 2 buffs at the same unit at the same time. If so, the buffs are removed/disabled.
In this way, a unit can receive a buff when close to a power field, but if it is standing inside two power fields, the buff gets disabled. The buff lasts maybe 0,5 seconds or something, so if the unit walks out a power field then it is disabled due to the duration.
I thought this would work, but it does not... Any ideas on how to make it work in this manner?
So you are limiting the buff stack to 1 per caster? You would need the Unit Compare Behaviour Count validator to equal 1.
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
Yep, the buff that is added to units from Pylons have the field "Maxmium Stack Count Per Caster" set to 1 and the field "Maxmium Stack Count" set to 2.
I have the Unit Compare Behavior Count validator set to equal 1. That validator is added to the buff that is added to units from the Pylon. (I have tested the validator in the disable and in the remove field)
Edit: Ha! I found a solution! I made the Pylon add both the REAL buff to units AND a dummy buff to units... The real buff has a validator that checks how many dummy buffs are on the unit... If there are 2 dummy buffs, the real buff is removed... Seems to work fine now : D
Thanks for the help!