Ultimately I want to make the Marine's Gauss Rifle create a continuous beam when used.
For this I currently have:
Weapon: now creates Set Effect instead of damage
New Set Effect: contains the damage effect and a new Persistent Effect, places 1 "Match - Casting Unit" Marker
New Persistent Effect: phase/period of 0.1, marked as "continuous until destruction", location is Target Unit, start offset is Caster Unit, custom 1or0mark Validator, periodic Combine Validator
1or0mark Validator: copy of "No Markers" Validator, set to count=<1
Combine Validator: includes the 1or0mark Validator and a custom CasterAttackingTarget one.
CasterAttackingTarget: like the existing TargetAttackingCaster, just the other way round.
Marine-Attack Actor: standard attack actor
Copy of SentryAttackBeam: start and impact attach method SOpAttachCenter, start host "Actor Search, Source, _Unit alias", impact host "Actor Search, Target, _Unit alias" - Event+ field set up to create/destroy it alongside the above Persistent Effect, and to play the relevant model animations. I'm currently using the Hybrid-Graviton Prison beam, as that allows easy tracking of stacked actors.
This mostly works just fine: My Marine fires as normal and the beam appears and disappears as it should. Using the "inital" and "final" effect fields on the Persistent Effect I was able to confirm that it, too, is active on the target of the Marine (with 1 stack only), and immediately ends when I switch targets.
Now here's the problem: When I switch targets, and then switch back, the persistant effect doesn't respawn, so the beam doesn't either. I believe this is because my Marker remains on the target even after all effects have vanished, which to my knowledge it shouldn't. This is what I'd like to solve. From this topic I gathered a "Mismatch-Casting Unit" Marker should do it, but so far it hasn't. I created a new dummy effect to place the Mismatch Marker with a similar chain of effects as the demo map from that topic, and I've tried placing the marker on my damage effect. Usually this would cause the Persistant Effect to stack infinitely while the Weapon shoots one target (try it with a cooldown of 0.1, you quickly get a solid column instead of the faint beam)
And for those of you asking why I don't just copy the Sentry Weapon: Stimpack. The Sentry doesn't benefit from cooldown reduction, as its damage rate is the phase/period of the persistent effect and not of the weapon. And with custom Validators I can tie the beam to other unit actions too, while the Sentry must stand still and channel.
Thanks in advance!
Edit: OK this is weird. I made a test map following my own instructions, and it works perfectly!? You can switch targets between the two Nydus Worms and the beam vanishes instantly. I must have messed up in the other map somehow.
If anyone is interested you can test it, and if you find bugs/errors please tell me.
Should I post this as a "lazy man's continuous beams" tutorial?
I would use a switch to check for stimpack and still go for the sentry weapon route. Seems to be the easiest solution for me.
For your way, you could try adding a specific Destroy Persistent effect to make sure, your persistent gets destroyed when retargeting. This way, remaining markers should be removed.
What's a "switch"? Is it an actual object type or do you mean a Buff/Validator/Effect setup?
Anyway it won't work since I want this to work on hero units, who gain cooldown reduction from attributes, items etc. I simplified it to the Marine to get that working first.
I can't get the Destroy Persistent to work correctly either. I've managed to make it kill the Persistent Effect on the new target when retargeting, but despite that the marker remained: Shoot one target->works normally, switch targets->both beams/Effects shut down, retarget either unit->no more beam, no more Effect, same as before.
The Persistent Effect shuts off perfectly btw, it's only the marker (originating from the Set Effect or the Weapon itself, both seem to work) that causes problems. Looks like a Destroy Persistent won't work.
I've tried recreating what you've described up there, but I seem to be unable to duplicate your results. As far as I can tell, the marker gets removed perfectly fine when following your recipe. It looks funky though, having the beam being created and destroyed many times a second. If we could have a look at a test map it might be easier to help out with details.
Update: I also got it to work with multi-hit attacks, and eliminated some unnecessary bits!
Here's the new setup:
Weapon: triggers Set effect
Set: applies damage/multiattack and Persistent Dummy (it seems to work better if the damage is above the Dummy in the list) and applies 1 "Match - Casting Unit" Marker. Apparently this means 1 per damage effect in the entire chain of effects.
Persistent Dummy: still continuous until destruction, location at Target Unit, start location offset at Caster Unit, phase/period of 0.1. Validators reduced to AttackMarkCount (formerly 1or0mark) and periodic CasterAttackingTarget (formerly Combine)
AttackMarkCount is a marker count that has to be set to (=<) the number of damage effects triggered by 1 full chain of effects. For a standard weapon this is count=<1; for 2-hit attacks (Phoenix) it would be count=<2; for the Leviathan tentacles count=<4 etc.
CasterAttackingTarget is the same logic check as in the first post, but I removed the mark count from the periodic validation.
Multiattack allows you to apply multiple damage effects. It's a persistent effect with phase/period 0 and a phase count equal to your desired number of attacks, which are defined via its periodic effect. Location set to target unit. Multiple attacks increase the significance of linear damage boosts/reductions (upgrades and armor mainly)
The damage effect is the same as ever.
Beam Actor:
Host Launch Site properties set to SOpAttachCenter, this controls the attachment point of the beam on the caster
Host Impact Site properties also set to SOpAttachCenter, this is for the impact point.
Host-Launch set to "Actor Search; Caster; _Unit alias", this attaches the actor to the caster unit of the persistent effect
Host-Impact set to "Actor Search; Target; _Unit alias", this attaches the other end of the beam to the target unit
The beam effect should work independently of any weapon effects, as long as you keep track of the number of damage effects (and said number isn't randomised at some point)
The attached map gives the Marine a 5-hit multiattack, and creates/destroys the beam as intended.
Ultimately I want to make the Marine's Gauss Rifle create a continuous beam when used. For this I currently have:
Weapon: now creates Set Effect instead of damage
New Set Effect: contains the damage effect and a new Persistent Effect, places 1 "Match - Casting Unit" Marker
New Persistent Effect: phase/period of 0.1, marked as "continuous until destruction", location is Target Unit, start offset is Caster Unit, custom 1or0mark Validator, periodic Combine Validator
1or0mark Validator: copy of "No Markers" Validator, set to count=<1
Combine Validator: includes the 1or0mark Validator and a custom CasterAttackingTarget one.
CasterAttackingTarget: like the existing TargetAttackingCaster, just the other way round.
Marine-Attack Actor: standard attack actor
Copy of SentryAttackBeam: start and impact attach method SOpAttachCenter, start host "Actor Search, Source, _Unit alias", impact host "Actor Search, Target, _Unit alias" - Event+ field set up to create/destroy it alongside the above Persistent Effect, and to play the relevant model animations. I'm currently using the Hybrid-Graviton Prison beam, as that allows easy tracking of stacked actors.
This mostly works just fine: My Marine fires as normal and the beam appears and disappears as it should. Using the "inital" and "final" effect fields on the Persistent Effect I was able to confirm that it, too, is active on the target of the Marine (with 1 stack only), and immediately ends when I switch targets.
Now here's the problem: When I switch targets, and then switch back, the persistant effect doesn't respawn, so the beam doesn't either. I believe this is because my Marker remains on the target even after all effects have vanished, which to my knowledge it shouldn't. This is what I'd like to solve. From this topic I gathered a "Mismatch-Casting Unit" Marker should do it, but so far it hasn't. I created a new dummy effect to place the Mismatch Marker with a similar chain of effects as the demo map from that topic, and I've tried placing the marker on my damage effect. Usually this would cause the Persistant Effect to stack infinitely while the Weapon shoots one target (try it with a cooldown of 0.1, you quickly get a solid column instead of the faint beam)
And for those of you asking why I don't just copy the Sentry Weapon: Stimpack. The Sentry doesn't benefit from cooldown reduction, as its damage rate is the phase/period of the persistent effect and not of the weapon. And with custom Validators I can tie the beam to other unit actions too, while the Sentry must stand still and channel.
Thanks in advance!
Edit: OK this is weird. I made a test map following my own instructions, and it works perfectly!? You can switch targets between the two Nydus Worms and the beam vanishes instantly. I must have messed up in the other map somehow. If anyone is interested you can test it, and if you find bugs/errors please tell me.
Should I post this as a "lazy man's continuous beams" tutorial?
I would use a switch to check for stimpack and still go for the sentry weapon route. Seems to be the easiest solution for me.
For your way, you could try adding a specific Destroy Persistent effect to make sure, your persistent gets destroyed when retargeting. This way, remaining markers should be removed.
What's a "switch"? Is it an actual object type or do you mean a Buff/Validator/Effect setup? Anyway it won't work since I want this to work on hero units, who gain cooldown reduction from attributes, items etc. I simplified it to the Marine to get that working first.
I can't get the Destroy Persistent to work correctly either. I've managed to make it kill the Persistent Effect on the new target when retargeting, but despite that the marker remained: Shoot one target->works normally, switch targets->both beams/Effects shut down, retarget either unit->no more beam, no more Effect, same as before.
The Persistent Effect shuts off perfectly btw, it's only the marker (originating from the Set Effect or the Weapon itself, both seem to work) that causes problems. Looks like a Destroy Persistent won't work.
@Photoloss: Go
I've tried recreating what you've described up there, but I seem to be unable to duplicate your results. As far as I can tell, the marker gets removed perfectly fine when following your recipe. It looks funky though, having the beam being created and destroyed many times a second. If we could have a look at a test map it might be easier to help out with details.
Update: I also got it to work with multi-hit attacks, and eliminated some unnecessary bits! Here's the new setup:
Beam Actor:
The beam effect should work independently of any weapon effects, as long as you keep track of the number of damage effects (and said number isn't randomised at some point)
The attached map gives the Marine a 5-hit multiattack, and creates/destroys the beam as intended.
Good job
Looks like you solved it :)