• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Attacking WHILE moving!

Status
Not open for further replies.
Level 7
Joined
Jun 16, 2008
Messages
253
Heya, would anyone have a clue where I could have a unit that can attack while moving? Movement can be artificial or anything.

Basically, I have a hero that can sit on the back of a horse with Move Unit instantly, but he obviously can't attack this way.

I would like him to be able to attack from the back of a horse while 'holding position', meaning that the horse is moving, and he'll be moving along with it, but he'll attack units that come in range as if he is remaining still.

Does anyone have any ideas at all? Would be a huge help, as I could use it for many other things as well.

It should be possible, after all they did it with Starcraft tanks didn't they?
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
actually, they blizzard hasnt done any attacking while moving, but theres atleast 1 unit in starcraft 2 that will showoff attacking while moving. well first off, your hero is gonna need a special animation i think. look at pyramidhe@d's space marine model, its got a run/attack anim. it could probably be done through triggering/abilities, but i personally dont know how. the closest i can think of is like using immolation... but that obviously wont work. and anyways, a melee attacking while moving will screw up some things like the chance to miss if the target is moving. i dont know if the game thinks the target is moving or not.
 
Level 7
Joined
Jun 16, 2008
Messages
253
I'd rather not simulate the hero attacking, I really would prefer a method of just getting him to do his thing, while being thrown around by a trigger.
Ideally, I wanted to be able to 'attach' him like a special effect to the horse, with him still able to do all his usual stuff, bar movement. I stuck up a thread before about it, but we couldn't really come upp with a workable solution.
And just so you know, I don't want to just use a special effect because you can't target a special effect, damage it or select it. Perhaps something might be possible using a dummy unit inside the special effect, I don't know, but that sounds a bit iffy too.

And I don't really want to have to recreate all my units into moving bunkers, but out of curiosity would that work? I would have thought that as soon as you order the 'bunker' to move, that would do the same thing as everything else, prevent it from attacking.
If it does work, it might still be useful however, in other areas I can think of.

But before all that, I'll give mindworx a pm!

P.S I was sure that the tank turret could fire on enemies while trundling away... Oh well, I haven't played Starcraft much since I was a kid. Like... five years ago...
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
It is actually pretty simple, instead of using the GUI function Move Unit Instantly, you need to use, the following jass natives: SetUnitX(unit, real), SetUnitY(unit, real), the reason you use those, is because they don't interrupt what the unit is doing. I can give you an example if needed.
 
Level 7
Joined
Jul 20, 2008
Messages
377
MindWorx has it. Simply make the hero flying or have zero collision when you mount, then constantly SetUnitX/SetUnitY it to the position of the horse. In addition, also consider changing that unit's facing direction to match the mount's facing direction. Remember, when changing facing, it only works when the unit is stopped (that is, not moving or attacking). Thus, it should look flawless visually as the unit will attack from atop its mount.
 
Level 7
Joined
Jul 20, 2008
Messages
377
Ever Played Battleships? all the weapons are made from it.

