• 🏆 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!

[Trigger] Why isn't this working properly?

Status
Not open for further replies.
Level 5
Joined
Dec 22, 2007
Messages
103
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • And - All (Conditions) are true
      • Conditions
        • (Ability being cast) Equal to Fire Shield
        • (Unit-type of (Casting unit)) Equal to Daemon
  • Actions
    • Set Daemon = (Casting unit)
    • Set FireShieldTarget = (Target unit of ability being cast)
    • Unit - Add Fire Shield (Effect) to FireShieldTarget
    • Unit - Add Fire Shield Armor to FireShieldTarget
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Fire Shield for Daemon) Equal to 2
      • Then - Actions
        • Unit - Set level of Fire Shield (Effect) for FireShieldTarget to 2
        • Unit - Set level of Fire Shield Armor for FireShieldTarget to 2
      • Else - Actions
        • Do Nothing
    • Wait until ((FireShieldTarget has buff Fire Shield) Equal to False) checking every 1.00 seconds
    • Unit - Remove Fire Shield (Effect) from FireShieldTarget
    • Unit - Remove Fire Shield Armor from FireShieldTarget
The Issue I'm having is that the initial cast of this does none of the effects its supposed to, but when casted on a target already with the buff it works.
The Daemon is a normal unit, but it has levels for its abilities because of a Soul Theft ability which is usable once, and enhances his MS, attack and abilities.
 
Level 5
Joined
Dec 22, 2007
Messages
103
First: Never said I was good with triggers, tbh, this is my second trigger based ability I've ever made so I'm not gunna get anything useful out of the "inefficiency" claims unless you provide examples of better ways.

Second: These are abilities I'm temporarily adding. I tried making the Lightning Shield ability damage only enemies, but that didn't work. The ability is cast, then it adds an immolation and some bonus armor to the target. As said before the issue is with its application. After changing events, it still only adds the abilities once the dummy buff is on the target
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The trouble is that the target won't have the buff when the trigger fires. The wait with 1 second interval does the first check immedialtely and it will return false.

Do this:

  • Untitled Trigger 071
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ---- Ability condition ----
    • Actions
      • ---- Add ability and whatever here ----
      • Unit Group - Add (Target unit of ability being cast) to group
      • Trigger - Turn on Untitled Trigger 072 <gen>
  • Untitled Trigger 072
    • Events
      • Time - Every 1 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff *some buff*) Equal to False
            • Then - Actions
              • ---- Remove ability here ----
              • Unit Group - Remove (Picked unit) from group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 
Level 11
Joined
May 31, 2008
Messages
698
Unit - Order (Picked unit) to Night Elf Demon Hunter - Activate Immolation
to activate the immolation.

Unit - Order (Picked unit) to Night Elf Demon Hunter - Deactivate Immolation
to deactivate the immolation.

But i would do this a different way by just triggering everything.
I could do that for you if you want. Idk if you would be able to understand everything tho lol
But i can make comments and stuff and just give you the map so you will be able to understand it better.
And also, the person who casted the fireshield should damage the units that the fireshielded unit is near, that way if a unit dies from the fireshield, the daemon will get credit for killing him instead of the unit that he casted fireshield on.

Do you want it to be autocast-able?
 
Level 5
Joined
Dec 22, 2007
Messages
103
Thanks once again maker, on a side note is there a way to make the permanent immolation ability not selectable like the tornado's slow aura? I tried the Item immolation one, but it shows and im using a pure black icon to try hiding it
 
Level 11
Joined
May 31, 2008
Messages
698
Try changing the Art - button position x and y to 0
Im not sure if that will work, but i think you can also hide in in a spellbook somehow

Btw, try not to double post, that usually gets people angry lol. just use the edit button
 
To hide the icon you'll have to use a spellbook. It's an ability that holds other abilities, and when you click it those abilities inside the spellbook are shown.

However if you disable this ability for all players and add it to a unit, the passive skills inside it will still work as if the unit had them.

So, instead of adding the abilities themselves, put them inside a spellbook (copy the standard ability) and, in map initialization, disable that spellbook ability for all players.
Then, in your triggers, add the spellbook =P

Some other hints, although you'll probably follow Maker's solution... =P

1. Never use (Casting Unit) and some other event-response functions (some, not all). Use (Triggering Unit) instead (understand Triggering Unit as the unit that fires the event).

2. Never use "And" condition function. Just putting all conditions together works like "And". The "Or" function is useful, though (as far as I know xD)

3. Never use "Do Nothing". It literally does nothing and you don't need to fill the "Else" space (neither "Then").
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@Marcelo
You CAN use AND - All Conditions Are True or OR - Any Conditions Are True:
1. If you want to look neat in your trigger
2. You don't wanna see 5 multiple conditions stick together in one function line, is it ?
3. Same as Unit Group, we usually use the "Pick Every Unit In Unit Group And Do Multiple Actions", not the "Pick Every Unit In Unit Group And Do Action

But you are correct, in a way of efficiency and faster loading trigger, using that will save time to check the conditions
The thing is, you have to use it according to situations
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
@Marcelo
You CAN use AND - All Conditions Are True or OR - Any Conditions Are True:

He propably meant that these work the same, but the one without the AND causes less CPU load:

  • Untitled Trigger 074
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) is A structure) Equal to True
          • ((Triggering unit) is A Hero) Equal to False
    • Actions
  • Untitled Trigger 074
    • Events
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
he propably meant that these work the same, but the one without the and causes less cpu load:

  • untitled trigger 074
    • events
    • conditions
      • and - all (conditions) are true
        • conditions
          • ((triggering unit) is a structure) equal to true
          • ((triggering unit) is a hero) equal to false
    • actions
  • untitled trigger 074
    • events
    • conditions
      • ((triggering unit) is a structure) equal to true
      • ((triggering unit) is a hero) equal to false
    • actions

but you are correct, in a way of efficiency and faster loading trigger, using that will save time to check the conditions
the thing is, you have to use it according to situations

. . . .
 
I never found a situation in which And - All (Conditions) are true could be useful...
The problem is that I can only use it in the trigger conditions or IF conditions, where I can already see each condition in separate lines (and the "And" is already implicit).
But in functions that have "Matching" in them all conditions are shown in the same line because I can only use the simpler And D:
 
Level 5
Joined
Dec 22, 2007
Messages
103
Strange bug occurring, the mana cost of the ability is 100, but when you use it
it empties the target unit's mana pool completely whenever its cast. Heres the
triggering, abilities, unit and so on of the unit im having issues with.
 

Attachments

  • DaemonUnitTest.w3x
    110.8 KB · Views: 45
Status
Not open for further replies.
Top