• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Solved] What am i missing in this trigger?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
  • Double Hit Set Copy Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units within 750.00 of (Position of (Attacking unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is A Hero) Equal to True)))) Greater than or equal to 2
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Double Hit for (Attacking unit)) Equal to 1
            • Then - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 5
            • Else - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 1
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Double Hit for (Attacking unit)) Equal to 2
            • Then - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 6
            • Else - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Double Hit for (Attacking unit)) Equal to 3
            • Then - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 7
            • Else - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 3
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Double Hit for (Attacking unit)) Equal to 4
            • Then - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 8
            • Else - Actions
              • Unit - Set level of Double Hit // dummy for (Attacking unit) to 4
        • Else - Actions
      • Game - Display to (All players) the text: (String((Level of Double Hit // dummy for (Attacking unit))))
I am trying to make this adjustment. Hero has a 1 ability, and 1 dummy ability given by trigger.
When hero try to attack to enemy when there are 1 or more friends around it and when their REAL ability level 1, i want to set DUMMY ability level to 5
6 For level 2
7 For level 3
8 For level 4 but somehow i cannot make it properly. It sets dummy ability level to 4.

My goal is, set it's level to 5/6/7/8 when it has 1 or more allies around the attacker

By the way i think i am missing huge simple point. Because i am too tired at now and today i want to release my version and have a rest.

Update: Ok i have noticed my mistake, it is solved.
 
Last edited:
Level 44
Joined
Feb 27, 2007
Messages
5,563
The trigger actions can be simplified, and you should give it a condition to check for the ability, otherwise it will run for every attack by every unit in the map. Also you are leaking locations and groups, but like five different people have tried to explain how not to do that and it doesn't get through to you so whatever. Just know that this particular trigger is egregious in its leaks because of the lack of a condition.
  • Events
    • Unit - A unit is attacked
  • Conditions
    • (Level of Double Hit for (Attacking Unit)) greater than 0
  • Actions
    • Set Level = (Level of Double Hit for (Attacking Unit))
    • Set TempPoint = (Position of (Attacked Unit))
    • Custom script: set bj_wantDestroyGroup = true //if you don't understand this read the leaks thread again
    • Set Count = (Nuber of units in (Units within 750.00 of TempPoint matching ((((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is A Hero) Equal to True))))
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • Count greater than 1
      • Then - Actions
        • Set Level = (Level + 4))
      • Else - Actions
    • Unit - Set level of Double Hit // dummy for (Attacking unit) to Level
    • Custom script: call RemoveLocation(udg_TempPoint)

The reason your trigger doesn't work as expected because of a few things:
  • Since you put the If/then/else check (the number of units >= 2) first... any time you attack solo the dummy ability's level won't get updated, because this check fails. The player could attack an enemy with 1 hero nearby to get the +4 level buff, and then when the ally hero leaves the trigger can never update the level back -4 like it should. Effectively, this means the ability can only ever give you the +4 levels once you've attacked with an allied hero nearby, never the normal levels on the dummy ability.

  • The if/then/else blocks you wrote all just have the wrong condition, which sort of comes from the fact that you baked in the 'number of nearby units' check into the trigger as the first action. Re-read the if blocks you made, they're actually nonsense. The first one checks if the attacker's ability level is 1; if so, it sets the dummy ability level to 5... but if it's not (in this case if the level isn't 1) it sets the dummy ability level... to 1! If not level 1 set to level 1. Silly.

  • Because you didn't nest your if blocks (put the next inside the previous) and the condtions on some of your if blocks are mutually exclusive (for example: if the ability is level 3 then it automatically isn't level 4) you have the problem that else actions for some (in this case 3) if blocks are being executed every time the trigger runs (because their conditions fail). Thus whenever the trigger does execute the then actions for the Level 1 check block, it'll immediately get overwritten by the next Else actions in the next if block. Thus the last else actions are the ones you always see, and the ability is always level 4.
 
Last edited:
Status
Not open for further replies.
Top