• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Adding certain abilities to triggers

Status
Not open for further replies.
Level 3
Joined
Jul 23, 2008
Messages
29
Hey again, Hiveworkshop.

I remember thinking about something some time ago and I've began to wonder about it again. I've tried all the possibilities of trigger event commands but the trigger didn't work.

Now, to get to the point:
How on earth do you add an ability like Critical Strike to a trigger? From my experience, none of the Spell (Ability) commands worked. (Begins channeling, starts the effect, etc.)

Thanks for your answers :)

-Aljo
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
First you need to create a damage-detection system:

Add these actions in the map init-trigger:

  • Actions
    • Set TempUnitGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
      • Loop - Actions
        • Trigger - Add to Critical Strike <gen> the event (Unit - (Picked unit) Takes damage)
        • Trigger - Add to Other Passive Ailities <gen> the event (Unit - (Picked unit) Takes damage)
    • Custom script: call DestroyGroup(udg_TempUnitGroup)


Then, create a trigger that activates whenever a unit enters the map and do about the same:

  • Trigger
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Critical Strike <gen> the event (Unit - (Entering unit) Takes damage)
      • Trigger - Add to Other Passive Ailities <gen> the event (Unit - (Entering unit) Takes damage)


So, this is the damage detection.

Then create this trigger for the critical strike:

  • Critical Strike
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
          • Unit - Cause (Damage Source) to damage (Triggering unit), dealing ((Damage taken) x 1.20) damage of attack type Spells and damage type Normal
          • Set TempLoc = (Position of (Damage Source))
          • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempLoc)
        • Else - Actions


This will do: 25% chance to deal 2.2x damage

Now your critical strike and any other passive attack-abilities are triggered... (it's better, since you can change the chance with the attributes, or items carried or something).

Note: that the damage dealt is already x1 (the original damage), so "(Damage Taken) x 1.00" is actually 2x critical damage.

Note: The event "Unit - A unit Is attacked" is NOT a good damage-detection system and I advice you not to use it (for this).
 
Last edited:
Level 3
Joined
Jul 23, 2008
Messages
29
Thanks, ap0calypse!

+rep

So, just to make sure I got you right, I should still add a critical strike ability to the unit, but set its chance and attack bonus to 0 and base it completely on triggers?

Edit: No, sorry, I didn't check the triggers well enough. I've made another condition regarding units having specific buffs for this trigger to work.

-Mystery Solved
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Thanks, ap0calypse!

+rep

So, just to make sure I got you right, I should still add a critical strike ability to the unit, but set its chance and attack bonus to 0 and base it completely on triggers?

Edit: No, sorry, I didn't check the triggers well enough. I've made another condition regarding units having specific buffs for this trigger to work.

-Mystery Solved

Ahh, allright, good that you solved it yourself ;)

If you do it triggered, you indeed need to create the ability and set everything to 0.
 
Level 3
Joined
Jul 23, 2008
Messages
29
Oh, just one thing
I had to replace "attacking unit" with "damage source" and "attacked unit" with "triggering unit", else the trigger didn't work.
I imagine being it like that because the "Takes damage" is quite a 'global' function - it takes everything from spells, normal attacks and even reactive damage into account.
But nevertheless, thank you for your help :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Oh, just one thing
I had to replace "attacking unit" with "damage source" and "attacked unit" with "triggering unit", else the trigger didn't work.
I imagine being it like that because the "Takes damage" is quite a 'global' function - it takes everything from spells, normal attacks and even reactive damage into account.
But nevertheless, thank you for your help :)

Right, sorry ^^ I made it in a rush - I didn't realise that at the moment.
Have fun mapping...
 
Status
Not open for further replies.
Top