• 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.

[Trigger] Check/Remove

Status
Not open for further replies.
Level 5
Joined
Jul 18, 2007
Messages
110
This trigger below is broken up into 4 parts and basically it's just a magic/spell resistance aura. It turns on when the hero picks the spell then adds/removes the spell resistance from units in range appropriately. It's causing a lot of FPS drop, I believe because of the 3rd check which tries to remove the resistance from units who leave the range basically. Does anyone know a more effective and lagless approach or perhaps something that could be changed/compressed in some way to reduce lag for this? Thanks in advance.

  • Barrier of Sauron
    • Events
      • Unit - Gothmog 0687 <gen> Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to (==) Protection of Sauron
    • Actions
      • Trigger - Turn on Barrier of Sauron 2 <gen>
      • Trigger - Turn on Barrier of Sauron 3 <gen>
      • Trigger - Turn on Barrier of Sauron Off <gen>

  • Barrier of Sauron 2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_group = (Units within 750.00 of (Position of Gothmog 0687 <gen>) matching (((Matching unit) has buff Protection of Sauron ) Equal to (==) True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Set level of Spell Damage Reduction for (Picked unit) to (Level of Protection of Sauron for Gothmog 0687 <gen>)
          • Unit - Add Spell Damage Reduction to (Picked unit)
      • Custom script: call DestroyGroup (udg_temp_group)
  • Barrier of Sauron 3
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) has buff Protection of Sauron ) Equal to (==) False))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Remove Spell Damage Reduction from (Picked unit)
      • Custom script: call DestroyGroup (udg_temp_group)
  • Barrier of Sauron Off
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to (==) Gothmog 0687 <gen>
    • Actions
      • Set temp_group = (Units in (Playable map area))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Remove Spell Damage Reduction from (Picked unit)
      • Custom script: call DestroyGroup (udg_temp_group)
      • Trigger - Destroy Barrier of Sauron 2 <gen>
      • Trigger - Destroy Barrier of Sauron 3 <gen>
      • Trigger - Destroy (This trigger)
 
Level 7
Joined
Mar 6, 2006
Messages
282
Try this.

2 triggers: one to add units to a group, and one to do actions to the group.

1st trig: event - unit within range of hero, condtion (hero is alive), action - add to main group

2nd trig: every 2 seconds, pick every unit in main group and check if they have the Protection of Sauron buff. If they do, check their level of spell reduction, and set it if needed. If they don't have he buff, remove the spell reduction ability, and remove them from the main group.

Edit: some notes on your current setup:

1.)
"Barrier of Sauron Off"
Trigger - Destroy (This trigger)

I think you mean to do Trigger - Turn off (This trigger). If you destroy it, then you can't use it again.

2.)
"Barrier of Sauron 2"
Set temp_group = (Units within 750.00 of (Position of Gothmog 0687 <gen>)

You leak a location there (position of ...). You need another variable, temp_loc = (Position of Gothmog 0687), then temp_group = (Units within 750.00 of temp_loc, and finally, destroy the loc with custom script: "call RemoveLocation( udg_temp_loc )"
 
Level 5
Joined
Jul 18, 2007
Messages
110
"2nd trig: every 2 seconds, pick every unit in main group and check if they have the Protection of Sauron buff. If they do, check their level of spell reduction, and set it if needed." How would you implement this part by any chance? I understood the rest.

Oh yeah, I just changed that position one and forgot to add a location, good catch.
 
Level 7
Joined
Mar 6, 2006
Messages
282
How would you implement this part by any chance? I understood the rest.

  • Events
    • Time - Every 2.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in SauronAuraGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) has buff Barrier of Sauron) Equal to True
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Level of Spell Damage Reduction for (Picked unit)) Equal to 0
              • Then - Actions
                • Unit - Add Spell Damage Reduction to (Picked unit)
                • Unit - Set level of Spell Damage Reduction for (Picked unit) to (Level of Spell Damage Reduction for Gothmog 0687 <gen>)
              • Else - Actions
          • Else - Actions
            • Unit Group - Remove (Picked unit) from SauronAuraGroup
            • Unit - Remove Spell Damage Reduction from (Picked unit)
 
Status
Not open for further replies.
Top