HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Catching and eliminating attacks

09-02-2002, 11:51 PM#1
Ari
I'm trying to find a way to "catch" an attack order and stop it before it executes. This isn't to say I want a target to be invulnerable - that's easy enough. In my RPG map I want a player order to attack to be stopped and converted to a "attack once" order. In other cases, I want an attack order to be stopped altogether and converted to an attack once on a different unit entirely (an invisible target, for a "miss"). With invulnberability, a unit wouldn't be targetable in the first place, which is undesirable.

Initially, I started with a simple trigger:

event: unit owned by x is issued an order targeting (for example) an object
condition: order = attack OR order = smart (context mouse click)
action: 1) order unit to stop
2) various other stuff

This *almost* works, but some units can get an attack off before the trigger can run, especially, since I have other actions and conditions complicating matters (I've left all that junk out for simplicity's sake), and possibly slowing down the trigger by just enough to let things go through.

My current take, which I think will work involves going into the unit editor and changing all units to only attack neutral units. When a "smart" order is given by right-clicking on an ally(both teams in the rpg are on the same team to prevent auto-attacking) that target unit is changed to an (attackable) neutral character. Initially the "smart" is interpreted as a move order since the target unit is an "ally."

But this is a huge pain in the neck, not intuitive for anyone else who wants to use my triggers, and a pain for me to do as well. Can anyone think of an easier way of allowing AND disallowing attacks?
09-03-2002, 05:46 AM#2
Guest
there is an event specific unit takes damage, which activates before the unit actually receives the dmg... but it needs to be specific (pointed to a unit that is already spawned before the game has started)

other than that, i dont see any other events that can occur before the 'target is issued order'.... :(
09-04-2002, 07:02 AM#3
Guest
If this a ranged unit, you may be able to get away with changing the attack to "Artillery" and the Projectile Speed to something like "800" or even "400". Then, you'll probably have plenty of time to turn the targetted unit invunerable before it gets hit.

You could also try removing the unit's attack, so the unit's attack would be entirely up to triggers.

--nihilist
09-04-2002, 07:24 PM#4
h0pesfall
If you're just looking to make a unit invincible, but that can be attacked anyways, a simple way is to just increase his regeneration rate to very high numbers (like 1000) but keep him vulnerable.