• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Help with two small triggers

Level 3
Joined
Apr 10, 2023
Messages
11
Hey,
I require help with two small triggers. Any help will be highly appreciated :)

1.) I want to ensure that the target unit of a trigger belong to Player 12, but I can't seem to find a specific Condition for that. Probably missing something, but I dont really have experience in mapping.
  • RUA-Ability r1
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) = Tower of Divine Judgement
    • Actions
      • If ((Owner of (Attacking unit)) = Player 1 (Red)) then do (Unit - Cause (Attacking unit) to damage (Random unit from (Units within ((Real(RUA-AbilityCountP1)) x 200.00) of (Position of (Attacking unit)) matching (INSERT CONDITION RANDOM UNIT BELONGS TO PLAYER 12 (BROWN)), dealing 50.00 damage of attack type Spells and damage type Normal else do (Do nothing)
2.) This trigger does not work sometimes if units are close to the attacking unit. No idea why. Context: Casting unit is a stationary building with normal attacking capabilities. The triggering spell has a casting time of 0, mana cost of 1 and a cooldown of 10 seconds (and is based on Howl of Terror).
  • TUA-Ability t17
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) = Astral explosion
    • Actions
      • Unit group - Pick every unit in (Units within 2000.00 of (Position of (Casting unit))) and do (If ((Owner of (Picked unit)) = Player 12 (Brown)) then do (Unit - Cause (Casting unit) to damage (Picked unit), dealing (Mana of (Casting unit)) damage of attack type Spells and damage type Normal) else do (Do nothing))
      • Wait 0.50 seconds
      • Unit - Set mana of (Casting unit) to 0.00
 
Level 12
Joined
Feb 5, 2018
Messages
521
You should read some basic tutorials:

1) Things You Should Know When Using Triggers / GUI
2) Things That Leak

We should always use Event - A unit starts the effect on ability

You also have leaks in your triggers.

I made an example trigger for your second ability.
In the trigger editor you can create new variables. You can click the Yellow or Green variable button to create them. Or use CTRL + B and/or CTRL + L while you have trigger editor open.


  • Tua Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • -------- Setting up caster /// This is a unit variable --------
      • Set VariableSet Temp_Caster = (Triggering unit)
      • -------- Getting Mana of Caster /// This is a real variable --------
      • Set VariableSet Caster_Mana = (Mana of Temp_Caster)
      • -------- Getting Caster Location /// This is a point variable --------
      • Set VariableSet Temp_Loc = (Position of (Triggering unit))
      • -------- This custom script will automatically destroy the group after it has ran --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- Getting targets --------
      • Unit Group - Pick every unit in (Units within 2000.00 of Temp_Loc matching (((Matching unit) is alive) Equal to True).) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 12 (Brown)
            • Then - Actions
              • -------- Damage Target /// Temp Target = Unit variable --------
              • Set VariableSet Temp_Target = (Picked unit)
              • Unit - Cause Temp_Caster to damage Temp_Target, dealing Caster_Mana damage of attack type Spells and damage type Magic
            • Else - Actions
              • -------- FILTER ONLY --------
      • -------- Clean up leak(s) --------
      • Custom script: call RemoveLocation(udg_Temp_Loc)
 
Top