Hi, i'm working on an energy transfer system for my map and i'm having some trouble decreasing the energy on one of my structures appropriately.
Here's how it works:
Energy transfers from [Generator] to [Pylon] at 3 per energy second
Energy then transfers to 3 nearby [Cannons] from the [Pylon]
This means that the Pylon will receive 3 energy per second, and lose 3 energy per second, which is fine should I just "hardcode" in that 3 energy is lost every second from the Pylon.
However, if there are only 2 cannons available to receieve energy from the pylon, then the pylon should only lose 2 energy per second, not 3.
The question I have is: Is there a way to track how many times an effect is being applied (via a search area originating from the Pylon) to [Cannon]'s and apply another effect that number of times to the [Pylon]?
I'm a little confused as to what it is you want exactly so I'm taking a bit of a stab here.
Sounds like you want the Pylon to transfer 1 energy per second to each cannon within its range.
This is easy peasy, so long as that is what you want.
You need a search, that I imagine you already have, which finds the cannons only, and the effect which that search applies should be a Set.
Within this set there needs to be 1 effect I would use a modify unit, that gives 1 energy to Target Unit, and then another Modify Unit effect which removes one Energy from Source Unit. This way every time the search finds a target ( on of your cannons) it will give the cannons 1 energy and remove 1 energy from the Pylon.
I would have this search in the periodic field of a behavior that is pre-placed on the pylon.
Then you need a validator to put on the Set, that validates Source Energy GTE1 that way the pylon cannot transfer any more energy than what it has, so if it has 2 energy when the search goes off instead of taking 1 energy from pylon and giving it to cannon 3 times it will only be able to happen twice and the third cannon is SOL ( shiza outa luck )
You also want a validator on the behavior that disables it when the Pylon is out of energy that way you dont have pylons needlessly producing an effect every 1 second, only when the Pylon has energy will the behavior be active and the effect be produced. You can use the exact same Source Energy GTE1 Validator here, so that when Source Energy GTE1 returns false i.e pylon has less than 1 energy the Behavior will be disabled.
I dunno what your skill lvl is with the data editor so if this is too simple or too complicated I'm sorry 8) like I said just taking a stab at what I think you want.
I'd use a Create Healer too. But from waht you said I guess you are trying to remove energy from the Pylon and trying to detect the number of cannons in order to define how much energy is removed.
I'd use a Create Healer too. But from waht you said I guess you are trying to remove energy from the Pylon and trying to detect the number of cannons in order to define how much energy is removed.
Exactly this. Using Modify units. Sorry if I was unclear.
Just going to try what Dryeyece said now and i'll see if it fixes the problem. Last time I tried to use create healers, all sorts of hell broke loose. But if this doesnt work, i'll look into it I guess.
It worked! Thanks everyone for the help! Just needed a fresh look on it it seems. Really appreciate all the help. :)
Hi, i'm working on an energy transfer system for my map and i'm having some trouble decreasing the energy on one of my structures appropriately.
Here's how it works:
Energy transfers from [Generator] to [Pylon] at 3 per energy second Energy then transfers to 3 nearby [Cannons] from the [Pylon]
This means that the Pylon will receive 3 energy per second, and lose 3 energy per second, which is fine should I just "hardcode" in that 3 energy is lost every second from the Pylon.
However, if there are only 2 cannons available to receieve energy from the pylon, then the pylon should only lose 2 energy per second, not 3.
The question I have is: Is there a way to track how many times an effect is being applied (via a search area originating from the Pylon) to [Cannon]'s and apply another effect that number of times to the [Pylon]?
I'm a little confused as to what it is you want exactly so I'm taking a bit of a stab here.
Sounds like you want the Pylon to transfer 1 energy per second to each cannon within its range.
This is easy peasy, so long as that is what you want.
You need a search, that I imagine you already have, which finds the cannons only, and the effect which that search applies should be a Set. Within this set there needs to be 1 effect I would use a modify unit, that gives 1 energy to Target Unit, and then another Modify Unit effect which removes one Energy from Source Unit. This way every time the search finds a target ( on of your cannons) it will give the cannons 1 energy and remove 1 energy from the Pylon.
I would have this search in the periodic field of a behavior that is pre-placed on the pylon.
Then you need a validator to put on the Set, that validates Source Energy GTE1 that way the pylon cannot transfer any more energy than what it has, so if it has 2 energy when the search goes off instead of taking 1 energy from pylon and giving it to cannon 3 times it will only be able to happen twice and the third cannon is SOL ( shiza outa luck )
You also want a validator on the behavior that disables it when the Pylon is out of energy that way you dont have pylons needlessly producing an effect every 1 second, only when the Pylon has energy will the behavior be active and the effect be produced. You can use the exact same Source Energy GTE1 Validator here, so that when Source Energy GTE1 returns false i.e pylon has less than 1 energy the Behavior will be disabled.
I dunno what your skill lvl is with the data editor so if this is too simple or too complicated I'm sorry 8) like I said just taking a stab at what I think you want.
How are you doing the transfers? Using a Create Healer or Modify Unit effects?
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
I'd use a Create Healer too. But from waht you said I guess you are trying to remove energy from the Pylon and trying to detect the number of cannons in order to define how much energy is removed.
Exactly this. Using Modify units. Sorry if I was unclear.
Just going to try what Dryeyece said now and i'll see if it fixes the problem. Last time I tried to use create healers, all sorts of hell broke loose. But if this doesnt work, i'll look into it I guess.
It worked! Thanks everyone for the help! Just needed a fresh look on it it seems. Really appreciate all the help. :)