I'm trying to make a channeled ability that grants its target "fuel" buff stacks.
For context, in the map I'm working on, "fuel" is consumed at the rate of roughly 1 per second while a unit is moving, and when it is depleted the unit is no longer able to move. There is another type of unit on the map that will have this ability, and will serve as a "resupply" unit which seeks out units that have low fuel or other supplies and replenishes them.
I don't think I can directly modify the Medivac's Heal ability, as that uses a Create Healer effect which only restores life/energy/shields. So, perhaps I could make a periodic effect that grants the fuel buff and is validated in such a way to prove the caster of the effect is still channeling it. Is this practical? Is there a better way to go about it?
Sorry about posting these abstract questions, but they really do help me understand how things work with the editor.
You're looking for a Create Persistent effect, with a periodic effect of Apply Behavior to stack your buff.
The Create Persistent has options for Channeled and Channeling under Flags+.
Also, be sure to set up the ability to have a Cast Finish Time, which tells the casting unit how long to channel; the ability's UI: Show Progress+ field will let you show a cast bar while it's being channeled.
From the sounds of it, your map will involve a lot of units using this fuel mechanic, so a word of warning; lots of units with large stacks of behaviours has been observed to cause performance issues.
Your easiest method would be to use Shields or Energy to represent Fuel. This obviously limits your units to only having Life/Shields or Life/Energy.
Another option would be to use a Data / Trigger hybrid system.
You have your basic 'refuel ability' which is channeled, and say adds +5 fuel each second to a unit.
Each time this effect is triggered you call a function that modifies the refueled unit's Custom Value 0 by +5.
Each fuel-using unit will need a behaviour that runs an effect, periodically every second, validated by if the unit is moving (movespeed greater than 0).
And then, each time this periodic effect is run, another function will subtract -1 from the Units' Custom Value 0.
If a unit's Custom Value == 0, disable the 'Move' ability for that unit. A Dummy Cargo ability can be used to 'show' the units' fuel reserves, albeit with not a great level of accuracy.
The more complicated version can be achieved using purely data methods. Your Refuel ability applies a behaviour called Fuel(1) that stacks 9 times. When this Fuel(1) is stacked 9 times and is applied once more, all stacks of Fuel(1) are removed and a behaviour called Fuel(10) is applied. This repeats, so you'd have Fuel(20), Fuel(30), Fuel(40) and so on and so forth.
Large numbers of units aren't really a problem, or at least haven't appeared to be in my testing. The highest number of stacks of the buff a unit gets is 100, although there are similar buffs for Ammunition and some other things which can also reach similar numbers. There are rarely more than 30-odd units on the map though and I haven't seen much lag when there are, but I'll keep your post in mind if issues do start to appear, so thanks!
Using combined fuel stack buffs is a very good idea, too, and wouldn't be too difficult. Thanks for that as well!
I'm working on the Create Persistant effect right now. There are two validator fields (Effect: Periodic Validator and Effect: Validator); what are the differences between them? I figure one validates the caster of the effect and the other validates the existence of the effect itself, but I'm not sure.
Also, is there a way to set period count to an infinite value so that the Effect persists until removed by a validator? It won't let me set it to -1!
I'm working on the Create Persistant effect right now. There are two validator fields (Effect: Periodic Validator and Effect: Validator); what are the differences between them? I figure one validates the caster of the effect and the other validates the existence of the effect itself, but I'm not sure.
The Validator field checks once, when starting the effect; the Periodic Validator checks on every tick.
Quote:
Also, is there a way to set period count to an infinite value so that the Effect persists until removed by a validator? It won't let me set it to -1!
From the sounds of it, your map will involve a lot of units using this fuel mechanic, so a word of warning; lots of units with large stacks of behaviours has been observed to cause performance issues.
That's simply false. SotIS uses thousands of behaviours on 10 heroes and doesn't lag at all.
What lags is large stacks of behaviours with attached effects, which will cause lag because the game will treat each behaviour as a unique entity, even if the host unit has thousands of stacks. You can see why this would lag, and this very likely isn't what the OP is doing.
I used an Effect - Target ability. Under the ability's Effect: Effect field, I made a Create Persistant effect.
For the Create Persistant Effect: Flags field, I checked the flags Channelled, Channelling, and Persist Until Destroyed. I gave it a periodic duration of 0.1 and a periodic effect that granted the fuel buffs which validated itself based on when the buff can or can't be given (at max capacity, for example). The Effect: Periodic Validator field has a validator that continuously checks if the Create Persistant Effect should be destroyed (the caster stopped channelling; the unit no longer needs fuel or is hidden), and the Effect: Validators field has validators that check that the target is appropriate (the unit needs fuel; the unit isn't already recieving fuel from another unit; the unit isn't hidden).
I hope this helps anyone who is working on something similar! If you want to be able to add multiple types of buffs with the ability, change the effect in the periodic effect field to a Set effect that combines each buff-granting effect.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm trying to make a channeled ability that grants its target "fuel" buff stacks.
For context, in the map I'm working on, "fuel" is consumed at the rate of roughly 1 per second while a unit is moving, and when it is depleted the unit is no longer able to move. There is another type of unit on the map that will have this ability, and will serve as a "resupply" unit which seeks out units that have low fuel or other supplies and replenishes them.
I don't think I can directly modify the Medivac's Heal ability, as that uses a Create Healer effect which only restores life/energy/shields. So, perhaps I could make a periodic effect that grants the fuel buff and is validated in such a way to prove the caster of the effect is still channeling it. Is this practical? Is there a better way to go about it?
Sorry about posting these abstract questions, but they really do help me understand how things work with the editor.
@LaurenI: Go
You're looking for a Create Persistent effect, with a periodic effect of Apply Behavior to stack your buff.
The Create Persistent has options for Channeled and Channeling under Flags+.
Also, be sure to set up the ability to have a Cast Finish Time, which tells the casting unit how long to channel; the ability's UI: Show Progress+ field will let you show a cast bar while it's being channeled.
Just use a Battery ability and a buff which uses a Search Area effect that applies an Issue Order effect.
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
From the sounds of it, your map will involve a lot of units using this fuel mechanic, so a word of warning; lots of units with large stacks of behaviours has been observed to cause performance issues.
Your easiest method would be to use Shields or Energy to represent Fuel. This obviously limits your units to only having Life/Shields or Life/Energy.
Another option would be to use a Data / Trigger hybrid system.
You have your basic 'refuel ability' which is channeled, and say adds +5 fuel each second to a unit.
Each time this effect is triggered you call a function that modifies the refueled unit's Custom Value 0 by +5.
Each fuel-using unit will need a behaviour that runs an effect, periodically every second, validated by if the unit is moving (movespeed greater than 0).
And then, each time this periodic effect is run, another function will subtract -1 from the Units' Custom Value 0.
If a unit's Custom Value == 0, disable the 'Move' ability for that unit. A Dummy Cargo ability can be used to 'show' the units' fuel reserves, albeit with not a great level of accuracy.
The more complicated version can be achieved using purely data methods. Your Refuel ability applies a behaviour called Fuel(1) that stacks 9 times. When this Fuel(1) is stacked 9 times and is applied once more, all stacks of Fuel(1) are removed and a behaviour called Fuel(10) is applied. This repeats, so you'd have Fuel(20), Fuel(30), Fuel(40) and so on and so forth.
Large numbers of units aren't really a problem, or at least haven't appeared to be in my testing. The highest number of stacks of the buff a unit gets is 100, although there are similar buffs for Ammunition and some other things which can also reach similar numbers. There are rarely more than 30-odd units on the map though and I haven't seen much lag when there are, but I'll keep your post in mind if issues do start to appear, so thanks!
Using combined fuel stack buffs is a very good idea, too, and wouldn't be too difficult. Thanks for that as well!
I'm working on the Create Persistant effect right now. There are two validator fields (Effect: Periodic Validator and Effect: Validator); what are the differences between them? I figure one validates the caster of the effect and the other validates the existence of the effect itself, but I'm not sure.
Also, is there a way to set period count to an infinite value so that the Effect persists until removed by a validator? It won't let me set it to -1!
The Validator field checks once, when starting the effect; the Periodic Validator checks on every tick.
Flags -> check Persist Until Destroyed
That's simply false. SotIS uses thousands of behaviours on 10 heroes and doesn't lag at all.
What lags is large stacks of behaviours with attached effects, which will cause lag because the game will treat each behaviour as a unique entity, even if the host unit has thousands of stacks. You can see why this would lag, and this very likely isn't what the OP is doing.
Thanks to your help, I got it working!
I used an Effect - Target ability. Under the ability's Effect: Effect field, I made a Create Persistant effect.
For the Create Persistant Effect: Flags field, I checked the flags Channelled, Channelling, and Persist Until Destroyed. I gave it a periodic duration of 0.1 and a periodic effect that granted the fuel buffs which validated itself based on when the buff can or can't be given (at max capacity, for example). The Effect: Periodic Validator field has a validator that continuously checks if the Create Persistant Effect should be destroyed (the caster stopped channelling; the unit no longer needs fuel or is hidden), and the Effect: Validators field has validators that check that the target is appropriate (the unit needs fuel; the unit isn't already recieving fuel from another unit; the unit isn't hidden).
I hope this helps anyone who is working on something similar! If you want to be able to add multiple types of buffs with the ability, change the effect in the periodic effect field to a Set effect that combines each buff-granting effect.