The original phoenix fire just has a super low cooldown, which you can raise to a reasonable attack speed. however it will randomly choose who to attack.
Except Phoenix Fire will not really help. It doesn't play an animation for the unit you have the ability on, it only does special effects. I believe Alakon wanted the unit to attack (VISUALLY too) while on a mount. Just look at my previous post. That's the how.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Heya thanks for all the replies guys, sorry it took a little bit for me to post back, but we're having a little bit of a Day After Tomorrow crisis in NZ at the mo. Seriously, massive storm, power is all out, subsattions are blitzed, no water, we are trapped up here in the village because massive several hundred year old oak trees etc have been ripped up by the wind and blocking the road.
I looked at it on the net, and funnily enough it looks like a cyclone. It's a bit funny cos i just watched Day After Tomorrow and everything that's happening is so reminiscent, it's awesome! I'm excited! (Phone line's have been restored, this laptop has a fresh battery)
I've been milking the novelty for all it's worth, filtered rain water, baths of cold water dredged from the river, filling up chilly bins with fresh water for the double purpose of milos and keeping the most essential necessities cold, like my beer.
Even though I could just have a mate pick me up and take me to his place where they have power, but that'd kill the whole experience!

Anyways... Cheers MindWorX for getting back to me, and I think pretty much your suggestion has solved it! This is so hassling me because obviously my PC doesn't have power, I was lucky it didn't blow up like it did with my next door neighbour. (As well as plasma TV, amp etc... he's a tech crazy guy, bet he's regretting it now...)
My TV did though, :(, the smoke made me sick. Lucky it was only worth a hundred bucks, hopefully I can convince the insurance that it was a plasma too. :D

(And I can't really look at the YouTube video :(, I'm on dial-up and have a MB limit which is tiny,tiny. I can't even upload more than 5 pics in a month.)

A quicky question though. Say I have some massive Giant dude, and I want to have my unit (Move Instantly) attach to his hand like a special effect. In other words, the unit's orientation and all that would act the same as if I went Create Special Effect on Unit's Left Hand etc...
Though I suppose flying height and all that would have to be played with as well.
(Btw, what does Orientation Interpolation mean? I've always wondered.)

But if there like a Move Unit Instantly to X,Y,Z of Left Hand of Unit? Any provision like that? No real biggy if there isn't, but would be neat if there were.

Anyway, that's so awesome, thanks HEAPS MindworX for telling me about that, I never would have thought of using real co-ordinates, I wouldn't have known it makes a difference, and it should allow me to do all I want to do. Dammit, wish I had a computer with power. We could be without for up to two weeks, and we live right next to the power station! My nana and koro get power off the same power station, and they rung up to say that their power was restored in a town over 100km away! What's up with that?

Guess I better stick a notice in my main thread that I'm having technical difficulties for the next two weeks. Oh well, gives me a chance to work on mah story. (Ever notice how dark it is during the day time when it's cloudy and you got no lights? I couldn't even read a book!)

EDIT: Also, thanks once more Soga, for the hint about unit facing! I wonder if it's okay to put someone's name on the credits more than once? Hmm... Lot's of cookehs! That's the best answer. When I have at least 10 rep, or else I just give lots of repless cookies, which is a bit discouraging. (I was getting a whole lot of these, and I thought it was because ppl were being stingy and not approving me. Not sure if I'm happy or not with the truth of it. :(. Grr! )

Wait hang on, I've already got it at the moment Move Unit Instantly and set it to the facing of the horse. Will this facing (when using the co-ordinate version) only apply when the unit is stopped, or will I have to make a seperate action of Change Unit Facing over blah seconds or something?
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
i kidna lost you there. but referring to the youtube video, you can actually see from the command buttons that the tank isnt actually attacking. he mightve made two seperate models and attached them somehow, some what like the cannon tower.
 
Level 7
Joined
Jul 20, 2008
Messages
377
Wait hang on, I've already got it at the moment Move Unit Instantly and set it to the facing of the horse. Will this facing (when using the co-ordinate version) only apply when the unit is stopped, or will I have to make a seperate action of Change Unit Facing over blah seconds or something?

Don't use Move Unit Instantly. Sounds to me like you're not using JASS here. Just use these custom scripts:

call SetUnitX(yourunit, newxposition)
call SetUnitY(yourunit, newyposition)

These do not interrupt an unit's actions, unlike "Move Unit Instantly" which will interrupt your unit and make it unable to attack.

As for the facing, just as long as you're constantly setting the unit's facing, you'll be fine. I would prefer to have a periodic trigger repeatedly setting the unit position AND facing. The set unit facing function only affects the unit when it is stopped, so if the unit is in mid-attack, it will not change its facing. It might look a bit odd, though, if your horse was moving around the target.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Oh yeah, I understood the concept, I'm just saying that's how it was like already, and I didn't exactly know how the jass version might work, if you had to put in a facing as well.
But ok, facing is done seperately.
Odd? I would have thought it would be fine if facing only changes when unit is stopped.

Hey, so say the rider takes a swing, but before swing is completed, he is moved (instantly) to the other side, if he is still in range, will he still complete the attack?

And if it doesn't interrupt orders, could I flip unit's all over the place and they will still try to run to the same place they were trying to get to before?

If all the above is true, do not pass GO, go directly to AWESOME!
 
Level 7
Joined
Jul 20, 2008
Messages
377
I would imagine the unit would finish its attack. And yes, I also believe units will still try to run to the same place they were trying to get to before. I think I saw this happening in Warlock Brawl (a map).
 
Level 7
Joined
Jun 16, 2008
Messages
253
Play my next update! It shud be funz! I promises to put some semi-related interesting stuffs in it my precious... Promises!
 
Status
Not open for further replies.
Top