I've seen people asking for help with missiles that continue in a certain direction until they come into contact with a wall or unit. Please note that this is NOT a traceline guide. There are many of those about already, or you can look at one of the many Third Person Shooter systems littered about.
I expect you to have some basic understanding of effect types and a bit of experience already with the data editor.
If you want an invisible or beam-based effect, read on.
I will be running through a demonstration, but will sum up the theory behind the whole thing afterwards. You may name your buffs/effects/etc; whatever you wish as you follow along.
We will be using three Data Types: Effect, Validator, and Behavior. Others may be used to actually assign the finished product to an ability or weapon, but I won't be covering that, since it's unique to each person's final intentions.
There are two methods of doing this. The first one I'll cover is much more time consuming to set up, but is incredibly accurate. The second (scroll to the bottom of the post) is ideal for longer range abilities and requires minimal effort to create, but lacks the precision of the first.
The Primary Method
Step 1: Behavior Tab
Switch over to the Behavior Tab.
Add an object named Contact with type: Buff
Set Flags to: Hidden
You can leave the rest default. This buff is completely invisible and really just allows us to create our validator.
Step 2: Validator Tab
Switch over to the Validator tab.
Add an object named Contact Val with type: Unit Compare Behavior Count
Set Behavior to: Contact (our buff)
Set Compare to: Equal to
Set Unit+ to: Source
Set Value to: 0
This Validator prevents our caster from continuing once his shot has come into contact with a unit, wall, etc;
Step 3: Effects Tab
Yep, you guessed it. It's time to wander over to the Effects tab. We actually won't need the other two again, so you can close them if you wish. This is going to take a little while...
With Effects, I always like to get a good idea of what I hope to achieve and then work backwards. That way, everything links correctly and you don't need to revisit anything.
Add object named Shoot (Damage) with Type: Damage
Set Amount to: Whatever damage you want
Set Response Flags and Notify Effects: to what suits your ability best
Set Kind to: Again, whatever suits your ability best. You probably want Ranged
I don't think the damage effect needs much explanation...if you want to add an AoE effect upon impact, do it via the Area+ field in this effect.
Add object named Shoot (Buff) with Type: Apply Behavior
Set Behavior Count to: 1
Set Behavior to: Contact (our buff)
Set Unit+ to: Source
This is what will add the buff to our caster if the attack hits an object.
Add object named Shoot (Set) with Type: Set
Set Effects to: Shoot (Buff), Shoot (Damage)
That one's fairly simple. Sets are really just a way of using multiple effects at once.
Add object to named Shoot (Remove Buff) with Type: Remove Behavior
Set Behaviors to: Contact (our buff)
Set Unit+ to: Source
Add object named Shoot (Search Area) with Type: Search Area
Set Areas+ to:
Arc: 360
Effect: Shoot (Set)
Maximum Count: 1
Radius: This is really up to you. The farther you want the missile to go before timing out, the higher you want this to be (you'll see why shortly). Ideally you want 0.5 or less. But it all comes down to how tolerant you are of monotonous copy/pasting. Keep in mind that the value you set this to will also be the WIDTH of your collision area, so lower is better for a bullet, or something similar.
Set Maximum Count to: 1
Set Search Filters to: These will (once again) be unique to you. You might want it to avoid hitting air units, structures, etc. Set whatever you please.
This Search Area effect is what helps our missile detect enemies as it travels.
Add object Shoot (Persistent) of Type: Create Persistent
Set Period Effects to: Shoot (Search Area)
Set Periodic Validator to: Contact Val (our Validator)
Set Periodic Offsets to: This is where things get tricky and irritating. Basically, for every X distance you want the missile to check for targets, you need to set up a sequence of coordinates. An example would be a missile that only travels ten distance before disappearing being represented like so: {(0, -0.5), (0, -1), (0, -1.5)...(0, -9.5), (0, -10)}. The smaller the jump in the Y value (0.5 in my example) between values, the more realistic the shot will be (and the more thorough/precise). However, getting your missile to cover the entire map could be an absolute nightmare to input. Below I will put an example of how to get the computer to do the work for you over long distances. Ideally, your change in Y between coords should be equal to the radius you set in your Search Area effect.
Set Period Count to: Set this field to however many values you have in the offset field. In my example above, I would have 20
Set Period Duration to: The total amount of time you want the missile to take to reach its maximum distance divided by the Period Count. I've found there to be a limit to this. Going under 0.04 or so (which is still quite fast), the buff cannot be applied to the caster as quickly as the Persistent runs. Basically, stick to 0.04 or higher.
Set Location to: Source Unit/Point (or just Source Point if you don't want your ability to target units)
Set Location Offset - End+ to: The same as the above value ^
Set Effect - Expire to: Shoot (Remove Buff)
Set Effect - Expire Delay to: (your period duration + .001)
This persistent will check for collision ever X distance and prevent the check from continuing once contact has been made.
That's all there is to it really. Obviously you still need buttons/abilities/weapons set up to actually make use of your effect, but calling the Persistent will make the whole string work. However, I will walk through one bonus step that I recommend:
(Optional) Step 4: Actor Tab
Switch to the Actor Tab.
Add object named Shoot Beam with Type: Beam (Simple) - Beam Simple Animation Style One Shot
Set Model to: A beam model of your choice. GhostSnipeAttackBeam is the best for standard bullets, I find.
Set Events to:
Event: Actor Creation
Action: Animation Bracket Start: [Shoot (custom name), Birth, Stand, Death, Play Once, 0.05, Duration] (Keep in mind that not all Beam models have Birth, Stand and Death animations)
Event: Animation Done
Term: Shoot (custom name)
Action: Destroy
This is a beam model, which will represent your shot. It is used in conjunction with the next Actor.
Add object named Shoot Attack Launch with Type: Action - GenericAttack
Set Beam to: Shoot Beam (our Beam Actor)
Set Launch Attachment Query+ to: This will differ based on what unit is using the weapon/ability. Chances are you want it to be set to FilterWeapon
Set Launch Assets+: I would recommend setting the Art and Sound to match the look and sound you desire on Launch
Set Impact Map+: Same as above, except that this is obviously for Impact instead of Launch
Set Events+ to:
Effect > Shoot (Damage) > Start
Term: At Caster
Action: Create (all fields blank)
And that should be it.
Fun Additions
Here are some fun ideas to consider:
Setting the Validator to be Less than or Equal to X: This would let the missile pass through X number of units before finally being destroyed.
Using Multiple Persistents: This is what I mentioned earlier in the Persistent section. For a really long distance, you could simply make 20 or so periodic offsets. If you then made 5 duplicates of the persistent and made them all link each other through expire effects, you turn those twenty offsets into 100 without actually having to write them all in.
Miss Actors: One 'problem' you may have noticed above is that our beam will only appear if a missile makes contact. If the missile reaches its limit without colliding, no effect is displayed. You can get around this by doing the following:
Create an Effect named Shoot (Damage Dummy) with Type: Damage. Don't edit anything.
Create a new Persistent Effect titled Shoot (Final Persistent)
Set Period Count to 1
Set Period Durations to 0.001
Set Period Effects to Shoot (Damage Dummy)
Add one Periodic Offset at (0, (farthest distance))
Add your validator into the Periodic Validator Field
Set Target Location - Start and Target Location+ to Source Unit/Point
Go to Shoot (Persistent):
Set Effect - Final to Spear Shoot (Final Persistent)
Duplicate the last actor we made (Shoot Attack Launch) and change the event in the Events+ field to Effect > Shoot (Damage Dummy) > Start
Channeled: Setting the Persistent Effect to Chanelled in the Flags field will limit each caster to shooting one misisle at a time.
The Theory
The way it works is like this:
The Persistent runs periodically. Every interval specified by your Periodic Duration field, it creates the Search Area effect. The Search Area effect searches for a single, targetable unit at the first offset specified in your persistent effect. If it finds an applicable target, it adds our Collision Buff to the Caster and deals damage.
When our Persistent runs again, it will set the Search Effect to the second offset, unless the Validator we made fails to clear, which happens whenever the buff is found on our unit.
Finally, at the end of the Persistent, the buff is destroyed, so it doesn't remain on your unit for its next attack/cast.
Feel free to post a response/feedback, or pm me for help.
Alternative Method for Longer Rranges
As you may have noticed, long range attacks are an absolute nightmare with the above method. In this section I am simply going to skim alot of the specific details. Anybody who followed the steps above should be able to alter/apply them to this just fine. Here is another option that should work:
In your Persistent effect:
Clear all information in the Periodic fields.
Set Effect - Initial to your Search Area
Go to your Search Area effect:
Add TSDistance to the Target Sorts + field
Ensure that Maximum count is set to 1
Within your Aea+ field, set the radius to the maximum range of your ability
Within the Area+ field, set Arc to a low number (0 would be most accurate, but perhaps a little TOO accurate...consider 5 or so. The longer the potential range the wider the AoE will become farther away)
Nope, Location Offset - End + is actually a value lower down. It's just beneath Location.
I've seen people asking for help with missiles that continue in a certain direction until they come into contact with a wall or unit. Please note that this is NOT a traceline guide. There are many of those about already, or you can look at one of the many Third Person Shooter systems littered about.
I expect you to have some basic understanding of effect types and a bit of experience already with the data editor.
[NOTE]: If you want to create this effect with a missile, go to this link, where I actually have a sample map that can be used: http://forums.sc2mapster.com/resources/data-assets/16059-wingednoserings-data-assets/#posts
If you want an invisible or beam-based effect, read on.
I will be running through a demonstration, but will sum up the theory behind the whole thing afterwards. You may name your buffs/effects/etc; whatever you wish as you follow along.
We will be using three Data Types: Effect, Validator, and Behavior. Others may be used to actually assign the finished product to an ability or weapon, but I won't be covering that, since it's unique to each person's final intentions.
There are two methods of doing this. The first one I'll cover is much more time consuming to set up, but is incredibly accurate. The second (scroll to the bottom of the post) is ideal for longer range abilities and requires minimal effort to create, but lacks the precision of the first.
The Primary Method
Step 1: Behavior Tab
Switch over to the Behavior Tab.
Add an object named Contact with type: Buff
You can leave the rest default. This buff is completely invisible and really just allows us to create our validator.
Step 2: Validator Tab
Switch over to the Validator tab.
Add an object named Contact Val with type: Unit Compare Behavior Count
This Validator prevents our caster from continuing once his shot has come into contact with a unit, wall, etc;
Step 3: Effects Tab
Yep, you guessed it. It's time to wander over to the Effects tab. We actually won't need the other two again, so you can close them if you wish. This is going to take a little while...
With Effects, I always like to get a good idea of what I hope to achieve and then work backwards. That way, everything links correctly and you don't need to revisit anything.
Add object named Shoot (Damage) with Type: Damage
I don't think the damage effect needs much explanation...if you want to add an AoE effect upon impact, do it via the Area+ field in this effect.
Add object named Shoot (Buff) with Type: Apply Behavior
This is what will add the buff to our caster if the attack hits an object.
Add object named Shoot (Set) with Type: Set
That one's fairly simple. Sets are really just a way of using multiple effects at once.
Add object to named Shoot (Remove Buff) with Type: Remove Behavior
Add object named Shoot (Search Area) with Type: Search Area
This Search Area effect is what helps our missile detect enemies as it travels.
Add object Shoot (Persistent) of Type: Create Persistent
This persistent will check for collision ever X distance and prevent the check from continuing once contact has been made.
That's all there is to it really. Obviously you still need buttons/abilities/weapons set up to actually make use of your effect, but calling the Persistent will make the whole string work. However, I will walk through one bonus step that I recommend:
(Optional) Step 4: Actor Tab
Switch to the Actor Tab.
Add object named Shoot Beam with Type: Beam (Simple) - Beam Simple Animation Style One Shot
This is a beam model, which will represent your shot. It is used in conjunction with the next Actor.
Add object named Shoot Attack Launch with Type: Action - GenericAttack
And that should be it.
Fun Additions
Here are some fun ideas to consider:
The Theory
The way it works is like this:
The Persistent runs periodically. Every interval specified by your Periodic Duration field, it creates the Search Area effect. The Search Area effect searches for a single, targetable unit at the first offset specified in your persistent effect. If it finds an applicable target, it adds our Collision Buff to the Caster and deals damage.
When our Persistent runs again, it will set the Search Effect to the second offset, unless the Validator we made fails to clear, which happens whenever the buff is found on our unit.
Finally, at the end of the Persistent, the buff is destroyed, so it doesn't remain on your unit for its next attack/cast.
Feel free to post a response/feedback, or pm me for help.
Alternative Method for Longer Rranges
As you may have noticed, long range attacks are an absolute nightmare with the above method. In this section I am simply going to skim alot of the specific details. Anybody who followed the steps above should be able to alter/apply them to this just fine. Here is another option that should work:
In your Persistent effect:
Go to your Search Area effect:
That should be it.