In this tutorial I build upon my Diablo Controls map and add a new spell: A fireball spell that travels along a line (towards a point) and hits any unit or doodad or cliff on the way!
Surprisingly this common style of Diablo spell (where you fire the spell and it hits a unit along a path) is not simple in SC2. This tutorial will require some nice data editor work!
The text version of this tutorial is mostly just directions, but links are provided to the relevant section of video (where I explain actually WHY we do things).
Otherwise, you can follow along and change it to fit your non-diablo map.
Basic idea of the tutorial: Making a fireball that travels to a target point and hits the first target along the way (or none).
Open the Data Editor.
Switch to the Abilities tab.
Copy+Paste (do not duplicate!!) Battlecruiser - Yamato Gun.
Rename to be Fireball.
Open Ability-Commands+ and hit the Red-X for the Execute requirements. Button does not matter for my diablo map, but it may for yours!
Remove Progress buttons.
Uncheck all from 'Ability - Uninterruptible'
Under Cost - Cost+, click on first row and then scroll down to remove Energy cost from Vitals (ie set it to 0). ALSO change Cooldown's Time-Use to 0.1.
Delete Editor-Prefix.
In Stats-Flags uncheck Require Target Vision.
Remove Stats-PrepareTime.
Increase Stats-Range to 20.
Set Range-Extra to 1.
Uncheck Prepare on UI - Show Progress.
WE'LL SET THE EFFECT LATER!
Now we need a dummy effect for where you click with the spell, then a missile effect, and then a missile unit.
Switch to Effects tab.
Right-Click anywhere in the list and choose Add Effect.
Name it Fireball Dummy Effect
Hit Suggest (optional but recommended always!)
Effect Type is Search Area (completely arbitrary, just something that can target ground really).
Change Effect - Impact Effect to be our recently made Fireball Dummy Effect
Remove all Effect-Validators.
Change Target - Impact Location+ to be Target Point for its Value.
Now we need to go make the ammo unit (aka missile unit)!
Switch to Units tab.
Duplicate Weapon - Yamato and check off everything.
Rename the duplicated Mover to be 'Fireball Weapon'
Rename the duplicated Model to be 'Fireball Weapon'
Rename the duplicated Actor to be 'Fireball Missile'
Rename the Unit itself to be Fireball (leave editor-prefix of 'Weapon')
Other than that, the missile unit is done. We duplicated everything there so you could mess with its mover, model, or actor etc... but I'm happy with the yamato's settings for it. Note: If you want to change the speed, see maticpl's post down below
Go to the Effects tab now.
Click on our Fireball Missile effect.
Change Unit - Ammo Unit to be our Weapon - Fireball.
Now switch to the Abilities tab.
Find our Fireball ability.
Change Effect - AI Notify Effect to be our Fireball Missile effect.
Do the same for Effect - Effect.
Now switch to the Actors tab.
Let's make it actually have some visuals!
Find 'Battlecruiser Yamato Attack' and copy paste it.
Rename it to be Fireball Action.
In the top 'Token' fields:
Change Impact Effect to be our Fireball Dummy Effect.
Change Launch Effect to be our Fireball Missile.
Change Art - Missile to be Fireball Missile.
Our missile still needs to 'hit' a target along its path (right now it'll just fly by them)...
Set Combat-Amount to be something more reasonable like 50.
Remove Editor-Prefix.
Change Effect-Death to Fire.
Now right-click in the effect list and go Add Effect.
Name it Fireball Set and suggest.
Type is Set.
Hit OK.
Now for this new set effect, double-click on the Effect-Effects field.
Add two effects here...
Fireball Damage
Suicide
Now again in the left pane right-click and go Add Effect.
Name it Fireball Search and suggest.
Type is Search Area.
Hit OK.
Now for our new search effect:
Set Search - Maximum Count to 1.
Set Search - Search Filters to have Ally, Neutral, and Player unchecked (Enemy should be the only one checked).
Open Search - Areas+...
Add one row.
Leave arc at 360, but change Effect to be our Fireball Set
Leave the maximum count inside here at -1 because we want it to grab from any units it finds (but later be throttled by our max count of 1 for the effect itself).
Set Radius to be 1.0.
Hit OK.
For Effect - Response Flags, check off both.
Now switch to the Behaviors tab.
Right-click and Add Behavior.
Name it Fireball Find Target and hit suggest.
Behavior Type is Buff.
Hit OK.
Now for our new behavior:
For Effect - Effect - Periodic, set it to Fireball Search
For Stats - Flags, check off Hidden.
For Stats - Period, set it to something small like 0.1 (10 times per second fyi).
Now switch to the Units tab.
Click on our Weapon - Fireball.
Open Behaviors-Behaviors+
Add our Fireball Find Target behavior.
Hit OK.
Now our ability should launch a fireball that rapidly searches under itself for any enemy units, and if it finds one it suicides and does damage to that found unit...
However, it won't play a cool 'explode' animation when it hits a target atm, so let's remedy that.
Switch to the Actors tab.
Right-click and Add Actor.
Name it Fireball Hit Target Explode Model, and suggest.
Type is Model.
Based on: BuffOneShot.
Hit OK.
Now for our new actor:
Set Art - Model to be Battlecruiser Yamato Attack Impact.
Now open Event-Events+
Right-click and choose Add Event
Click on our event 'ActionDamage' if not already on it.
Change Msg Type to be Effect
Change Source Name to be Fireball Set
Change Sub Name to be Start
Now click on our 'ActionImpact' action for this event.
Change Msg Type to be Create.
Hit OK we are done here.
Again in actors, right-click and Add Actor.
Name it Fireball Hit Target Sound, and suggest.
Type is Sound.
Based on: SoundOneShot.
For this new sound actor:
Choose Sound - Sound to be Battlecruiser_YamatoAttackImpact.
Now open Event-Events+
Right-click and choose Add Event
Click on our event 'ActionDamage' if not already on it.
Change Msg Type to be Effect
Change Source Name to be Fireball Set
Change Sub Name to be Start
Now click on our 'ActionImpact' action for this event.
Change Msg Type to be Create.
Hit OK we are done here.
Switch to the Units tab next.
We need the Zealot to cast it now so click onto our Zealot unit.
In Ability-Abilities+ add our Fireball ability.
Next, we go into the Trigger Editor to setup the casting of it. Note: if you were putting this into your own map then this next part is irrelevant. BUT, you should make sure your Fireball has a proper button and that it's on the Zealot's Command-Card.
Open the Trigger Editor
In the Spells folder, copy+paste Change To Spell 3 (Guardian Shield).
Rename it to be Change To Spell 4 (Fireball).
Change event's key to be 4(Key).
Change the 1st line so that it equals our Fireball ability (note: it may be under Yamato Cannon since I didn't change its button... not a big deal but if you were picky about it go make a Fireball button and add that to our Ability-Command+ field).
Leave the 2nd line.
Change the 3rd line to be equal to True.
Leave the 4th line.
Change last line to be "Fireball set to right-mouse".
This is the great thing about the way we set up the Diablo map. Very easy to add new abilities into the system!
Go test and check it out!
Bonus:
You may notice however that you can cast through doodads and up cliffs etc... I haven't found a perfect fix for this. But what we can do is change our missile so that it also checks for no-pathing.
To do this, we will be adding a 2nd behavior to our missile that periodically checks for no pathing underneath it (and if so, suicide). Let's start from the ground up though.
Open the Data Editor.
Switch to the Validators tab.
Right-click and Add Validator.
Name it Check No Pathing.
Hit suggest.
Type is Location Pathable.
Hit OK.
For our new validator:
Set Target-Location+ to be Source Unit/Point for its value.
Set Validator-Find to be 'Disabled'.
Switch to the Effects tab.
Find Suicide (should be gray) and copy-paste it.
Rename it to "Suicide If Unpathable" and suggest.
Inside it, open Effect-Validators. Add our 'Check No Pathing' into there.
Now switch to the Behaviors tab.
Copy+Paste our 'Fireball Find Target' behavior.
Rename it to be "Check No Pathing" and suggest.
Change Effect-Effect-Periodic to be Suicide If Unpathable'.
Change Stats-Period to be 0.0625 which is the fastest Bnet can handle. It will probably have to be this fast..
Switch to the Units tab.
Find our Weapon-Fireball unit and click on it.
Open Behavior-Behaviors+ and add our new Check No Pathing into there.
Now head into the Actors tab.
Click on Fireball Hit Target Explode Model.
Open Event-Events+.
Click on our Effect.FireballSet.Start event and copy-paste it.
With our new event selected, change Source Name to be Suicide If Unpathable.
Now set Sub Name to be Start.
Hit OK.
Click on Fireball Hit Target Sound.
Open Event-Events+.
Again, copy-paste our FireballSet event.
And again, change it to be our Suicide If Unpathable one with Start.
Now if you go test it'll hit into walls/doodads. It's not perfect I'll admit but it's what I've figure out at the moment. Feel free to explore other ways to do collision.
Note: One bug is when shooting down cliffs it'll probably explode...
Thanks for reading and feel free to post comments :)
Note, that this method does not provide the correct kill credit (if this is of any importance for your map). The caster will not get a kill, but the missile projectile unit.
To circumvent this, you can either use the Kill Credit field of the behavior and let your caster apply it to the projectile unit, or you skip the behavior.
Also, please let me know, if you find a data solution to the cliff collision. I know of 2 solutions, which both have their shortcomings (the pathing check and a cliff level comparison, which makes the projectile collide with ramps and not with doodads, also it looks awkward)
I've been looking for this kind of tutorial for a long time. When I saw it, I tried to implement it right away.
Btw. you could add info that if someone wants to make projectile slower (yamato is waaay too fast for a diablo map imo), he needs to change field in created mover: Motion Phases -> Maximum Speed (it is set to 20 for yamato).
However, I ran into strange type of bug. I tried to lower the scale of missile and explosion in actors. Just changed value of Fireball Hit Target Explode Model - Art - Scale and Fireball Missle - Art - Scale. It works... but only when missile hits wall or unit. When it ends on the ground, scale stays as it was. I really don't know where to look in order to fix this. Do you know what can be the reson?
I've attached map if you want to look into details.
EDIT
Okay, I've found out. There is another scale in Actor - Impact Map.
Sorry for bothering and thanks again for great tutorial!
Oops missed your post until now haha. Yeah I made a comment on the youtube vid about the mover speed. I figured most people could look at Blizz's tutorial or search sc2mapster on movers.
And yeah, you have to set the scale in 2 places because the suicide effect was not triggering that impact-map thing.
Not trying to bump but I think this is the best place to post this:
I was browsing Blizzard's mover tutorial today and noticed this line:
Quote:
Arrival Test Type
Controls how a missile tests whether it is close enough to its target to be considered "arrived". Can be three values:
Adaptive. The default. The test automatically switches between 2D for target points and 3D for target units.
[...] Never. The missile will never impact. This is useful for cases where you want to throw a missile in a direction without a specific target, and have a behavior on that missile scan for targets around it.
That's an interesting find and ironically they pinpointed exactly what I was doing in this tutorial lol. Might have to explore movers set to Never on Arrival Test Type...
I experimented with the movers quite a lot; I used to make use of the arrival type never, but tbh thats not that useful, because in this case you only have the option to specify a maximum range via a lifetime (a behavior or something); if you use a persistent effect offset instead, you can specify an actual range, which is much more useful imo (also you don't need to mess with the movers ;) )
Also, if you set them to never arrive, you basically lose control of the missile. For straight path missiles, this is not a huge problem, but if you want some more advanced flight path, like curved or something, the missile might behave strangely, if it isn't able to reach its target.
From my experiments, persistent offsets are the way to go for point-target colliding projectiles.
So, is there a way to make the missile reach its max range before exploding (if it doesn't hit a unit) no matter where you click? I don't like how you have to click behind your target for it to work.
So, is there a way to make the missile reach its max range before exploding (if it doesn't hit a unit) no matter where you click? I don't like how you have to click behind your target for it to work.
You can use a persistent to offset the target point. You need a negative Y offset.
So I linked my persistent to have search area in Effect: Periodic Effects+ and edited the Effect: Periodic Offsets+ to have a Y offset of -1 but it's not exactly working... Sorry I don't have a good grasp on data, what else do I need to do? Did I do something wrong?
Sorry to necro, but I love this guide. If there is a more up to date thread please point me to it.
Anyway, I'm also interested in ZeroX33 question; would like to have the missile travel longer than the casting range.
Also I've encountered a bug with this. When I shoot a target which is out of sigh (e.g., by me moving back) the unit is damaged and even killed - but leaves no corpse! Why does this happen?
Sorry to bother you guys, but I was wondering if there was a way to modify this to fire the missile forward in a straight line (using unit facing) without specifying a casting point. Or, better still, if you could fire a spray of such missiles with some firing off at regular angles from the caster.
Edit: Figured out how to solve the former problem (before deciding that I liked targeting better, after all). You just have an instant ability create a persistent with a periodic effect of firing the missile. The periodic offsets become the new target point(s). You make a missile travel past those points with the launch missile's Target: Impact Offset field.
That's the solution I found, anyways. However, now I have a new problem. When firing multiple projectiles at angles, the bullets behave normally when fired at a cardinal direction, but clump together increasingly as you approach NE, NW, SE, or SW, until they finally overlap perfectly.
Why is this happening and what can I do to fix it?
Edit: It was the Impact Offset field. The value that I had specified was so large that it sometimes made the missiles try to target a point that wasn't on the map, causing the wacky behavior.
In this tutorial I build upon my Diablo Controls map and add a new spell: A fireball spell that travels along a line (towards a point) and hits any unit or doodad or cliff on the way!
This tutorial can be applied to your own map but to follow me exactly you'll need this map:
Link Removed: http://www.mediafire.com/?bf2ll22jzscnlwa
If you want the final finished map, here it is too:
Link Removed: http://www.mediafire.com/?zfg8mpsctf9brab
Video version:
Text Tutorial
Links to the relevant part of my video tutorial is provided for each step (since this is a very brief/no-explanation text tutorial).
Like I mentioned above, to follow precisely you'll need my map from the last Diablo tutorial: Link Removed: http://www.mediafire.com/?bf2ll22jzscnlwa
Otherwise, you can follow along and change it to fit your non-diablo map.
Basic idea of the tutorial: Making a fireball that travels to a target point and hits the first target along the way (or none).
Open the Data Editor.
Switch to the Abilities tab.
Copy+Paste (do not duplicate!!) Battlecruiser - Yamato Gun.
Now we need a dummy effect for where you click with the spell, then a missile effect, and then a missile unit.
Switch to Effects tab.
Right-Click anywhere in the list and choose Add Effect.
Copy+Paste Battlecruiser - Yamato Cannon (Missile).
Switch to Units tab.
Duplicate Weapon - Yamato and check off everything.
Other than that, the missile unit is done. We duplicated everything there so you could mess with its mover, model, or actor etc... but I'm happy with the yamato's settings for it. Note: If you want to change the speed, see maticpl's post down below
Go to the Effects tab now.
Click on our Fireball Missile effect.
Now switch to the Abilities tab.
Find our Fireball ability.
Now switch to the Actors tab.
Let's make it actually have some visuals!
Find 'Battlecruiser Yamato Attack' and copy paste it.
Our missile still needs to 'hit' a target along its path (right now it'll just fly by them)...
So, switch to the Effects tab.
Copy+Paste Battlecruiser - Yamato Cannon (Damage).
Now right-click in the effect list and go Add Effect.
Now for this new set effect, double-click on the Effect-Effects field.
Now again in the left pane right-click and go Add Effect.
Now for our new search effect:
Now switch to the Behaviors tab.
Right-click and Add Behavior.
Now for our new behavior:
Now switch to the Units tab.
Click on our Weapon - Fireball.
Now our ability should launch a fireball that rapidly searches under itself for any enemy units, and if it finds one it suicides and does damage to that found unit...
However, it won't play a cool 'explode' animation when it hits a target atm, so let's remedy that.
Switch to the Actors tab.
Right-click and Add Actor.
Now for our new actor:
Again in actors, right-click and Add Actor.
For this new sound actor:
Switch to the Units tab next.
We need the Zealot to cast it now so click onto our Zealot unit.
Next, we go into the Trigger Editor to setup the casting of it. Note: if you were putting this into your own map then this next part is irrelevant. BUT, you should make sure your Fireball has a proper button and that it's on the Zealot's Command-Card.
Open the Trigger Editor
In the Spells folder, copy+paste Change To Spell 3 (Guardian Shield).
This is the great thing about the way we set up the Diablo map. Very easy to add new abilities into the system!
Go test and check it out!
Bonus:
You may notice however that you can cast through doodads and up cliffs etc... I haven't found a perfect fix for this. But what we can do is change our missile so that it also checks for no-pathing.
To do this, we will be adding a 2nd behavior to our missile that periodically checks for no pathing underneath it (and if so, suicide). Let's start from the ground up though.
Open the Data Editor.
Switch to the Validators tab.
Right-click and Add Validator.
For our new validator:
Switch to the Effects tab.
Find Suicide (should be gray) and copy-paste it.
Now switch to the Behaviors tab.
Copy+Paste our 'Fireball Find Target' behavior.
Switch to the Units tab.
Find our Weapon-Fireball unit and click on it.
Now head into the Actors tab.
Click on Fireball Hit Target Explode Model.
Click on Fireball Hit Target Sound.
Now if you go test it'll hit into walls/doodads. It's not perfect I'll admit but it's what I've figure out at the moment. Feel free to explore other ways to do collision. Note: One bug is when shooting down cliffs it'll probably explode...
Thanks for reading and feel free to post comments :)
Note, that this method does not provide the correct kill credit (if this is of any importance for your map). The caster will not get a kill, but the missile projectile unit.
To circumvent this, you can either use the Kill Credit field of the behavior and let your caster apply it to the projectile unit, or you skip the behavior.
Also, please let me know, if you find a data solution to the cliff collision. I know of 2 solutions, which both have their shortcomings (the pathing check and a cliff level comparison, which makes the projectile collide with ramps and not with doodads, also it looks awkward)
@Kueken531: Go
Ooh good point! Well in the Diablo map it's just one hero you have so not a huge deal about kill credit.
Yeah I don't know about cliff collision. I didn't even try it but I saw the validator. Diablo didn't really have many multiple levels (2d game!).
Thanks!
I've been looking for this kind of tutorial for a long time. When I saw it, I tried to implement it right away.
Btw. you could add info that if someone wants to make projectile slower (yamato is waaay too fast for a diablo map imo), he needs to change field in created mover: Motion Phases -> Maximum Speed (it is set to 20 for yamato).
However, I ran into strange type of bug. I tried to lower the scale of missile and explosion in actors. Just changed value of Fireball Hit Target Explode Model - Art - Scale and Fireball Missle - Art - Scale. It works... but only when missile hits wall or unit. When it ends on the ground, scale stays as it was. I really don't know where to look in order to fix this. Do you know what can be the reson?
I've attached map if you want to look into details.
EDIT
Okay, I've found out. There is another scale in Actor - Impact Map.
Sorry for bothering and thanks again for great tutorial!
@maticpl: Go
Oops missed your post until now haha. Yeah I made a comment on the youtube vid about the mover speed. I figured most people could look at Blizz's tutorial or search sc2mapster on movers.
And yeah, you have to set the scale in 2 places because the suicide effect was not triggering that impact-map thing.
Not trying to bump but I think this is the best place to post this:
I was browsing Blizzard's mover tutorial today and noticed this line:
That's an interesting find and ironically they pinpointed exactly what I was doing in this tutorial lol. Might have to explore movers set to Never on Arrival Test Type...
@OneTwoSC: Go
I experimented with the movers quite a lot; I used to make use of the arrival type never, but tbh thats not that useful, because in this case you only have the option to specify a maximum range via a lifetime (a behavior or something); if you use a persistent effect offset instead, you can specify an actual range, which is much more useful imo (also you don't need to mess with the movers ;) )
Also, if you set them to never arrive, you basically lose control of the missile. For straight path missiles, this is not a huge problem, but if you want some more advanced flight path, like curved or something, the missile might behave strangely, if it isn't able to reach its target.
From my experiments, persistent offsets are the way to go for point-target colliding projectiles.
@Kueken531: Go
Ah okay.
So, is there a way to make the missile reach its max range before exploding (if it doesn't hit a unit) no matter where you click? I don't like how you have to click behind your target for it to work.
You can use a persistent to offset the target point. You need a negative Y offset.
So I linked my persistent to have search area in Effect: Periodic Effects+ and edited the Effect: Periodic Offsets+ to have a Y offset of -1 but it's not exactly working... Sorry I don't have a good grasp on data, what else do I need to do? Did I do something wrong?
Sorry to necro, but I love this guide. If there is a more up to date thread please point me to it.
Anyway, I'm also interested in ZeroX33 question; would like to have the missile travel longer than the casting range.
Also I've encountered a bug with this. When I shoot a target which is out of sigh (e.g., by me moving back) the unit is damaged and even killed - but leaves no corpse! Why does this happen?
Thanks
Sorry to bother you guys, but I was wondering if there was a way to modify this to fire the missile forward in a straight line (using unit facing) without specifying a casting point. Or, better still, if you could fire a spray of such missiles with some firing off at regular angles from the caster.
Edit: Figured out how to solve the former problem (before deciding that I liked targeting better, after all). You just have an instant ability create a persistent with a periodic effect of firing the missile. The periodic offsets become the new target point(s). You make a missile travel past those points with the launch missile's Target: Impact Offset field.
That's the solution I found, anyways. However, now I have a new problem. When firing multiple projectiles at angles, the bullets behave normally when fired at a cardinal direction, but clump together increasingly as you approach NE, NW, SE, or SW, until they finally overlap perfectly.
Why is this happening and what can I do to fix it?
Edit: It was the Impact Offset field. The value that I had specified was so large that it sometimes made the missiles try to target a point that wasn't on the map, causing the wacky behavior.