HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make ability "miss" unit?!

05-04-2004, 01:20 PM#1
PatruX
Well, I have shadow strike on a hero.
Missile Homing Enabled = False
Missile Speed = 600

And I want it to be able to miss the unit I cast it on if he dodges it (Move away from the projectile)
But since it's a ability and not a normal attack, it always "hit" him, even if he's moving far away from where the shadow strike hits..
But I want to make it so that you can dodge it.

Help please! :(
05-04-2004, 01:39 PM#2
th15
Hmm. This could get quite complicated. This is what i would do:

Make the actual ability a dummy ability. Something like a shockwave that does 1 dmg, has 1 range but casting range 800 (or whatever range you want the skill to have). You can make shockwave target only ground units and not terrain or you could use any spell that usually targets enemy units.

Make a unit that is invulnerable and unselectable (give it the locust aLoc ability). Give it the model of the projectile you want to use (say, the shadow strike missile). We'll call this ShadProj. We'll give it a kaboom ability that does 1 dmg with 1 radius.

Make a unit that is invulnerable, unselectable and invisible (use " .mdl" as its model). Give this unit mana and the actualy shadow strike damage ability. This unit is called ShadCaster

Create a unit variable called ShadTarget

Have a trigger that looks like this:
Code:
Event
Unit begins casting a spell
Condition
Ability being cast = shadow strike dummy spell
Actions
Set ShadTarg = target of ability being cast
Create 1 ShadProj at position of casting unit
Issue order targeting a point - order last created unit to kaboom to position of target of ability being cast

And another trigger that looks like this:
Code:
Event
Unit dies
Condition
Matching unit type = ShadProj
Actions
Unit Group- Pick every unit within 200 owned by enemy of owner of dying unit and do:
    If:
         Picked unit = ShadTarg
    Then:
         Create 1 shad caster
    Else:
         Do nothing

A lot of work for what seems a simple spell. But my triggers can be optimized abit, for example you don't really have to use kaboom for ShadProj, but you'll have to do some pretty creative triggering (involving detecting when ShadProj arrives at the target point and stops moving).

Simply put, my triggers use a dummy spell to read the target the player picks. Then it uses a dummy unit projectile to simulate the missile that travels to the target. Finally, it checks if the original target was within the radius of the spell and if the target is found, it spawns yet ANOTHER dummy unit that actually does the zapping.

Of course you don't really have to spawn that last dummy unit, you could use triggers to simulate damage and slowdown but i find working within the wc3 engine easier than scripting tons of triggers to do things something that already exists does.

Incidentally, I'll be using similar triggers to do grenades. Largely because i need the grenades to sorta bounce along the ground (though come to think of it i could just use the makura spike ball projectile).
05-04-2004, 01:55 PM#3
PatruX
Very big thanks for your help, I'll start scripting..... After a meal :D !!
- BRB -
05-04-2004, 01:57 PM#4
th15
Oops, i realised that i forgot an action in that 2nd trigger. Still need to order ShadCast to actualyl cast the spell at the target. Also, you'll need to give ShadCast a life expiry timer of 1 or 2 seconds so that it'll remove itself once it's done casting.
05-04-2004, 02:08 PM#5
AoH
hey is really a useful idea...
di you come up with it now or when you started doing your granades?
05-04-2004, 02:09 PM#6
PatruX
Yeehaa!! It works perfect, I made some changes myself though, but you got my thanks!!! ^_^ ^_^ ^_^
05-04-2004, 04:05 PM#7
th15
Glad to help PatruX.

AoH, if you've tried my Tank Comanders map, I've got missiles that can be shot down that were made in quite the same way. But the truth is i've been itching to do grenades with true physics (as in they bounce off walls) but i could never perfect the bouncing off walls part so i'll just use them as straight up bombs for now... My other idea was to do volumetric flamethrowers but until i learn some proper JASS, that ain't happening.