Resources > Tutorials
[Data] Colliding Projectiles
-
ResolveHK Regular Shmoe
- Join date
- Apr 25, 2010
- Location
- United States
- Reputation
- 0
- Posts
- 170
- Last login
- Mar 27, 2011
-
Abion47 Author
- Battle.net
- Abion
- #218 NA
- Join date
- May 16, 2010
- Location
- United States
- Reputation
- 0
- Posts
- 272
- Projects
- 4
- Last login
- Feb 21, 2012
Looks very nice. Much better structure than a lot of tutorials nowadays. Glad to be of service.
-
RageQit Author
- Join date
- Aug 14, 2010
- Location
- Australia
- Reputation
- 0
- Posts
- 129
- Projects
- 1
- Last login
- Oct 14, 2011
I think i want somebodies babies..
badly
Edit: If there was someway (i havent read the tutorial as i have to go somewhere) for you to explain or show how you could make the projectile also detonate when they hit walls using validators and the such? i spent practically the whole day trying to get these validator cliff level things working and i couldnt.
Cheers
Last edited Jan 13, 2011 by RageQit
-
RageQit Author
- Join date
- Aug 14, 2010
- Location
- Australia
- Reputation
- 0
- Posts
- 129
- Projects
- 1
- Last login
- Oct 14, 2011
-
RageQit Author
- Join date
- Aug 14, 2010
- Location
- Australia
- Reputation
- 0
- Posts
- 129
- Projects
- 1
- Last login
- Oct 14, 2011
huh, i finished the fireball tutorial using only one fireball instead of both L and R on a stalker, yet when the fireball hits a unit, the game crashes.
Edit: The same happens when i try your map. I guess i DO have to reinstall the game and update. fml
Last edited Jan 14, 2011 by RageQit -
ResolveHK Regular Shmoe
- Join date
- Apr 25, 2010
- Location
- United States
- Reputation
- 0
- Posts
- 170
- Last login
- Mar 27, 2011
oh ok cool it works. hey, do you think you'd be able to make an ability for the ghost that's an instant straight shot snipe that passes through 1 unit doing full damage and then hits 1 more unit doing 50% damage? And maybe when it hits doodads or walls it kills itself?or just edit one of your spells to collide with doodads and/or terrain wall layers
Last edited Jan 14, 2011 by ResolveHK -
Kueken531 Author
- Battle.net
- Küken
- #456 EU
- Join date
- Oct 05, 2010
- Location
- Germany
- Reputation
- 71
- Posts
- 3,317
- Projects
- 2
- Last login
- May 21, 2012
An instant straight shot would cover another field, since this would not be done using a projectile (similar to Raynor's penetrator round)
I found out, that colliding when hitting a cliff is pretty easy, most likely I will add this for one of the spells in the future. However, I still don't know a way to check for doodad collision. Even if I do, it will be hard to determine, when to collide and when not to.
The Z offset was indeed introduced with 1.2 and I think it looks a little better, if the fireballs don't just hit the ground. Pre- 1.2, you can use actor site operations to raise the impact for the actor visually.
Last edited Jan 14, 2011 by Kueken531 -
ResolveHK Regular Shmoe
- Join date
- Apr 25, 2010
- Location
- United States
- Reputation
- 0
- Posts
- 170
- Last login
- Mar 27, 2011
-
Kueken531 Author
- Battle.net
- Küken
- #456 EU
- Join date
- Oct 05, 2010
- Location
- Germany
- Reputation
- 71
- Posts
- 3,317
- Projects
- 2
- Last login
- May 21, 2012
Really fast projectiles should be avoided, because of the 0.0625 max interval for persistent effects. The faster the projectile, the more likely it will pass through units without actually colliding with them, due to the method of the periodic search effects.
I will add the cliff validator soon, I think.
-
WizardofWar83 Author
- Join date
- Jan 13, 2011
- Location
- South Georgia and the South Sandwich Islands
- Reputation
- 0
- Posts
- 9
- Projects
- 1
- Last login
- May 22, 2011
Hi Kueken531,
thank you very much for that tutorial.
Ive tried it on my own, and think I understood at least a bit of how these actors, abilities, effects and units are tied together.
So I build the fireball stuff, and attach it to a duplicated Thor. I load my map, and when fire my fireball SC2 crashes.
When I try your map it works. So I made screenshots of your data editor fields and compared them to mine, and except for disabled sound and different model it appears to me as it is the same. Oh and I only fire 1 fireball not 2 of em.
When I cast the fireball, my Thor turns around, or moves in position and in the instant the fireball should be appearing it just crashes.
I have no idea why.
Maybe someone has an idea? Ive attached the map for any friendly helpers!
-
Kueken531 Author
- Battle.net
- Küken
- #456 EU
- Join date
- Oct 05, 2010
- Location
- Germany
- Reputation
- 71
- Posts
- 3,317
- Projects
- 2
- Last login
- May 21, 2012
I downloaded your map, and I changed the AnimationPlay from "Attack Spell" to only "Spell" (thanks for this hint btw, I should formulate this part more exactly, I want the animation name to be "Spell" and the used animation to be "Attack", not "Attack Spell"), then started the map. Nothing crashed. Then I changed it back, no crash again. Then I re-downloaded the map, tried it and it crashed :D. Because I only did one change and then re-changed it, nothing was different theoretically, but one time it crashed, the other it didn't.
No idea what blizzard actually messed up with the actors, but just try changing the animation and see, if it works after that.
BTW you forgot the periodic offset for the initial persistant, so the missile does not work.
Last edited Jan 16, 2011 by Kueken531 -
WizardofWar83 Author
- Join date
- Jan 13, 2011
- Location
- South Georgia and the South Sandwich Islands
- Reputation
- 0
- Posts
- 9
- Projects
- 1
- Last login
- May 22, 2011
Thank you so much, both for the great help and the very fast reply.
It really fixed my issue, thanks alot!
If I ever publish my custom map I will put you in the credits for this nice Fireball!
-
WizardofWar83 Author
- Join date
- Jan 13, 2011
- Location
- South Georgia and the South Sandwich Islands
- Reputation
- 0
- Posts
- 9
- Projects
- 1
- Last login
- May 22, 2011
Ok next issue^^
My missile always travels just a few meters and then explodes (if it doesnt hit an enemy on its way).
I changed the Lifetime of the fireball actor to 2.0 but it didnt change.
I changed the ability stats range to maximum (500) now my caster unit doesnt walk towards the target point any more (as desired).
And second issue: I have set a doodad wall, and I would like the projectile to collide with that wall too (without exploding), which it doesnt, it just ignores it and goes through.
-
Kueken531 Author
- Battle.net
- Küken
- #456 EU
- Join date
- Oct 05, 2010
- Location
- Germany
- Reputation
- 71
- Posts
- 3,317
- Projects
- 2
- Last login
- May 21, 2012
The missile's target point is the offset point you specified for the initial persistent. If you want to extend the range, choose a bigger offset. If you want it to travel indefinitely, change the used mover's target checking to never.
I have no idea, how to check for doodad collision right now, but I did not really try it. If I find a way to do this, I will probably adapt the tutorial.
Last edited Jan 16, 2011 by Kueken531 -
WizardofWar83 Author
- Join date
- Jan 13, 2011
- Location
- South Georgia and the South Sandwich Islands
- Reputation
- 0
- Posts
- 9
- Projects
- 1
- Last login
- May 22, 2011
Ahh, thanks. The offset worked.
If doodads are not usable is there any invisible wall, which I can use as collision object?
How do I allow only 1 shot at a time (meaning, as long as there is still a projectile present no other shooting is allowed)? I mean I could probably use a trigger, I would think its possible in the data editor as well.
Last edited Jan 16, 2011 by WizardofWar83 -
Kueken531 Author
- Battle.net
- Küken
- #456 EU
- Join date
- Oct 05, 2010
- Location
- Germany
- Reputation
- 71
- Posts
- 3,317
- Projects
- 2
- Last login
- May 21, 2012
For an invisible unit, just create a new unit and give it the model "Invisible". You can choose a different model - editor for it, so in the editor it is not invisible.
For 1 shot at a time, you could add a requirement to the ability similar to the Train Mothership requirement, which does not allow casting of the ability as long as a fireball missile unit is on the map for the player, or you add a map-wide search effect when you cast the ability, which destroys all fireballs of the player.
Last edited Jan 16, 2011 by Kueken531
Kueken531 AuthorThis tutorial teaches you, how to create basic colliding projectiles with the data editor. We will handle the kill credit correctly and use different target options (like explode on contact or pierce through targets).
Doodad/cliff collision will not be part of this tutorial, but maybe added in the future.
For demonstrating colliding projectiles, we will create 3 different abilities.
The first ability will be a recreation of a Diablo 2 - style Fireball.
The second ability will be some kind of piercing projectile, which collides with units, but does not get destroyed in the process and cannot hit units multiple times.
The third ability will be some kind of boomerang ability, which does the same thing, but returns to the caster and can hit targets multiple times.
General things:
Fireball
Most of you might already know this ability, however, I want to explain shortly, what it does:
The caster releases a fast-moving projectile, which collides with the first unit in its way. It explodes and deals damage in an area around the impact location.
We will use the firebat as the caster unit for this spell, and since the firebat has 2 arms he raises with his animations and a single fireball is boring anyways, we will make him shoot 2 fireballs.
Also, unlike in Diablo 2, we will implement a maximum range for the fireball, when it reaches this, it will simply explode.
The final result should look something like this:
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/lr_zoklJZE0?fs=1&hd=1&hl=de_DE"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lr_zoklJZE0?fs=1&hd=1&hl=de_DE" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
Plasma Surge
This ability should do the following:
The caster releases a projectile, which collides with any enemy unit in its path, dealing damage to them. It does not get destroyed until reaching its destination.
For the sake of variety, another unit will cast this ability, lets take a Tauren Marine ;)
This ability would look similar to this:
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/T-hr0GdurZ4?fs=1&hd=1&hl=de_DE"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/T-hr0GdurZ4&hd=1?fs=1&hl=de_DE" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
Ion Saw
A boomerang - like ability. The saw curves towards a target point and travels back to the caster.
The saw damages everything in its path and should be able to hit units multiple times.
However, it should not hit units multiple times just when passing through them, only, if it hits the units again.
This will be casted by a Prisoner Zealot.
Like this:
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/9OhplFhhyZM?fs=1&hd=1&hl=de_DE"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9OhplFhhyZM&hd=1?fs=1&hl=de_DE" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
Step by Step Tutorials:
These are detailed instructions for exact recreations of the abilities demonstrated in the video and present in the attached test map.
The first paragraph for all 3 spells contains some basic information, why we are creating the spell the way we do it. It is not needed for the step by step instruction, but might be very helpful, if you do not want to use exact recreations of the spell, but similar ones.
If you are not interested and just want to recreate the spells, you can skip the "Basics" - paragraphs.
Fireball
Basics
We will create a missile, which travels to a point, as usual with a launch missile effect and an impact effect.<br />
For the collision functionality, we will use a persistent effect, which periodically runs a search area at the missile's location.<br />
We will use the missile's Launch Effect - field for this, which starts an effect, when the missile is launched.<br />
For this effect, the caster will be the unit casting the ability and the source will be the missile. This is very useful,this way we have direct access to the missile without having to use a behavior.<br />
There are 2 possibilities to remove the persistent: Either the persistent runs indefinitely, and we use an explicit Destroy Persistent effect to get rid of it, or we simply use a periodic count for the persistent, so the persistent will be finished, after the missile reached the maximum travel distance.<br />
The 2nd possibility works, but since the missile can be destroyed prematurely, the persistent would still try to check for collision for a while, so I prefer an explicit destruction, it "feels" more correct.<br />
Because of this, we can deal the damage directly with the persistant effect, the caster will still be the original unit and never the missile, so kill credit will be automatically correct.<br />
Units
Create a new unit called Fireball Missile, based on Default Settings (Projectile); click suggest for the id and then ok.
Buttons
Create a new button called Fireball.
Effects
Create a new Effect, called Fireball Damage, type Damage.
Click the Search - Area + - field and add 3 regions:
Click the Search - Search Filters - field and uncheck Ally and Player. Also set following fields to excluded:
New effect, name Fireball Impact, type Set.
New effect, name Fireball Target Check, type Search Area
New effect, name Fireball Persistent, type Create Persistent
New effect, name Fireball Destroy Persistent, type Destroy Persistent
Go to your Fireball Impact - effect and add Fireball Destroy Persistent to the list of effects.
New effect, name Fireball Launch R, type Launch Missile
Copy the last created effect, rename it to Fireball Launch L, click suggest.
New effect, name Fireball Initial, type Create Persistent
Abilities
New ability, name Fireball, type Effect - Target
Actors
New actor, name Fireball Missile, type Missile, based on GenericAttackMissile
New actor, name Fireball Impact, type Model, based on ModelAnimationStyleOneShot
New actor, name Fireball Impact Sound, type Sound, based on SoundOneShot
New actor, name Fireball R, type Action, based on GenericAttack
Copy the last created actor, rename it to Fireball L, click suggest
Select the Firebat - Actor
Units
Select the Firebat
For some visual enhancements, you can play around a little, for example add a prepare and finish time to the spell.
The Test Map
Everything related to the Fireball is prefixed with "Fireball -", so if you enter this in the search line, you will get only objects related to the fireball.
Plasma Surge
Basics
Most of the stuff is very similar to the Fireball, except we will not destroy the missile on the first impact.
This means, of course, we will need a way to not affect units multiple times, otherwise units, especially huge ones, might take massive amounts of damage, as the surge travels through them.
Fortunately we are using a persistent effect, so we can easily incorporate markers for this task.
Also, I will not use a Destroy Persistent here, since the missile always travels the full duration. Still, its not that exact, but fine, I guess.
Units
Create a new unit called Plasma Surge Missile, based on Default Settings (Projectile); click suggest for the id and then ok.
Buttons
Create a new button called Plasma Surge.
Effects
Create a new Effect, called Plasma Surge Damage, type Damage.
New effect, name Plasma Surge Impact, type Set.
New effect, name Plasma Surge Target Check, type Search Area
New effect, name Plasma Surge Persistent, type Create Persistent
New effect, name Plasma Surge Launch , type Launch Missile
New effect, name Plasma Surge Initial, type Create Persistent
Abilities
New ability, name Plasma Surge, type Effect - Target
Actors
New actor, name Plasma Surge Missile, type Missile, based on GenericAttackMissile
New actor, name Plasma Surge Impact, type Model, based on ModelAnimationStyleOneShot
New actor, name Plasma Surge Impact Sound, type Sound, based on SoundOneShot
New actor, name Plasma Surge, type Action, based on GenericAttack
New actor, name Plasma Surge Damage, type Action, based on GenericAttack
Select the TaurenSpaceMarine (unnamed) - Actor
Units
Select the Tauren Space Marine
The Test Map
Everything related to the Plasma Surge is prefixed with "Plasma Surge -", so if you enter this in the search line, you will get only objects related to the Plasma Surge.
Ion Saw
Basics
Again, a great deal of this will look familiar by now.
However, we will need some additional or a little different objects, because we want the missile to return and a specific movement pattern, so we will use a custom mover this time.
Also the missile should be able to hit units multiple times, but not when its just passing through them. It should only be able to cause damage again, when it moved away and hits the unit on the return again.
The only way I know of to realize this, is by using a buff. Unfortunately, this will make the spell not fully Mui, if 2 saws happen to hit a unit at exactly the same time, one of them might not cause damage properly.
Units
Create a new unit called Ion Saw Missile, based on Default Settings (Projectile); click suggest for the id and then ok.
Buttons
Create a new button called Ion Saw.
Models
Create a new model called Ion Saw Missile, type Generic and based on MissileFX
Behaviors
Create a new behavior called Ion Saw Target, type Buff
Movers
Create a new mover called Ion Saw, type Missile
Effects
Create a new Effect, called Ion Saw Damage, type Damage.
New effect, name Ion Saw Apply, type Apply Behavior
New effect, name Ion Saw Target Check, type Search Area
New effect, name Ion Saw Persistent, type Create Persistent
New effect, name Ion Saw Destroy Persistent, type Destroy Persistent
New effect, name Ion Saw Launch , type Launch Missile
New effect, name Ion Saw Initial, type Create Persistent
Behaviors
Select your Ion Saw Target- behavior
Abilities
New ability, name Ion Saw, type Effect - Target
Actors
New actor, name Ion Saw Missile, type Missile, based on <b>-></b> GenericTentacleMissile<b><-</b>
New actor, name Ion Saw, type Action, based on GenericAttack
New actor, name Ion Saw Damage, type Action, based on GenericAttack
Select the Prison Zealot - Actor
Units
Select the Zealot (Prisoner)
The Test Map
Everything related to the Ion Saw is prefixed with "Ion Saw -", so if you enter this in the search line, you will get only objects related to the Ion Saw.
Q&A
I will include questions and their answers here.
By all means yes. Feel free to use them as you want.
Indeed, for the persistent effect, the target point is the clicked point and the source unit is the missile.
However, the persistent is "targeted" on the source unit, so for every effect further linked from the persistent, the target unit will be the former source unit, the missile, and so the target point is the location of the missile. However, the source unit should be carried through, so using source here should, in theory, work just as well.
Thanks for reading this tutorial. I hope some people will benefit from it.
Feedback of any kind is appreciated.
Please let me know, if you notice any mistakes in the tutorial.