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

Is this trigger optimimum?

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
This is one of my Boss triggers from my map in development, alot of the wave triggers look somewhat like this, but this one is a little different and I just need to know if this specific one is correct.
  • Boss Wave 5
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • wave Equal to ((Number of players in (All players controlled by a User player)) x 10)
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Wait 5.00 seconds
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to (Center of Boss Fight Summon <gen>)
          • Game - Display to (All players) the text: Boss Wave 5: Grubmu...
          • Set wave = 0
          • Set boss = 0
          • Set tempLoc = (Center of Wave 1 through 15 <gen>)
          • Unit - Create 1 Grubmuncher for Neutral Hostile at tempLoc facing Default building facing degrees
          • Set Boss_unit[1] = (Last created unit)
          • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Unit Group - Add (Picked unit) to boss_current)
          • Cinematic - Turn cinematic mode On for (All players)
          • Cinematic - Send transmission to (All players) from Boss_unit[1] named Grubmuncher: Play No sound and display Grubmuncher work fo.... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Turn cinematic mode Off for (All players)
          • Unit - Create (players x 10) Dune Worm for Neutral Passive at (Center of Special <gen>) facing Default building facing degrees
          • Unit Group - Add all units of (Last created unit group) to dummy_worms
          • Trigger - Turn on Grubmuncher Munch <gen>
          • Trigger - Turn on Grubmuncher Enrage <gen>
          • Trigger - Run Grubmunch HP <gen> (checking conditions)
          • Trigger - Turn on Wave 5 10 15 Block <gen>
          • Trigger - Turn off Shop Safety <gen>
          • Trigger - Turn on Wave 6 <gen>
          • Custom script: call RemoveLocation(udg_tempLoc)
        • Else - Actions
 
1) Add the line:
  • Custom script: set bj_wantDestroyGroup = true
right before the Unit Group actions.

2)
  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)
Picked unit should be Matching unit.

3)
  • Unit - Create (players x 10) Dune Worm for Neutral Passive at (Center of Special <gen>) facing Default building facing degrees
  • Unit Group - Add all units of (Last created unit group) to dummy_worms
should be:
  • For each (Integer A) from 1 to (players x 10), do (Actions)
    • Loop - Actions
      • Unit - Create 1 Dune Worm for Neutral Passive at (Center of Special <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to dummy_worms
 
Level 9
Joined
Apr 23, 2011
Messages
460
Since this trigger also contains something like the Boss wave, should i use a For each interger A or should i use the tempLoc? Note: This is how ALL waves other than boss waves are.
  • Wave 2
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • wave Equal to ((Number of players in (All players controlled by a User player)) x 10)
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Wave 1 Drop <gen>
          • Wait 5.00 seconds
          • Game - Display to (All players) the text: Wave 2: Black Spide...
          • Unit - Create ((Number of players in (All players)) x 10) Black Spider for Neutral Hostile at (Center of Wave 1 through 15 <gen>) facing Default building facing degrees
          • Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Black Spider) and do (Unit Group - Add (Picked unit) to wave_current)
          • Set wave = 0
          • Trigger - Turn on Wave 3 <gen>
          • Trigger - Turn on Wave 2 Drop <gen>
        • Else - Actions
 
Level 9
Joined
Apr 23, 2011
Messages
460
  • Wave 1
    • Events
      • Time - StartWave expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy StartWaveWindow
      • Game - Display to (All players) the text: Wave 1: Death Pigs
      • Unit - Create ((Number of players in (All players)) x 10) Death Pig for Neutral Hostile at (Center of Wave 1 through 15 <gen>) facing Default building facing degrees
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Death Pig) and do (Unit Group - Add (Picked unit) to wave_current)
      • Trigger - Turn on Wave 2 <gen>
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Wave 1 Drop <gen>

  • Wave 2
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • wave Equal to ((Number of players in (All players controlled by a User player)) x 10)
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Wave 1 Drop <gen>
          • Wait 5.00 seconds
          • Game - Display to (All players) the text: Wave 2: Black Spide...
          • Unit - Create ((Number of players in (All players)) x 10) Black Spider for Neutral Hostile at (Center of Wave 1 through 15 <gen>) facing Default building facing degrees
          • Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Black Spider) and do (Unit Group - Add (Picked unit) to wave_current)
          • Set wave = 0
          • Trigger - Turn on Wave 3 <gen>
          • Trigger - Turn on Wave 2 Drop <gen>
        • Else - Actions
 
