• 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] Does it leak? (Big trigger)

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
After a player choose a hero in the tavern, they are sent to their respective bases and the type of unit is stored in a variable, and the unit itself stored in another variable. Also all the players are unable to do another hero like the chosen one, and if you repick a hero, your hero is available to others players and them your new hero is not allowed to be trained.
Because this is a very important trigger, used as bases to many things, I really needs to check if its leaks.

  • Hero Purchase
    • Events
      • Unit - A unit enters Heroes Tavern <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Not equal to Choose a Hero
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is an ally of Player 1 (Red)) Equal to True
          • Arena Equal to Mystic Fountain
        • Then - Actions
          • Set temppoint = (Center of Base1 1 <gen>)
          • Unit - Move (Entering unit) instantly to temppoint
          • Camera - Pan camera for (Owner of (Entering unit)) to temppoint over 0.00 seconds
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is an ally of Player 2 (Blue)) Equal to True
          • Arena Equal to Mystic Fountain
        • Then - Actions
          • Set temppoint = (Center of Base2 1 <gen>)
          • Unit - Move (Entering unit) instantly to temppoint
          • Camera - Pan camera for (Owner of (Entering unit)) to temppoint over 0.00 seconds
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
      • Selection - Select (Entering unit) for (Owner of (Entering unit))
      • -------- Here will disable new heroes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroUnitType[(Player number of (Owner of (Entering unit)))] Equal to No unit-type
        • Then - Actions
          • Set PlayerHero[(Player number of (Owner of (Entering unit)))] = (Entering unit)
          • Set HeroUnitType[(Player number of (Owner of (Entering unit)))] = (Unit-type of (Entering unit))
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Unavailable for training/construction by (Picked player)
          • For each (Integer A) from 0 to 3, do (Actions)
            • Loop - Actions
              • Player - Make AllHeroes[(Integer A)] Unavailable for training/construction by (Owner of (Entering unit))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HeroUnitType[(Player number of (Owner of (Entering unit)))] Not equal to (Unit-type of (Entering unit))
            • Then - Actions
              • Set tempforce = (All players matching (((Matching player) Food used) Equal to 0))
              • Player Group - Pick every player in tempforce and do (Actions)
                • Loop - Actions
                  • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Available for training/construction by (Picked player)
              • Custom script: call DestroyForce(udg_tempforce)
              • Set PlayerHero[(Player number of (Owner of (Entering unit)))] = (Entering unit)
              • Set HeroUnitType[(Player number of (Owner of (Entering unit)))] = (Unit-type of (Entering unit))
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Unavailable for training/construction by (Picked player)
            • Else - Actions
 
Last edited:
Level 12
Joined
Mar 23, 2008
Messages
942
Unit - Move (Entering unit) instantly to (Center of Base2 1 <gen>)
Camera - Pan camera for (Owner of (Entering unit)) to (Center of Base2 1 <gen>) over 0.00 seconds

this leaks, same the one above it.
Why? Its not a dynamic point. So there is not difference by putting it on a variable or not.

Also I found a error, when you repick a hero your old hero became available to others even if they already have a hero >.<
Someone can help me?
 
Level 9
Joined
May 27, 2006
Messages
498
@Leaks
Whatever the point is, always remove it.
@Hero avaibility
You're doing:
  • blah
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Player - Make HeroUnitType[((Player number of (Owner of (Entering unit))) - 1)] Available for training/construction by (Picked player)
It should be:
  • blah2
    • Player - Make HeroUnitType[((Player number of (Owner of (Entering unit))) - 1)] Available for training/construction by (Owner of (Entering unit))
Without picking player group. If you want it to be avaible for players that didn't choose a hero yet, then try thinking a bit (tip: try using conditions inside player picks to do that)
 
Level 9
Joined
May 27, 2006
Messages
498
No, he dont have to. Moreover, placing 'Do nothing' there, where its not neccessary may cause game slow a little bit (someone wrote this, dont remember who, he had many posts and reps anyway xD). This action was invented for non-multiple if/then/else and etc. And, anyway, Do nothing looks ugly :p

EDIT:
Oh, and btw looking at your trigger, Saishy, i dont understand why you placed [((Player number of (Owner of (Entering unit))) - 1 )] as array on the variables. This will make trigger register blues hero as reds...
 
Status
Not open for further replies.
Top