• 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.

[Trigger] Miss Chance with Curse

Status
Not open for further replies.
Level 2
Joined
Jan 6, 2013
Messages
11
Hello, I've just returned to mapmaking after a number of years, I was pretty advanced previously, but now I've gotten rusty.
Anyways, I'm trying to give my units a miss chance on attack using a custom version of the "curse" spell (varies from unit to unit). Right now, the trigger works and the spell is cast, BUT the triggering attack never misses (subsequent attacks for the curse duration DO miss, however... I've tested in game by extending the duration). Of course, I want the triggering, initial attack to miss, and not have the spell stick around.
I know my curse spell works because I tested it with a regular, non-dummy unit in-game (100% chance to miss).
My problem in a nutshell: The attack seems to be resolved before the effects of the curse spell are factored in, resulting in a 100% hit rate. Here is my trigger:

  • Battle Engine
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- 40% MISS chance --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Spearman
        • Then - Actions
          • Set Random = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Random Less than or equal to 40
            • Then - Actions
              • Set Point = (Position of (Attacking unit))
              • Unit - Create 1 Dummy for Neutral Extra at Point facing Default building facing degrees
              • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_Point)
              • Floating Text - Create floating text that reads x above (Attacking unit) with Z offset 10.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 25.00% transparency
              • Floating Text - Change the fading age of (Last created floating text) to 1.25 seconds
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            • Else - Actions
        • Else - Actions
Thanks for reading and any help is greatly appreciated :)
 
Level 2
Joined
Jan 6, 2013
Messages
11
Sorry, I'm not seeing a "takes damage" event in the generic unit events. There is a "take damage" event in the specific unit events, which might be what you're thinking of, or maybe I'm just blind?
 
Level 4
Joined
Jan 27, 2010
Messages
133
This might perhaps be a solution:

If you always want pikemen to have 40% miss chance; set up curse to last for like 9999999 seconds (with 40% miss chance) and cast it when a pikeman enters the map.

Otherwise you could use a damage system and script the whole thing :grin:
 
Level 2
Joined
Jan 6, 2013
Messages
11
While that could work if all else fails, I'm hoping to avoid that because I want to be able to modify the miss chance of units depending on external variables for each attack (for instance, "regular" units have a increased chance to hit "larger" units. Similar to the D&D size system). Also, to add on to what you were saying, a potentially helpful tip: I'm pretty sure a value of '0' on curse makes it permanent.

As for the damage system, although my first choice would be to solve it through GUI triggering, if you have any/know of tutorials to point to, I'm all ears! :)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
While that could work if all else fails, I'm hoping to avoid that because I want to be able to modify the miss chance of units depending on external variables for each attack (for instance, "regular" units have a increased chance to hit "larger" units. Similar to the D&D size system). Also, to add on to what you were saying, a potentially helpful tip: I'm pretty sure a value of '0' on curse makes it permanent.

As for the damage system, although my first choice would be to solve it through GUI triggering, if you have any/know of tutorials to point to, I'm all ears! :)

what i meant by damage event...

http://www.hiveworkshop.com/forums/...e-v2-2-1-0-a-201016/?prev=d=list&r=20&u=bribe
 
Level 4
Joined
Jan 27, 2010
Messages
133
The drawback with a damage system is that you must use some method for differentiating spell-damage from attack-damage.

The old solution was to add an orb-ability to all units, if the damaged unit had the buff, then it was a normal attack. This caused map termination with splash :p (and confliced badly with other orb-abilities)

A more modern solution is to script all spell-damage. That way, the system knows that if the damage wasn't flagged as spell damage, it was normal damage.

So, if you don't use spell-damage in your map (or if you are just really comfortable with scripting), then there are a bunch of systems to use. For instance this :p
 
Level 2
Joined
Jan 6, 2013
Messages
11
Thanks, I am doing it on a grand scale, here's an example from the engine I made so far:

  • Battle Engine
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- 20% MISS chance --------
      • 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 Swordsman
        • Then - Actions
          • Set Random = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Random Less than or equal to 20
            • Then - Actions
              • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Random real number between 0.00 and 1.00))
              • Floating Text - Create floating text that reads x above (Attacking unit) with Z offset 10.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 25.00% transparency
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            • Else - Actions
              • -------- Unit TYPE --------
                • -------- swordsman --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Unit-type of (Attacking unit)) Equal to Swordsman
                  • Then - Actions
                    • Set Damage = (Random real number between 15.00 and 20.00)
                    • Set Critical = (Random integer number between 1 and 10)
                    • Set Execute = (Random integer number between 1 and 20)
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Critical Less than or equal to 1
                      • Then - Actions
                        • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Damage x 2.00) damage of attack type Chaos and damage type Normal
                        • Special Effect - Create a special effect attached to the head of (Attacked unit) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
                        • Set SpecialEffect = (Last created special effect)
                        • Special Effect - Destroy SpecialEffect
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Execute Less than or equal to 1
                          • Then - Actions
                            • Set Point = (Position of (Attacked unit))
                            • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 300.00 damage of attack type Chaos and damage type Normal
                            • Unit - Create 1 Special Effect: Skull and Bones for (Owner of (Attacking unit)) at Point facing Default building facing degrees
                            • Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
                            • Custom script: call RemoveLocation(udg_Point)
                          • Else - Actions
                            • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing Damage damage of attack type Chaos and damage type Normal
                  • Else - Actions
        • Else - Actions
I looked at the others out there, and they look good but it's easier for me to just make my own then figure out how to use somebody else's lol.
 
Level 6
Joined
Nov 24, 2012
Messages
218
I think I might know why the triggering attack never misses.
Some of my dummy units have to face to right direction to cast, so it sometimes takes >0.3 seconds.
There may be a setting for instant cast, I don't know. There probably is.
Well, I managed to do instant cast when I made turned that dummy unit into a structure.
Also all the dummy unit values are 0 especially animations.
I really needed this when I had to make a spell do 100 crushing waves over 2 seconds =P (for some reason it doesnt lag idk XD).
 
Sorry, I'm not seeing a "takes damage" event in the generic unit events. There is a "take damage" event in the specific unit events, which might be what you're thinking of, or maybe I'm just blind?
Specific Unit event. It does not exists in General Unit, but it's possible to use a Damage Detection System that would give you the possibility to have a "Generic Unit" one.
 
Status
Not open for further replies.
Top