• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

How to make a continuous non-targeted attack

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I am hoping someone can give me an outline on how to do the following:

I have a movement system for moving my car around. I want to make it so that when the player holds down the "Q" key, the car fires forward machine guns. These guns fire instantly, and hit the first target in a straight line away from the car.

I've broken it into 3 parts I think:

1: Detect firing. I was planning on just having a dummy button for "Q" and detecting the pressing of the key manually. Is that a good idea?

2: Find target. This I'm not sure about. The only thing I could think of would be a "While Loop" that updates a "distance" variable and goes distance + 1 from car and looks for enemies in a range around that point, then distance + 2, then distance +3, until it reaches max distance or finds a target enemy. But that seems very very computationally expensive.

3: Damage target. I assume the easiest thing would be a to put some special effect on the target and do damage via the same trigger that finds the target.

If anyone can help with any of these steps, please let me know. Also, if you can think of more efficient ways to do this, that would be great.

p.s. One thing I thought of that seemed impractical would be to have a weapon that does damage in a line (like the flamethrower as I recall) and have the car attack an invisible unit that is moved in front of it at all times. But that seemed very odd and hard to work with.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
p.s. One thing I thought of that seemed impractical would be to have a weapon that does damage in a line (like the flamethrower as I recall) and have the car attack an invisible unit that is moved in front of it at all times. But that seemed very odd and hard to work with.
Why bother with something that complex... Just make it fire a flamethrower like effect chain towards a point infront of the car. Infact, all you need to do is make it so that the ability has a slight cast time and that it fires the effect foward towards a point and this whole thing is doable in the data editor.

When you hold Q it will repetitivly cast the Q bound ability. This ability then fires a flamethrower like effect chain towards a point infont of the car. A cast delay is used so as not to fire the cooldown error noise and still control its attack rate.

I say it is definatly worth a shot at this solution, even if it turns out that it is not good enough for use.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Why bother with something that complex... Just make it fire a flamethrower like effect chain towards a point infront of the car. Infact, all you need to do is make it so that the ability has a slight cast time and that it fires the effect foward towards a point and this whole thing is doable in the data editor.

When you hold Q it will repetitivly cast the Q bound ability. This ability then fires a flamethrower like effect chain towards a point infont of the car. A cast delay is used so as not to fire the cooldown error noise and still control its attack rate.

I say it is definatly worth a shot at this solution, even if it turns out that it is not good enough for use.

That sounds very good thanks. I'll give that a shot later today when I get home. I hadn't thought it was possible to have an attack that didn't target a unit though. I'll have a look later though and let you know how it goes.

Thanks again. Will +rep when I can.
 
Status
Not open for further replies.
Top