HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ranged attack logic

10-07-2002, 11:53 PM#1
Ari
I'm making a map in which I want units to always hit their targets when attacking higher ground. Normally, 25% of the time a ranged unit will "miss" their target when it is located on a higher cliff level than they are. I'm looking for a way to do away with this.
Ok, fine so far. At first I assumed that this was hard coded and completely out of my hands. Then I realized that riflemen, in fact *never* miss a higher target. On closer examination in WE, I figured out that this was because their attack is "instant" instead of "missile." Ok, obvious solution, then - make all ranged units instant. Problem: although I'd hoped otherwise, "instant" attacks ignore projectile art and speed fields and do exactly what they should do - create an instant attack.

Ok, I thought. so what if I enable the second attack of a non-rifleman ranged unit and make *it* an instant attack while making the missle attack deal onlyminor damage? Problem: the second attack only connects when the first attack connects - in other words, it acts as an instant attack for the purposes of artwork (no visible projectile) but as a missile attack for the purposes of actually hitting the target. Ditto if I switch the orders. Now I have a ranged attack that always hits and never shows artwork.

My game is turn-based and depends on the "attack-once" command actually connecting with the target. There's probably some weird way I can cope with this using triggers, but if anybody knows a way to make ranged units *always* hit *and* show the ranged attack, I'd love to hear about it.
10-08-2002, 04:01 AM#2
Guest
You can edit the Units\MiscData.txt and change the percent miss there (I think that was the file). But you can't load that file by just putting it in a map, you would have to pack a war3patch.mpq file with your map and distrubute it like a campaign (like RoK did).

If you want more detailed info on how to do it ask, this is what I am doing for my mini campaign.

EDIT: Yup, its that file. Look for these lines

// missile chance to miss if target is moving or on high ground
ChanceToMiss=0.25

EDIT2: I am trying to do it all in we right now, cause this way is pretty much only viable for single player campaigns.
10-08-2002, 04:48 AM#3
Guest
if its turn based and the other guy is in the same position all the time while ua ttack
use artillery
it never misses upslope
but it will miss if the other guy can move during the time (of course..)
10-08-2002, 08:00 AM#4
Ari
Thanks for the suggestions. Unfortunately, i'm trying to implement this in multiplayer as well, so I guess I'll look for some trigger-based function. A unit which is "artillery" can still miss elevated targets. I just tested on a map, and a mortar team misses just as often as an archer. However artillery won't miss when "attack ground" is the issued order (which is, in fact targetable on a single unit - neat trick for playing multiplayer), and this order automatically becomes available to all "artillery" units. However, I'm using the "attack once" order in my trigger, and there doesn't seem to be a simple way to "attack *ground* once". Maybe the next step is to try an attack ground order on a unit, wait .5 seconds, and then a stop order.
10-08-2002, 03:39 PM#5
Guest
Maybe you can make a tiny unit that does no damage, but fires the arrow model at the same time as the actual person shoots their instant weapon. And have a trigger to teleport this tiny unit (maybe make it fly at the level of the bow) to wherever it's master unit is at all times.