Question:Win/Lose Trigger!

brodygs9630

TH.net Regular
Reaction score
6
Ive had issues with this in my last maps(were total fails lol) and Im having issues with them again.I am making a short survival map where you have to survive for 1 minute.there are 11 Explorers,and 1 Lava Lord.The explorers don't want eachother to win,so they stun eachother,hoping that they will kill their enemy.I want it so that the explorers still alive after the 1 minute win,and all the dead explorers and the Lava Lord lose.If the Lava Lord kills them all before 1 minute,I want it so that the Lava Lord wins,and the Explorers lose.Please help,after this I'll almsot be done with the first part of the game:). Help = Rep:thup:
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Would you like GUI or vJASS?

EDIT:
Trigger:
  • Spawn Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set tempPointt = (Center of (Playable map area))
        • For each (Integer A) from 1 to 11, do (Actions)
          • Loop - Actions
            • Unit - Create 1 Peasant for (Player((Integer A))) at tempPointt facing Default building facing degrees
            • Unit Group - Add (Last created unit) to tempGroup
      • Custom script: call RemoveLocation(udg_tempPoint)

Trigger:
  • ExplorerDeath
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in tempGroup) Equal to True
    • Actions
      • Unit Group - Remove (Dying unit) from tempGroup

Trigger:
  • WinTrigger
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempGroup is empty) Equal to False
        • Then - Actions
          • -------- EXPLORERS WIN ACTIONS --------
        • Else - Actions
          • -------- LAVA LORD WIN ACTIONS --------
 

Sim

Forum Administrator
Staff member
Reaction score
534
So, no matter what the situation, it's after 1 minute that it happens.

Trigger:
  • Events
    • Time - Elapsed game-time is 60 seconds.


That would definitely be a good start.

Next, we might want to count the explorers, as it's important:

Trigger:
  • Actions
    • Set Leak_Group = (Units of type Explorer)
    • Set count_explorers = (Number of units in Leak_Group)
    • Custom script: call DestroyGroup(udg_Leak_Group)


If there are 0... the game ends in favor of the lava lord!

Trigger:
  • Actions
    • Set Leak_Group = (Units of type Explorer)
    • Set count_explorers = (Number of units in Leak_Group)
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • count_explorers = 0
        • Then - Actions
          • Game - Victory *OWNER OF LAVA_LORD* // This is a variable set at map initialization, optimally
        • Else - Actions
    • Custom script: call DestroyGroup(udg_Leak_Group)


But the explorers can also win...

That's where the "else" comes in handy.

Trigger:
  • Actions
    • Set Leak_Group = (Units of type Explorer)
    • Set count_explorers = (Number of units in Leak_Group)
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • count_explorers Equal to 0
        • Then - Actions
          • Game - Victory *OWNER OF LAVA_LORD* // This is a variable set at map initialization, optimally. Later I show how to pick him if that's not the case.
        • Else - Actions
          • Unit Group - Pick every units in Leak_Group and do (Actions)
            • Loop - Actions
              • If (((Picked unit) is Alive) Equal to True) then do (Game - Victory (Owner of (Picked unit)) else do (Game - Defeat (Owner of (Picked unit)))
              • Set Lava_Lord = (Units of type Lava Lord)
              • Unit Group - Pick every units in Lava_Lord and do (Game - Defeat (Owner of (Picked unit)))
              • Custom script: call DestroyGroup(udg_Laval_Lord)
    • Custom script: call DestroyGroup(udg_Leak_Group)
 

Sim

Forum Administrator
Staff member
Reaction score
534
If you read carefully I didn't post 3 triggers.

The evolution is shown. :)
 

brodygs9630

TH.net Regular
Reaction score
6
Sorry...Im still very new to this.I dont get both of your triggers(just the varribles part).Is there another easier way?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615

AgentPaper

From the depths, I come.
Reaction score
107
Do you really need to prevent leaks in the trigger that runs when the game ends? :rolleyes:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top