• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to make unit miss on attack ?

Status
Not open for further replies.
Level 11
Joined
Jul 28, 2007
Messages
920
Y, friend told me about curse after i posted but, here what i want.
I have 3 units, and each of those units have chance to hit, or chance to miss other units, any unit. And when i build specific building, this miss/hit chance must change. Lets say it was 20% to miss before, and now its 10%. So ? Curse wont work right ?
Dr. Super Good, btw i mentioned unit has chance to miss PER ATTACK.
And how can i add buff ? I mean, can i add only buff to unit ?
 
Last edited:
Still I keep my opinion, use Curse.

Whenever a unit start attacking create a dummy (locust, no model unit) that cast Curse with the desired miss-chance. You can make each level has 10%/20%/30%... and set the level of Curse for the dummy right after creating it. This is the way to add a buff to a unit.

Don't forget to remove the Curse buff from the attacking unit before ordering the dummy to cast Curse on it, otherwise it won't cast.
 
Level 11
Joined
Jul 28, 2007
Messages
920
So, when unit is attacking, if specific building is on map, create and order dummy to cast level 2 curse on attacking unit, otherwise, if there isnt building cast level 1, and remove buff before, and remove dummy afer cast. right ?
 
Yes, that's it. Just one more note, to remove the dummy use the action Unit - Add Expiration Timer. This will kill the dummy after a specified time. 2.0 seconds are enough :D

Remember that if you do:
  • Unit - Issue (Last Created Unit) to Undead Banshee - Curse (Triggering Unit)
  • Unit - Remove (Last Created Unit)
The (Last Created Unit) will NOT have time to cast the ability, as it will be removed almost instantly.
 
Level 11
Joined
Jul 28, 2007
Messages
920
  • Give curse
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (heavy)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (medium)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (unarmored)
          • ((Attacking unit) has buff No Radar ) Equal to False
        • Then - Actions
          • Unit - Create 1 Dummy (DropCurse) for Player 1 (Red) at (Random point in Left Start <gen>) facing Default building facing (270.0) degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
          • Unit - Remove (Last created unit) from the game
          • Game - Display to (All players) the text: curse
        • Else - Actions
This fine, no leak ?
 
I guess it won't work the way you want...
It would curse only these three buildings and if it does not have "No Radar"

You leak a location in Random point in Left Start. Set a variable to that point and use the variable instead (also you'd better create the dummy at the position of the attacking unit).

And use Unit - Apply Timed Life instead of Unit - Remove.

And if you want Buildings to be cursed too, don't forget to allow it to be cast on buildings.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
bboy-tiger-, firstly that does not work as the unit is removed before it can cast the spell.
Secondly it leaks a location.

In this situation, as I guess it will be used a lot, I recommend recycling dummies as much as possiable as creating and removing units is quite preformance intensive for every time it innitiates the attack process.
By this I mean devising a system to eithor update the curses less often using your current method or to make a system which will not bug but can recycle dummies so that they are not removed (logically means that is must store more than one dummy and can adjust to variable load).

I would recommend making the curse last infinatly and maybe just updating it for all missle turrents when needed. Eg when they are built or when a certain building is built. This should have the same effect as your current system but be more efficent.
 
Level 11
Joined
Jul 28, 2007
Messages
920
Lol that critical might work, but for now curse works fine, watch this, and ummy casts spell even there is remove ability, tested it.

  • Give curse
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- NoRadar --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Radar_enters_Map[(Player number of (Owner of (Attacking unit)))] Equal to 0
          • ((Attacking unit) has buff Miss Chance 25% ) Equal to False
          • ((Attacking unit) has buff Miss Chance 20% ) Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (heavy)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (medium)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (unarmored)
        • Then - Actions
          • Unit - Create 1 Dummy (DropCurse25%) for Neutral Passive at CursePoint facing Default building facing (270.0) degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Radar_enters_Map[(Player number of (Owner of (Attacking unit)))] Equal to 0
          • ((Attacking unit) has buff Miss Chance 15% ) Equal to False
          • ((Attacking unit) has buff Miss Chance 10% ) Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (PH) (unarmored)
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (AAH)
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (HH)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Attacking unit) has buff Miss Chance 25% ) Equal to True
                  • ((Attacking unit) has buff Miss Chance 20% ) Equal to True
            • Then - Actions
              • Unit - Remove Miss Chance 25% buff from (Attacking unit)
              • Unit - Remove Miss Chance 20% buff from (Attacking unit)
            • Else - Actions
          • Unit - Create 1 Dummy (DropCurse15%) for Neutral Passive at CursePoint facing Default building facing (270.0) degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
      • -------- Radar --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Radar_enters_Map[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 1
          • Or - Any (Conditions) are true
            • Conditions
              • ((Attacking unit) has buff Miss Chance 25% ) Equal to False
              • ((Attacking unit) has buff Miss Chance 25% ) Equal to True
          • ((Attacking unit) has buff Miss Chance 20% ) Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (heavy)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (medium)
              • (Unit-type of (Attacking unit)) Equal to Missile Turret (unarmored)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Attacking unit) has buff Miss Chance 25% ) Equal to True
            • Then - Actions
              • Unit - Remove Miss Chance 25% buff from (Attacking unit)
            • Else - Actions
          • Unit - Create 1 Dummy (DropCurse20%) for Neutral Passive at CursePoint facing Default building facing (270.0) degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Radar_enters_Map[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 1
          • Or - Any (Conditions) are true
            • Conditions
              • ((Attacking unit) has buff Miss Chance 15% ) Equal to False
              • ((Attacking unit) has buff Miss Chance 15% ) Equal to True
          • ((Attacking unit) has buff Miss Chance 10% ) Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (PH) (unarmored)
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (AAH)
              • (Unit-type of (Attacking unit)) Equal to Greater Missile Turret (HH)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Attacking unit) has buff Miss Chance 25% ) Equal to True
                  • ((Attacking unit) has buff Miss Chance 20% ) Equal to True
            • Then - Actions
              • Unit - Remove Miss Chance 25% buff from (Attacking unit)
              • Unit - Remove Miss Chance 20% buff from (Attacking unit)
              • Unit - Remove Miss Chance 15% buff from (Attacking unit)
            • Else - Actions
          • Unit - Create 1 Dummy (DropCurse10%) for Neutral Passive at CursePoint facing Default building facing (270.0) degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Captain Griffen, even still there are triggers which change unit ownership? In which case you could exchange it instantly. Even still, if that fails, you could just up it to 1 dummy per player.

