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

Need Some Trigger Help

Status
Not open for further replies.
Level 8
Joined
Sep 2, 2012
Messages
308
Hi Guys :goblin_yeah:

I Want To Know The Triggers of These :

When Map Loaded In Case Of Hero Been Level 1 Changes To Level 10 .?
How To Improve More Than Level 10 .?
I Want To Know When A Hero or A Unit Dies .Drop Item From That Hero Or Unit.?

And When Map Loaded I Want A Hero Have Items In His Inventory .
And My Last Question . How To Improve My Spell Triggering :ogre_hurrhurr:

Thanks Anyone Who Anwser Me . If Anyone Knows All Of Them Send Me Private Message In My Profile . Thanks :ogre_love:
 
Level 7
Joined
May 11, 2010
Messages
278
  • Set Hero Level
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- First, we pick all units on the map --------
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • -------- Now, if the picked unit is a hero... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • -------- ...we set his level to 10. --------
              • Hero - Set (Picked unit) Hero-level to 10, Hide level-up graphics
            • Else - Actions
But, this trigger leaks a Unit Group.
We fix that by adding a unit group variable.

  • Set Hero Level
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- First, we set the unitGroup variable to all units in the map --------
      • Set unitGroup = (Units in (Playable map area))
      • -------- next, we pick all units in unitGroup --------
      • Unit Group - Pick every unit in unitGroup and do (Actions)
        • Loop - Actions
          • -------- Now, if the picked unit is a hero... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • -------- ...we set his level to 10. --------
              • Hero - Set (Picked unit) Hero-level to 10, Hide level-up graphics
            • Else - Actions
      • -------- And we finish by removing the unit group as it's not needed anymore. --------
      • Custom script: call DestroyGroup(udg_unitGroup)
Basically, if you have a lot of leaks in your map, it will start to lag after a while.

(though, the set unitGroup function might leak a region? I'm not sure about that)
 
Setting variables don't create leaks, I think. Instead of putting up a unit group variable, use "set bj_wantDestroyGroup = true" before picking the units.

To improve your triggering, view any spells in the spells section or tutorials.

To have items in hero's inventory, select the hero and click the Inventory tab in the dialog box that will appear. Then add items.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you only do a simple Unit Group pick, just add set bj_wantDestroyGroup = true above Unit Group function, you don't need any Unit Group for that.

By default, that boolean is set to false, meaning that the Unit Group never got destroyed - this will leak.
That is why we change the boolean to true, so that the Unit Group is destroyed right after it ends the loop
 
Status
Not open for further replies.
Top