HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random unit targeting

12-31-2003, 02:44 AM#1
Zealot888
Introducing a new an amazing unit! The outstanding Drunken Dwarf Sniper dubbed "Barney". Like a cross eyed gangsta with a mac 10 he rarely hits his target and often some poor guy standing nearby. This is because when he selects a target he attacks a random unit from within X radius of his target. I have somewhat of an idea of how to create this trigger, but not entirely. For now I'm using an archer with a projectile so I can more easily see that the attacker is selecting random targets.

Event:
Unit is attacked

Condition:
Attacking unit = archer

Action:
Order attacking unit to attack random unit within X radius of attacked unit.

The problems with the above trigger is that the attack animation is not drawn. So I tried adding "play attacking unit's attack animation" but nothing happens. I do believe I typed in "Attack - 1" correctly for the animation name. Is there a more efficient way of getting a ranged unit to attack random units around its original target and to have him do this when you attack area or hold position?
12-31-2003, 04:09 AM#2
Vidstige
Is any unit actually taking damage?
Have you tried increasing the X radius?
Does the trigger actually run at all?
Does it manage to select a target for the random attack?

If it doesn't get any clearer by answering these then I am sure I can think of I few more. ;)
12-31-2003, 04:24 AM#3
Zealot888
The trigger performs as it should but the animation doesn't happen. The original target takes no damage (unless he is the randomly picked unit from the unit group). The randomly selected unit does take damage. The radius doesn't need to be increased as it is already 300. The trigger actually runs.

I'm using the WE trigger editor. I have learned from hours of frustrating trials that unless it is absolutely necessary, do not go into custom text. Text is nice for polishing up a trigger, but to get it going the GUI is better IMO. Please can some one walk me through this, I'm really awful with triggers and scripts even thought I've been messing with them for some time. Like Spanish, I would understand it if you spoke it to me but I can't make sentances of my own yet.

If we could get this trigger working I would like to use a similar trigger for a drunken dwarven mortar crew :mtk:
12-31-2003, 01:33 PM#4
Vidstige
What happens if you add a delay (a few seconds) before the archer is ordered to attack the new target?

Does it work if you order another unit than the original archer to attack?

What I actually want to make sure with the above questions is that the archer isn't confused by the change of target, he might have started his animation attacking the first target, stopped it, and not been ready to start it for the new target...
12-31-2003, 08:27 PM#5
Zealot888
woo hooo! your wait idea appears to have worked.

I inserted 'wait .7 second' before the order to attack random target. It now has enough time to run the attack animation, and can be ordered to stop any time after .7 second (anything before the .7 second mark and the trigger will reorder the ranged unit to attack again). I wish there was a way to stop the reorder by commanding the unit to stop any time under the .7 seconds. I'm also not sure how to do a hold position with this as the unit will want to chase his target into the woodline.

Now doing mortar teams will be a bit trickier...