In certain cases you need to do that, I think for DoTs so that credit for the kill gets correctly assigned (possibly also for spawn on death spells). Also if you use damage detection / on death triggers, and try to get the damage source / killing unit's owner.
 
Level 9
Joined
Jan 14, 2008
Messages
366
without checking for what was already said, (i checked your explanation on what you want)

i have two suggestions:

1. the trigger based way (should work flawlessly)

- manipulating game constants, make an attack type deal 0% to every armor type.
- that the units still show attack damage in the unit UI.
- now have the miss chance for everyone of those units stored in an integer/real array.
- everytime one of those units attacks, run a trigger wich creates a random integer with a number from 1 to 100.
- if number is "less or equal" to the units "miss chance", the unit misses, and you have a "miss" floating text pop up.
- if number is greater, you have the damage dealt per trigger (can even deal splash).
- also if you want to deal splash, but miss, you can have the damage dealt but slightly distorted to a random angle.

pros: you can instantly alter "miss chance" depending on the kind of unit attacked.
for instance, hero attacks a fucking huge giant, miss chance is set to 1%, he attacks a tiny fly, miss chance is set to 90%. stuff like that.

cons: if you want this "miss chance" on every unit and not just heros or a smaller group you will have to store every unit in an array, wich could mean some trouble, depending on the map style.



2. ability based

- critical strike and bash, can make the unit with the ability miss on attacks, without the units having any chance to deal bash-damage-stun or factorised-critical-damage.
- therefore you could whenever a unit attacks another one, instantly change that units custom "critical strike with no chance to deal increased damage but chance to miss" to the corresponding one (for the kind of unit attacked).





im pretty sure that will help you, and sry if it has already been suggested.
dont bother +reping. i dont care about rep.
 
Level 9
Joined
Jan 14, 2008
Messages
366
just checked some awnsers.

if you go with dummy, give the dummy 3 hp base, and a -1 regeneration.
and give the spell a 5 second cooldown (or anything above 3).
then have another separate trigger, wich removes every dummy upon death.

its that easy. and its 100% leakless.
 
Level 24
Joined
Oct 18, 2008
Messages
942
2. ability based

- critical strike and bash, can make the unit with the ability miss on attacks, without the units having any chance to deal bash-damage-stun or factorised-critical-damage.
- therefore you could whenever a unit attacks another one, instantly change that units custom "critical strike with no chance to deal increased damage but chance to miss" to the corresponding one (for the kind of unit attacked).

the miss chance in crits means if crit will alvays hit even if enemy has evasion or not.
 
Level 10
Joined
Aug 19, 2008
Messages
491
Why not try like

  • haha
    • Events
      • Time - Every 1 seconds of the game
    • Conditions
    • Actions
      • Unit Group - Pick all heroes(?) and do Actions
        • Loop - Actions
          • Unit - Create 1 Dummy for Who? at Who?'s position facing something...
          • Unit - Set level of Curse to (Percentage chance?)
Just make the Curse ability have 100 levels and each level giving 1% chance to miss.

You'll have to develop this yourself, I didn't think through this before I posted.
Maybe you can make a trigger yourself about this?
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Maybe I'm just being a fool, but can't you just give evasion to units? You know the spell maybe?

If you want it realistic, give units with heavy armors less evasion then units with light armor, and for archers just don't make their arrows follow the unit. (So make them like cannon.)

That would be so much more easy?
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Maybe I'm just being a fool, but can't you just give evasion to units? You know the spell maybe?

If you want it realistic, give units with heavy armors less evasion then units with light armor, and for archers just don't make their arrows follow the unit. (So make them like cannon.)

That would be so much more easy?

Except we want to make one unit miss, not all units miss.
 
Level 3
Joined
Feb 3, 2005
Messages
36
So my idea is kinda out there and might not make any sense or be useful to you but if you don't mind hearing me out then continue reading my post.

A possibility is to use the critical strike (damage bonus) ability.

Change critical "damage multiplier" to 0 and increase "damage bonus" to desired damage for the unit to deal. Then change chance to critical to whatever % the unit has to hit for desired damage. There will be no number displayed above the attacking unit's head. The actual unit should probably display a damage of 0-0 or something small (1-5?) for variable damage. For example: When the unit misses it deals minor damage (displayed damage on unit stats) and if it hits it will deal normal damage (critical ability damage bonus). Unfortunately the damage will be registered as spell damage and be reduced as such (normal defense would be useless against it) correct me if i'm wrong.

As for changing the miss factor: Create multiple critical abilities with different "chance to critical strike" %'s. Don't give the ability to the unit in the object editor. Instead add the appropriate % chance to critical ability to the unit as it finishes training based on whatever building is currently owned.

EDIT: oops i didn't notice there was more than one page on this topic. The process i described might have already been explained. >< my bad!
 
Status
Not open for further replies.
Top