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)
thx, as soon as I actually was in the Data Editor I noticed what you meant.
"Shots with Projectiles: I understand some people might want to use a missile rather than a beam. This is possible through clever use of Launch Missile Effects and custom SiteOperations. "
excellent! this is actually why I was reading your post. I want to make a large unit throw a large rock and have it move slowly with the potential that you can dodge it. I was going to try this out with beams as you have done and hope to adapt it to a missile later. Do you intend to update this with information on using it with missiles? Are you saying just change the actors to missile actors and make the impact happen at a SiteOperation local offset of (0, -10, 0) from the caster (offset value based on your persistent example values)? I am very tired, this might not even make sense.
Its definitely a different approach to simulating a dumb-fire missile for sure, that offset creation sure looks painful for long trajectories though, I think I prefer the rapid periodic searcher strapped to a genuine targetless missile method.
Fraid its not so simple to make that searcher represent the impact condition and calling it a day. Far as I know the impact effect is triggered upon the missile's mover declaring its reached its target and the problem with that is these missiles are specifically designed to not have any sort of official target.
You'd need to go through the pain of creating the small radius searcher, then making a behavior and set its periodic effect to that searcher and give it a very fast period like .1 to ensure it happens enough to catch anything its passing through especially on a fast missile, then attach that behavior to your missile's unit. Then that searcher needs to be calling a set effect which is composed of the actual payload (your damage effect) and then if its a one-shot missile a suicide/remove effect so the missile strikes and goes away (or leave that one off if you want one that just continuously mauls everything in its path). Then when it comes to the mover you gotta set that thing up pretty precisely too since unlike most movers it won't just 'rubber band' fix any calculations you didn't set since its got no target to correct its flight path towards, such as giving it a huge accelerating or forgetting to make it ignore gravity and/or terrain. I still don't really understand how these movers work otherwise I'd have probably tried to create such a tutorial myself, that and sometimes I still have these missiles launch with unpredictable slopes in their movement especially around deep holes (-1 cliff).
Oh and then as the triggering mechanism for the whole thing your own uses a search effect so that's auto-firing essentially and you could also use with these dumb-fires but otherwise you'd also have to create an ability or weapon which calls the original persistent effect that launches the missile too. Yer original method is indeed much simpler then all this, but yah its not quite the same.
I think it will work. Search Areas don't return anything (they aren't even detected) if they can't find a target. If you make the Launch Missile target the offset point, it will either not shoot at all (since there's no end point) or it will hit the targetted offset.
I don't pretend to be an expert on this subject, missiles have always been confusing to me (hence me sticking to the beams in my example). I'm going to try it out and see.
Aye when I first read the reference to the impact effect I crossed my fingers that it could actually be that simple...but through testing it is unfortunately not the case, as I said I think the impact effect is called when the missile reports back that its reached its destination and is used to represent the payload between the caster and the target, that's how I see it used with targeted missiles any ways.
Darn, I just made a new one from scratch and you're right. Guess I'll remove it from that post then. I think you'd need an entirely different layout for a missile then, probably based around either (as you said) a massive search area with an expanding radius, or possibly a dummy target effect run through triggers...
I have a couple more ideas to try before I totally give up on it though, I'll let you know how it goes.
I'm looking forward :) Any research towards direct-fire weapons is something I'm very interested in, trying to acquire as much knowledge as possible around this topic since well its such a foreign concept to how starcraft 2 traditionally treats weaponry as 'never misses'. My purposes is working on a particular map which is a throw back to a fantastic top-down little team based shooter/flag capping game I used to play a long long time ago. Just started testing some AI for computer opponents last night actually and made a video of the results. Here's what I've got in terms of direct fire weaponry any ways:
The missiles all use little rapid periodic searchers to emulate collision spheres that travel with them, the bouncers though are a whole other ball of highly annoying wax, as was the method to get them all detecting cliffs.
Yah its a WASD map with mouse firing and those are stalkers. It was a real toss up between the stalker and the immortal on which unit to use, don't know why I picked stalker in the end but they look pretty neat when passing under shadows. Once someone figures out how to make the immortal's upper body follow the mouse cursor though I'll probably be compelled to switch up the models. :)
Fraid I already tore down the map I made to try out your method but yah that new stuff looks a little more likely to work to make missiles fired with your method look more like they should. Btw about turrets and triggers I'm pretty sure that's possible using an actor message, it'd only be useful for me if you could then have it actively following the mouse but yah pretty sure you can pull it off with those.
Yah I think the trick is how to find the right message that will burrow from the main unit's actor to its turret sub actor, I haven't spent much time looking but its gotta be possible.
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.
@wingednosering: Go
ty for this, I will be trying this soon.
my first question, I assume you are referring to the value for Periodic Offsets when you state the following?
"Set Location Offset - End to: The same as the above value ^ "
Nope, Location Offset - End + is actually a value lower down. It's just beneath Location.
thx, as soon as I actually was in the Data Editor I noticed what you meant.
"Shots with Projectiles: I understand some people might want to use a missile rather than a beam. This is possible through clever use of Launch Missile Effects and custom SiteOperations. "
excellent! this is actually why I was reading your post. I want to make a large unit throw a large rock and have it move slowly with the potential that you can dodge it. I was going to try this out with beams as you have done and hope to adapt it to a missile later. Do you intend to update this with information on using it with missiles? Are you saying just change the actors to missile actors and make the impact happen at a SiteOperation local offset of (0, -10, 0) from the caster (offset value based on your persistent example values)? I am very tired, this might not even make sense.
Its definitely a different approach to simulating a dumb-fire missile for sure, that offset creation sure looks painful for long trajectories though, I think I prefer the rapid periodic searcher strapped to a genuine targetless missile method.
No question it's not ideal for long ranges, but I wanted to show how simple something this daunting can be.
Below is a writeup for how to make use of Missiles with the above methods. If you are using a missile I highly recommend you look at this instead: http://forums.sc2mapster.com/resources/data-assets/16059-wingednoserings-data-assets/#posts
The below will still work though.
To use a Missile Instead of a Beam With the Above Methods:
Create your missile (I won't get into how to do that, I expect anybody following this know how)
Go to the Effects Tab and create a new object called Shoot (Launch) with Type: Launch Missile
Return to Shoot (Set)
Go to the Actor tab and add an object named Shoot Attack with Type: Action - GenericAttack
Event: Effect > Shoot (Launch) > Start
Term: At Caster
Action: Create
Event: Effect > Shoot (Damage) > Start
Term: At Caster
Term: FromEffectTreeDescendant
Action: ActionImpact
People ask about this at least once a day, so great tutorial, added to my quick links to post people
@wingednosering: Go
Fraid its not so simple to make that searcher represent the impact condition and calling it a day. Far as I know the impact effect is triggered upon the missile's mover declaring its reached its target and the problem with that is these missiles are specifically designed to not have any sort of official target.
You'd need to go through the pain of creating the small radius searcher, then making a behavior and set its periodic effect to that searcher and give it a very fast period like .1 to ensure it happens enough to catch anything its passing through especially on a fast missile, then attach that behavior to your missile's unit. Then that searcher needs to be calling a set effect which is composed of the actual payload (your damage effect) and then if its a one-shot missile a suicide/remove effect so the missile strikes and goes away (or leave that one off if you want one that just continuously mauls everything in its path). Then when it comes to the mover you gotta set that thing up pretty precisely too since unlike most movers it won't just 'rubber band' fix any calculations you didn't set since its got no target to correct its flight path towards, such as giving it a huge accelerating or forgetting to make it ignore gravity and/or terrain. I still don't really understand how these movers work otherwise I'd have probably tried to create such a tutorial myself, that and sometimes I still have these missiles launch with unpredictable slopes in their movement especially around deep holes (-1 cliff).
Oh and then as the triggering mechanism for the whole thing your own uses a search effect so that's auto-firing essentially and you could also use with these dumb-fires but otherwise you'd also have to create an ability or weapon which calls the original persistent effect that launches the missile too. Yer original method is indeed much simpler then all this, but yah its not quite the same.
I think it will work. Search Areas don't return anything (they aren't even detected) if they can't find a target. If you make the Launch Missile target the offset point, it will either not shoot at all (since there's no end point) or it will hit the targetted offset.
I don't pretend to be an expert on this subject, missiles have always been confusing to me (hence me sticking to the beams in my example). I'm going to try it out and see.
@wingednosering: Go
Aye when I first read the reference to the impact effect I crossed my fingers that it could actually be that simple...but through testing it is unfortunately not the case, as I said I think the impact effect is called when the missile reports back that its reached its destination and is used to represent the payload between the caster and the target, that's how I see it used with targeted missiles any ways.
Darn, I just made a new one from scratch and you're right. Guess I'll remove it from that post then. I think you'd need an entirely different layout for a missile then, probably based around either (as you said) a massive search area with an expanding radius, or possibly a dummy target effect run through triggers...
I have a couple more ideas to try before I totally give up on it though, I'll let you know how it goes.
You'll be happy to know I got it to work
See above.
@wingednosering: Go
I'm looking forward :) Any research towards direct-fire weapons is something I'm very interested in, trying to acquire as much knowledge as possible around this topic since well its such a foreign concept to how starcraft 2 traditionally treats weaponry as 'never misses'. My purposes is working on a particular map which is a throw back to a fantastic top-down little team based shooter/flag capping game I used to play a long long time ago. Just started testing some AI for computer opponents last night actually and made a video of the results. Here's what I've got in terms of direct fire weaponry any ways:
The missiles all use little rapid periodic searchers to emulate collision spheres that travel with them, the bouncers though are a whole other ball of highly annoying wax, as was the method to get them all detecting cliffs.
Neat, does that use WASD? You could try switching the stalker to an immortal. The Immortals walk animations make it perfect for that sort of thing.
@wingednosering: Go
Yah its a WASD map with mouse firing and those are stalkers. It was a real toss up between the stalker and the immortal on which unit to use, don't know why I picked stalker in the end but they look pretty neat when passing under shadows. Once someone figures out how to make the immortal's upper body follow the mouse cursor though I'll probably be compelled to switch up the models. :)
Nice. I wish we could make turrets angle certain directions through triggers...
Did you try the new Launch Missile method?
Fraid I already tore down the map I made to try out your method but yah that new stuff looks a little more likely to work to make missiles fired with your method look more like they should. Btw about turrets and triggers I'm pretty sure that's possible using an actor message, it'd only be useful for me if you could then have it actively following the mouse but yah pretty sure you can pull it off with those.
Really? I tried getting a tank turret to continually face my camera yaw for my third person shooter system, but it never seemed to respond.
Yah I think the trick is how to find the right message that will burrow from the main unit's actor to its turret sub actor, I haven't spent much time looking but its gotta be possible.
Could someone please give me instruction on assigning the above tutorial to an ability? I can't seem to get it to work.