I'm relatively new to the data editor (though I do have a decent knowledge of triggers and programming, so the concepts aren't all that alien to me).
I need help creating the following weapon:
A weapon which fires a beam at a target. The beam stays on the target dealing damage to it while it stays on it. Once a target is killed it moves to the next (closest by angle) target without stopping to shoot in between. It only stops shooting once it has run out of targets.
[optional] If a unit has more than one of these weapons the weapon will prefer targets the unit is not already shooting at with this weapon type. (but if another weapon type already fires at the target that's ok)
I'm currently trying to make a weapon launch a missile from the old target - if it dies or you switch targets - to the new weapon target. Then all you have to do is give this missile a Buff that causes AoE damage ("sweeping motion" of the beam), and set up your beam actor to reattach to the missile if the old target becomes invalid (dead/target switch), and then latch on to the new target once the missile arrives.
This will cause the beam to sweep and home in on targets, but I'm struggling with the missile launch system.
(self-advertising) The "Dummy Persistent" system from my topic could be useful for applying checks/beam damage (It works like a channeled effect, without the channeling) (/self-advertising)
Your way of doing it sounds rather complex. Isn't there a way with validators which validate a line between the old and the new target and the beam attaches to incremental points along this line?
I'd prefer not to use missiles for a beam. That's somehow weird (I know it's only terminology but nevertheless )
Btw - how do the colossi lances sweep over the ground in front of it? Maybe we can take some of that logic for our purposes ^^
SC2 only supports circle-sector AoE fields. The "line" between the targets "doesn't exist" for the game either. The beam also has to home in on a moving enemy, so you won't get a straight line anyway, unless your beam sweeps really really fast.
The Collossus is a cheat. The damage is applied via 4? circular AoE fields with a set offset from the initial target, the instant the attack is launched. The "sweeping" motion is purely graphical, and is done via actors. The length of the "line" is constant, which isn't the case for our weapon.
Basically the beam impact site moves from one of these circles to the next (center to center), like a unit ordered to shift-move along 4 points in a straight line while under attack from a Voidray.
I got the idea from the Colossus attack, but I will replace the launch site actor with a missile, and instead of periodically displaying orange flares it will actually burn stuff.
I've attached my current, unfinished map for you to test/play around with. So far it works when left to itself, but there are many loopholes (e.g. switching targets while the missile is in mid-flight, moving out of range, multiple weapons on 1 unit...) I haven't added any graphics yet either.
Try and come up with many possible loopholes/extraordinary situations to test this mechanism, as eliminating them will be most of the work.
Well, I got the basic framework going now. It screws up if you switch targets while the beam is "sweeping", and my intended method of applying the burn AoE will only work with slow sweeping speeds: Let's say the beam/missile moves at a speed of 5 (Phoenix is 4.25). That means it will cover a distance of 1 unit (=0.5 AoE radius) in 0.2 seconds. Which is the maximum phase/period of the AoE search effect. The absolute minimum AoE radius would be [beam speed]/32, which is 0.15 for a speed of 5.
I don't have graphics yet, but you can see how the missile (a Marine) goes from your old target to the new one when you switch.
Try to find as many loopholes as possible, so we can eliminate them!
And if you can find a proper explanation of all point references (Caster, Target, Source, Outer, Inner...) I'd be very grateful, as I spent most of the time trying to figure out why all my effects list the attacking Marine as "Source" unit (the Mutalisk also uses the Source reference when firing the bounce missiles from previous targets); I still don't know, but I found a setup that works.
Multiple instances on 1 unit might get hard to implement too, unless I can entirely seperate the instances via Markers.
I'll probably upload another update today/tomorrow, hopefully with graphics ;)
Completed version! Now includes beam graphics, periodic "burn" damage around the "sweeping" beam, and mid-flight retargeting!
Also changed weapon target preference to "closest to target", this should optimise total damage dealt (assuming the on-target beam is stronger than the sweeping, which it curently isn't) There also is an "angle" setting, but I'd prefer the distance one, as the limiting factor here is sweeping speed/distance, not caster rotation.
The main beam damage is currently done with my "quasi-channeling" mechanism, meaning the unit fires normally but my system mimics a channeled effect for the beam setup and beam actors. Gameplay-wise the main consequence is that the main beam damage is affected by cooldown reductions (e.g. Stimpack), a major drawback is that the current beam mechanism requires a very low weapon cooldown to function properly due to this system. I might switch back to regular channeling, if that works with attacking/target switching validators.
Edit:range check scrapped, seemed superfluous and caused the game to crash.
One slight flaw is that currently the sweeping beam vanishes upon missile impact, while the on-target beam is only reformed with the next regular weapon attack after that. Edit: I re-added birth animations for the on-target beams, played on every lock-on. Looks slightly better than the random flickering.
The impact graphics aren't synchronised with the beam either, mainly because the beam goes to the feet of the unit (this is because the sweeping missile is launched from there)
Edit: multi-instance crash was caused by buggy range check. 3-Marine a-move works fine now.
Feel free to experiment with the mechanism (all custom files are still tagged as "MODIFIED", use the editor search), and if you think it's ready for use feel free to include it in your map (but give credit ofc)
And of course if you come up with an improvement post it here :)
I'll try it out as soon as I can (its almost 23:30 around here...) and tell you if I found a way around the crash. (sometimes crossing streams is the only way... )
Thanks for sharing your work - I'll of course give you credits for it - if I use any part of it.
Unfortunately I intended this behaviour for a default secondary weapon for all my space ships... so I'll have to adapt your work anyway. but it's nice to see it works!
Spaceships? That will look very weird when they're targeting eachother, as the beam ends at the missile location. I doubt a skyward beam is possible without custom graphics.
I changed the beam actor system to not launch from the ground below a flying unit, but the beam still explodes/burns in mid-air.
For making it a secondary weapon I mainly need 1 thing: a working substitute Validator for "X attacking Y", as the original is tied to the "Attack" ability. I've tried with "Caster firing weapon" (these validators are still in this version of the map, but unused), but that only caused the game to crash the moment the weapon fired.
Do you know an ability that continues to cast while the caster is moving? For the record even the Voidray (the only channel-while-moving unit/weapon I know) only sporadically aquires new targets while moving. I didn't see any difference between the default settings and 0 cooldown+360° firing arc either.
Anyway, this version mostly makes the beam look less stupid vs air units.