Actually, it looks a bit messed up. Try something like this:
  • Te
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Levels = 1
      • -------- Unit Types --------
      • Set Units[1] = Knight
      • Set Units[2] = Frost Wyrm
      • Set Units[3] = Green Dragon Whelp
      • -------- Boss --------
      • Set Units[4] = Pit Lord
      • -------- End of Boss --------
      • Set Units[5] = Dark Troll
      • -------- Amount of Creeps --------
      • Set AmountOfCreeps[1] = 5
      • Set AmountOfCreeps[2] = 11
      • Set AmountOfCreeps[3] = 7
      • Set AmountOfCreeps[4] = 1
      • Set AmountOfCreeps[5] = 14
      • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 5.00 seconds
  • Tri
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Actions
      • Set Point = (Center of Region 000 <gen>)
      • For each (Integer A) from 1 to AmountOfCreeps[Levels], do (Actions)
        • Loop - Actions
          • Unit - Create 1 Units[Levels] for Neutral Hostile at Point facing Default building facing degrees
          • Unit Group - Add (Last created unit) to TempGroup
      • Special Effect - Create a special effect at Point using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_Point)
  • Tre
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Unit Group - Remove (Triggering unit) from TempGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Levels Less than 5
            • Then - Actions
              • Set Levels = (Levels + 1)
              • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 5.00 seconds
            • Else - Actions
        • Else - Actions
 
Level 9
Joined
Apr 23, 2011
Messages
460
Actually, it looks a bit messed up. Try something like this:
  • Te
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Levels = 1
      • -------- Unit Types --------
      • Set Units[1] = Knight
      • Set Units[2] = Frost Wyrm
      • Set Units[3] = Green Dragon Whelp
      • -------- Boss --------
      • Set Units[4] = Pit Lord
      • -------- End of Boss --------
      • Set Units[5] = Dark Troll
      • -------- Amount of Creeps --------
      • Set AmountOfCreeps[1] = 5
      • Set AmountOfCreeps[2] = 11
      • Set AmountOfCreeps[3] = 7
      • Set AmountOfCreeps[4] = 1
      • Set AmountOfCreeps[5] = 14
      • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 5.00 seconds
  • Tri
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Actions
      • Set Point = (Center of Region 000 <gen>)
      • For each (Integer A) from 1 to AmountOfCreeps[Levels], do (Actions)
        • Loop - Actions
          • Unit - Create 1 Units[Levels] for Neutral Hostile at Point facing Default building facing degrees
          • Unit Group - Add (Last created unit) to TempGroup
      • Special Effect - Create a special effect at Point using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_Point)
  • Tre
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Unit Group - Remove (Triggering unit) from TempGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Levels Less than 5
            • Then - Actions
              • Set Levels = (Levels + 1)
              • Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 5.00 seconds
            • Else - Actions
        • Else - Actions

:eek: You did this in like 5 minutes? Thats amazing, No wonder your one of the best, if not the best. I'll have to do this to my waves and tweak the numbers a bit but this system is so much cleaner.
 
((Number of players in (All players controlled by a User player)) x 10)

This one leaks. Use:
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (Integer) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • ((Player(Integer) controller) Equal to User
          • Then - Actions
            • Set PlayersAvailable = (PlayersAvailable + 1)
          • Else - Actions
    • Set AmountOfCreeps = (PlayersAvailable x 10)
 
Level 9
Joined
Apr 23, 2011
Messages
460
I feel this is hard to add to my map, Here is a copy of the map, and what i've done so far to add the system to the map. But I run into problems with things like, some of the bosses are triggered. So their triggers need to be run. I don't know how to fit this in without redoing 90% of all the triggers.
 

Attachments

  • Damnation HD.w3x
    2.8 MB · Views: 29
Just like the UnitTypes[] variable I did, you can create a trigger for each boss to run the actions needed. Create a "Trigger" variable (array), so that it looks like this:
  • Set Triggers[1] = Boss 1 <gen>
  • Set Triggers[2] = Boss 2 <gen>
  • Set Triggers[3] = Boss 3 <gen>
Boss 1/2/3 <gen> is some trigger imitation to help you understand.

Then, in the trigger that creates the respective unit-type, use:
  • Tri
  • Events
    • Time - SpawnTimer expires
  • Conditions
  • Actions
    • Set Point = (Center of Region 000 <gen>)
    • For each (Integer A) from 1 to AmountOfCreeps[Levels], do (Actions)
      • Loop - Actions
        • Unit - Create 1 Units[Levels] for Neutral Hostile at Point facing Default building facing degrees
        • Unit Group - Add (Last created unit) to TempGroup
    • Trigger - Run Triggers[Levels] (checking conditions)
    • Special Effect - Create a special effect at Point using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation (udg_Point)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Is this trigger optimimum?
No as it is GUI. Optimum code is only really possible with vJASS due to its enhanced syntax via preprocessing and acess to structures not available in GUI (like locals or efficient flow control).

A system as being described above is more efficient and easier to maintain as it has less procedural coupling. You can also reuse such a system in many maps and someone else may wish to use it in their map as well (better cohesion).
 
Status
Not open for further replies.
Top