Im working on a map. You control a unit with WASD and shoot with the Mouse. The point is to kill the other players unit.
However im having problem making a projectile. When you click the left mouse button, the projectile is supposed to travel from your unit to the position you clicked with your mouse. If the projectile hits a wall, doodad, or an enemy unit, the projectile is destroyed and will deal damage if it hit a unit.
This is where im stuck. Right now ive tried to add a behavior that applies a damage effect to the projectile, but that makes the projectile kill itself instead. I cant seem to make the projectile impact and deal damage. Any suggestion?
yea, you need to make a 'behavior' on the projectile with a duration of 0/-1 that lasts forever, then a periodic 'search' effect, and a periodic duration of probably .1 or .01 as your projectile will be moving fast. then on the search effect, make it filter out for just 'enemies' and do a 'set' effect. the 'set' effect would do 'suicide - kill self (refering to CASTING UNIT, not target), and a dmg effect of what you wanted.
im guessing its gonna be a fast projectile, it is difficult to make it have a search area thats small enough to look accurate but large enough so that when its moving that fast it wont 'skip' some units. there are work arounds for this, but i would suggest you start with a slow projectile and just get funtionality working and become familiar with the data editor.
there are a couple posts about how to make the projectile fast and accurate but heres my quick method;
make the behavior periodic effect a create persistent
make it do the the persistent like 4 times with offsets of (0,-.4) (0,-.8)(0,-1.2)etc... this would be assuming youre using a search radius of like .2 you may need to fine tune these numbers but hopefully you get the idea.
there is a method using markers where only 1 persistent will be allowed to hit the unit, as with just the above, potentially it will get hit by more than 1 of the persistents depending on its location.
my 'work around' was to apply a buff behavior that lasted .01 duration, and with each 'dmg' it validated that the unit not have the buff.
to make it so it will not hit cliffs, youre going to need to do the same as above copied so theyre both in a 'set' and make it so instead of a search/dmg done with each persistent it just does a 'suicide - kill self' of course targeting (casting unit, it starts out as 'target' by default i believe and will appear not working unless its changed) with a 'cliff level / pathable' validation, whatever validation you want to incorporate for your 'walls of sorts'
i dont believe this is the cleanest way, but ive seen much worse methods out there. ive used this way and gotten it working nicely with spot on accuracy and missile speeds of up to 60 (look beyond instant). hopefully you understand what im saying, if not, just take your time and take it 1 step at a time. first a missile that 'detects/searches' and self blows up. start with a slow speed of like 10ish. then move onto the next step and after a while youll understand the data editor. until you realize you only thought you did! haha....
edit; also, on the search/dmg portion if you want it do blow up like a missile it should be with a max target of -1, otherwise it owuld need a max of '1' so it would seemingly only hit 1 unit. the above .01 buff duration has 'potential' for random errors, but i have not experienced or noticed it ever yet the chances are so small. and when they would happen would be when everyone is shooting at the exact same target with incredible odds and you wouldnt be able to notice anyways. oh well, GL!
I'm trying to do the cliff collision thing, but I can't make it work. Won't copying the serach area and doin ga suicide effect simply make it serach for units still? I can't seem to make my projectile suicide when it nears a cliff (I'm using Cliff level greater validator) how do I make it actually check for it instead of just using it as a condition but having it checking for units=?
Im working on a map. You control a unit with WASD and shoot with the Mouse. The point is to kill the other players unit. However im having problem making a projectile. When you click the left mouse button, the projectile is supposed to travel from your unit to the position you clicked with your mouse. If the projectile hits a wall, doodad, or an enemy unit, the projectile is destroyed and will deal damage if it hit a unit. This is where im stuck. Right now ive tried to add a behavior that applies a damage effect to the projectile, but that makes the projectile kill itself instead. I cant seem to make the projectile impact and deal damage. Any suggestion?
Also, Hi. This is my first post :P
yea, you need to make a 'behavior' on the projectile with a duration of 0/-1 that lasts forever, then a periodic 'search' effect, and a periodic duration of probably .1 or .01 as your projectile will be moving fast. then on the search effect, make it filter out for just 'enemies' and do a 'set' effect. the 'set' effect would do 'suicide - kill self (refering to CASTING UNIT, not target), and a dmg effect of what you wanted.
im guessing its gonna be a fast projectile, it is difficult to make it have a search area thats small enough to look accurate but large enough so that when its moving that fast it wont 'skip' some units. there are work arounds for this, but i would suggest you start with a slow projectile and just get funtionality working and become familiar with the data editor.
there are a couple posts about how to make the projectile fast and accurate but heres my quick method;
make the behavior periodic effect a create persistent
make it do the the persistent like 4 times with offsets of (0,-.4) (0,-.8)(0,-1.2)etc... this would be assuming youre using a search radius of like .2 you may need to fine tune these numbers but hopefully you get the idea.
there is a method using markers where only 1 persistent will be allowed to hit the unit, as with just the above, potentially it will get hit by more than 1 of the persistents depending on its location.
my 'work around' was to apply a buff behavior that lasted .01 duration, and with each 'dmg' it validated that the unit not have the buff.
to make it so it will not hit cliffs, youre going to need to do the same as above copied so theyre both in a 'set' and make it so instead of a search/dmg done with each persistent it just does a 'suicide - kill self' of course targeting (casting unit, it starts out as 'target' by default i believe and will appear not working unless its changed) with a 'cliff level / pathable' validation, whatever validation you want to incorporate for your 'walls of sorts'
i dont believe this is the cleanest way, but ive seen much worse methods out there. ive used this way and gotten it working nicely with spot on accuracy and missile speeds of up to 60 (look beyond instant). hopefully you understand what im saying, if not, just take your time and take it 1 step at a time. first a missile that 'detects/searches' and self blows up. start with a slow speed of like 10ish. then move onto the next step and after a while youll understand the data editor. until you realize you only thought you did! haha....
edit; also, on the search/dmg portion if you want it do blow up like a missile it should be with a max target of -1, otherwise it owuld need a max of '1' so it would seemingly only hit 1 unit. the above .01 buff duration has 'potential' for random errors, but i have not experienced or noticed it ever yet the chances are so small. and when they would happen would be when everyone is shooting at the exact same target with incredible odds and you wouldnt be able to notice anyways. oh well, GL!
Its working now thanks alot :D The SC2 Editor is way harder than the WC3 one. :P
I might post here later if i run into more trouble. :P
I'm trying to do the cliff collision thing, but I can't make it work. Won't copying the serach area and doin ga suicide effect simply make it serach for units still? I can't seem to make my projectile suicide when it nears a cliff (I'm using Cliff level greater validator) how do I make it actually check for it instead of just using it as a condition but having it checking for units=?
bump