Help with triggers.

13est

New Member
Reaction score
5
I have a td map and I need some help.

Some of the creeps have special abilitys, I had all ability working but when I made some optimising some of the triggers stopped working.

EDIT: To make less confusion the trigger works, but my wc3 turns itself off when the trigger is running.

I will post 2 abilitys 1 that works and 1 that doesn't.

Here is the working:
Code:
Level 9 Magic Shield
    Events
        Unit - A unit Is attacked
    Conditions
        (Mana of (Triggering unit)) Greater than or equal to 10.00
        (Unit-type of (Triggering unit)) Equal to Level 9
    Actions
        Unit - Create 1 (level 9) for Neutral Hostile at (Position of (Triggering unit)) facing (Position of (Triggering unit))
        Unit - Order (Last created unit) to Undead Banshee - Anti-magic Shell (Triggering unit)
        Unit - Add a 0.35 second Generic expiration timer to (Last created unit)
        Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 10.00)

There is nothing wrong with using this trigger, but then only the targeted creep will start the ability.


Here is the trigger to locate units, so they will activate the ability when they take damage instead of being targeted.

I deleted the end of the trigger.
Code:
add event
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Set Locate_Unit = (Entering unit)
        Trigger - Add to ice tower <gen> the event (Unit - Locate_Unit Takes damage)
        Trigger - Add to duffman <gen> the event (Unit - Locate_Unit Takes damage)
        Trigger - Add to Level 6 run Copy <gen> the event (Unit - Locate_Unit Takes damage)
        Trigger - Add to Level 9 Magic Shield Copy <gen> the event (Unit - Locate_Unit Takes damage)

Here is the non working:
Code:
Level 9 Magic Shield Copy
    Events
    Conditions
        (Mana of (Attacked unit)) Greater than or equal to 10.00
        (Unit-type of (Attacked unit)) Equal to Level 9
    Actions
        Unit - Create 1 (level 9) for Neutral Hostile at (Position of (Attacked unit)) facing (Position of (Attacked unit))
        Unit - Order (Last created unit) to Undead Banshee - Anti-magic Shell (Attacked unit)
        Unit - Add a 0.35 second Generic expiration timer to (Last created unit)
        Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - 10.00)

Here is another one but this works:
Code:
Level 6 run Copy
    Events
    Conditions
        (Mana of (Attacked unit)) Greater than or equal to 10.00
        (Unit-type of (Attacked unit)) Equal to Level 6
    Actions
        Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
        Special Effect - Destroy (Last created special effect)
        Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - 10.00)
        Unit - Add (level 6)  to (Attacked unit)
        Wait 2.50 game-time seconds
        Unit - Remove (level 6)  from (Attacked unit)




I think there is a problem when a trigger summoned unit is involved.
Could please somewhone help me? If you didn't understand or have questions please ask.
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
I'm guessing when you set the unit to the variable, and add it to the event you override the last one (it all refers to the same variable.)

Try making the variable an array.
 

13est

New Member
Reaction score
5
What do you mean with override the last one?

I got a bunch of these triggers and it is not the locate unit that is the problem, (but somehow causes the problem)

Look at the 2 last ones the first does NOT work.

The other one DOES work.


But if you mean that I got 2 triggers and they both do the same thing, I just disable one of them so I only got 1 at a time.
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
Code:
Trigger
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        (Owner of (Triggering unit)) Equal to Neutral Hostile
    Actions
        Set UnitArray = (UnitArray + 1)
        Unit - Set the custom value of (Triggering unit) to UnitArray
        Set Unit[(Custom value of (Triggering unit))] = (Triggering unit)
        Trigger - Add to (This trigger) the event (Unit - Unit[UnitArray] Is attacked)

That should work, edit This Trigger to your trigger.
 

13est

New Member
Reaction score
5
Well thanks for the help, but I don't get it how this would help me.

But I will try it anyway brb.
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
Well I was thinking that you were probably only casting that spell on one of the units. I thought this because you set the unit to ONE variable, but since you're adding that to your events, you're basically adding the variable to the trigger for the amount of creeps that enter the map.
 

13est

New Member
Reaction score
5
No no no...

The trigger works.

But with some of the triggers when I create a dummy unit my wc3 just crash.



Code:
Level 9 Magic Shield Copy
    Events
    Conditions
        (Mana of (Attacked unit)) Greater than or equal to 10.00
        (Unit-type of (Attacked unit)) Equal to Level 9
    Actions
        [COLOR="Red"]Unit - Create 1 (level 9) for Neutral Hostile at (Position of (Attacked unit)) facing (Position of (Attacked unit))[/COLOR]
        Unit - Order (Last created unit) to Undead Banshee - Anti-magic Shell (Attacked unit)
        Unit - Add a 0.35 second Generic expiration timer to (Last created unit)
        Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - 10.00)



But this trigger works when I use the attacked unit event. But then it will only work when a unit is targeted.





EDIT: It is fixed now, I had to set this to the trigger.

At the start I used this "turn this trigger off" and in the end "turn this trigger on"
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top