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

Chance On Hit?

Status
Not open for further replies.
Level 4
Joined
Jun 4, 2009
Messages
70
Hello there!

I'v tried to make any chance on hit trigger in the Trigger Editor, but well i just can't get it! I'v tried set varibles and even try to find precent chance in there but i can't make it!, anyone have any idea how to make chance on hit there, please tell me!
 
Level 3
Joined
Dec 22, 2007
Messages
28
You can make it with Event - Unit hits with attack. Then you define a random integer (e.g. between 1-10 if the chance should be 10%) and check wether the integer = 1.
Then you can run your actions.
 
Level 8
Joined
Dec 9, 2009
Messages
397
This is stright out of my map, so I know it works.

  • Holy Favor
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of (Attacking unit)) Greater than (>) 10
      • ((Attacked unit) is A structure) Equal to (==) False
      • (Unit-type of (Attacking unit)) Equal to (==) Paladin
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Greater than or equal to (>=) 90
        • Then - Actions
          • Set HeroIntR = (Real((Intelligence of (Attacking unit) (Include bonuses))))
          • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + HeroIntR)
          • Special Effect - Create a special effect at (Position of (Attacking unit)) using Abilities\Spells\Human\Heal\HealTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
 
Level 10
Joined
Mar 16, 2009
Messages
354
would it not work if you just gave the unit a dummy ability based off of critical strike (no effects of course besides the %chance) then make a trigger that was

unit starts the effect of an ability
ability being used equal to (=) Dummy(Critical Strike)
Pause casting unit
wait .01 seconds unpause casting unit

then all you would have to do is just modify the percentage in the ability.
not sure if the action will make the attack stop but I am mostly certain it will reset the animations before the strike lands.
 
Level 5
Joined
Sep 29, 2008
Messages
171
Well, from my dabbling in chance on hits, sometimes it can get confusing trying to remember who is who in a situation. The only way I've consistently gotten triggered chance on hits to work is to make a trigger based off of "a unit is attacked" + "attacking unit is <insert unit>" = "If : Level of the unit's chance on hit spell > 0 and random number between 1 and 100 =< whatever percent chance, then do the chain lightning or aoe or whatever the unit is going to do. My example goes off the page a long ways from arithmetic because of a complex number involving %current mana, level of the ability, etc. so I'll just post a simpler, easier-on-the-eyes version.

Event -
A unit is attacked

Conditions -
(attacking unit) equal to (unit-type(insert unit here))

Actions -
If/Then/Else (multiple conditions)
-Conditions - Level of (Chance on Hit Spell) of (attacking unit) is greater than 0
Random number from 1 to 100 less than or equal to 10 (or whatever the chance on hit is)

-Then - cause (attacking unit) to damage (attacked unit) for (however much you want in however big of an area)

-Else - leave it blank


Where it says deal damage, you can always tell it to create (dummyunitblah) at 0,0 from (attacking unit) facing (attacked unit) and then make the dummy cast whatever spell the chance on hit was gonna do.

If this is still confusing, I'll gladly try to recreate what you need over the weekend for you and add some trigger comments to tell you what each little part does. I hope that helps you for many maps to come.
 
Level 4
Joined
Jun 4, 2009
Messages
70
well i wonder that too, erm, if you use start effect of an ability it maybe works? I'll try. But i do actually got a chance on hit trigger now.
 
Status
Not open for further replies.
Top