1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Hi , what's wrong with my Trigger

Discussion in 'Triggers & Scripts' started by o2bryan, Jan 18, 2012.

  1. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    There you Go my triggers :

    • Game
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Unit Group - Pick every unit in (Units in (Entire map) owned by Player 4 (Purple)) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • And - All (Conditions) are true
                  • Conditions
                    • ((Picked unit) is dead) Equal to True
              • Then - Actions
                • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
                • Game - Defeat Player 4 (Purple) with the message: Defeat!
              • Else - Actions
                • Do nothing




    I wan all footman die then win , why become a footman die equal to win?
    help me please

    Thanks !
    ~:grin:
     
  2. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    Try this:

    • Trigger
      • Events
        • Unit - A unit owned by Player 4 (Purple) Dies
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Footman
      • Actions
        • Set Count = 0
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units owned by Player 4 (Purple) of type Footman) and do (Actions)
          • Loop - Actions
            • Set Count = (Count + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Count Equal to 0
          • Then - Actions
            • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
            • Game - Defeat Player 4 (Purple) with the message: Defeat!
          • Else - Actions


    The Count variable is an integer.
     
  3. overcold_ice

    overcold_ice

    Joined:
    Apr 30, 2011
    Messages:
    356
    Resources:
    0
    Resources:
    0
    for more complex use, use these 3 . .
    it will calculate newly created units as well . . .
    note that this only applied to Player 4's units . . .
    if you want one that applies to all players just ask ^_^

    • Trigger1
      • Events
        • Map Initialization
      • Conditions
      • Actions
        • Unit Group - Pick every unit in (Units owned by Player 4 (Purple)) and do (Actions)
          • Loop - Actions
            • Set MaxUnit = (MaxUnit + 1)

    • Trigger2
      • Events
        • Unit - A unit enters (Entire map)
      • Conditions
        • (Owner of (Entering Unit)) Equal to Player 4 (Purple)
      • Actions
        • Set MaxUnit = (MaxUnit + 1)

    • Trigger3
      • Events
        • Unit - A unit owned by Player 4 (Purple) Dies
      • Conditions
      • Actions
        • Set Count = (Count + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Count Equal to MaxUnit
          • Then - Actions
            • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
            • Game - Defeat Player 4 (Purple) with the message: Defeat!
          • Else - Actions
     
    Last edited: Jan 18, 2012
  4. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    Ok I will try ^__^ thank you both so much !
     
  5. ForeverBeADragon

    ForeverBeADragon

    Joined:
    Oct 20, 2011
    Messages:
    128
    Resources:
    0
    Resources:
    0
    Another choice:

    • Events
      • Unit - A unit owned by Player 4 (Purple) Dies
      • Conditions
        • (Unit-type of (Dying unit)) Equal to Footman
      • Actions
        • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 4 (Purple)) and (((Unit-type of (Matching unit)) Equal to Footman) and (((Matching unit) is alive) Equal to True))))
        • 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
            • Game - Defeat Player 4 (Purple) with the message: Defeat!
            • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
          • Else - Actions
        • Custom script: call DestroyGroup(udg_TempGroup)
     
  6. overcold_ice

    overcold_ice

    Joined:
    Apr 30, 2011
    Messages:
    356
    Resources:
    0
    Resources:
    0
    @Dragon:
    better ~.~
    i didn't think that xD

    and i didn't know that MrBean's trigger just do the same . . . .
    stupid me~
    but MrBean's are better than Dragon's
     
  7. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    oh I see , haha its okay .

    Hey guys , if I would like to add one more type of unit can ?


    Edited **
    Why Mr Bean trigger doesn't work @@??
     
  8. ForeverBeADragon

    ForeverBeADragon

    Joined:
    Oct 20, 2011
    Messages:
    128
    Resources:
    0
    Resources:
    0
    • Unit Group - Pick every unit in ((Units owned by Player 4 (Purple) of type Footman) and ((Matching unit) is alive) Equal to True)) and do (Actions)
      • Loop - Actions
        • Set Count = (Count + 1)


    Edit: If you want to make one more, you can duplicate the trigger. But if you want to have a lot more, create a unit type-array-variable then set at the start game:
    • Set UnitType[1] = Footman
    • Set UnitType[2] = Sorcerer


    Then
    • For each Integer A from 1 to x do
      • Loop - Action
        • Set Count = 0
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in ((Units owned by Player 4 (Purple) of type UnitType[Integer A]) and ((Matching unit) is alive) Equal to True)) and do (Actions)
          • Loop - Actions
            • Set Count = (Count + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Count Equal to 0
          • Then - Actions
            • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
            • Game - Defeat Player 4 (Purple) with the message: Defeat!
          • Else - Actions
     
  9. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    why I cannot get your trigger = =??
    • Unit Group - Pick every unit in ((Units owned by Player 4 (Purple) of type Footman) and ((Matching unit) is alive) Equal to True)) and do (Actions)
      • Loop - Actions
        • Set Count = (Count + 1)
     
  10. ForeverBeADragon

    ForeverBeADragon

    Joined:
    Oct 20, 2011
    Messages:
    128
    Resources:
    0
    Resources:
    0
    I just fix Mr Bean's trigger a little...
     
  11. overcold_ice

    overcold_ice

    Joined:
    Apr 30, 2011
    Messages:
    356
    Resources:
    0
    Resources:
    0
    if it's still do nothing, then . . . .
    (i guess) the unit that dies still considered as an 'alive' unit . . .
    so, my trigger will work . . . .

    it's only a guess . . . .
     
  12. ForeverBeADragon

    ForeverBeADragon

    Joined:
    Oct 20, 2011
    Messages:
    128
    Resources:
    0
    Resources:
    0
    • Unit Group - Pick every unit in (Units owned by Player 4 (Purple) of type Footman) and do (Actions)

    Dead Footman still picked by this trigger.
     
  13. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    @overlord : you sure your trigger will work ??
    @dragon : your Unit Group - Pick every unit in ((Units owned by Player 4 (Purple) of type Footman) and ((Matching unit) is alive) Equal to True)) and do (Actions) i cannot even found .
     
  14. overcold_ice

    overcold_ice

    Joined:
    Apr 30, 2011
    Messages:
    356
    Resources:
    0
    Resources:
    0
    lol~
    i'm really stupid . . . . . .
    that's why MrBean's trigger doesn't work

    my trigger will work, but not that effective -.-
    but there's pros with it . . . .
    there will be no bugs with it . . .

    but you should use MrBean's (with Dragon's edit)

    note:
    i'm OVERCOLD_ice
     
  15. ForeverBeADragon

    ForeverBeADragon

    Joined:
    Oct 20, 2011
    Messages:
    128
    Resources:
    0
    Resources:
    0
    Oh sorry. I typed it without open world editor.

    Trigger
    • Unit Group - Pick every unit in (Units owned by Player 4 (Purple) matching (((Unit-type of (Matching unit)) Equal to Footman) and (((Matching unit) is alive) Equal to True))) and do (Actions)
      • Loop - Actions


    A little long. I'll upload it for you.
    http://www.hiveworkshop.com/forums/attachment.php?attachmentid=110217&stc=1&d=1326972935
     

    Attached Files:

  16. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    ^^^ remember to remove the group leak by placing this line above the pick all units... line:

    • Custom script: set bj_wantDestroyGroup = true
     
  17. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    • Game
      • Events
        • Unit - A unit owned by Player 2 (Blue) Dies
      • Conditions
      • Actions
        • Set Count = 0
        • Set Unit[4] = Villager1
        • Set Unit[5] = Villager2
        • Set Unit[6] = Villager3
        • Set Unit[7] = Villager4
        • Set Unit[8] = Villager5
        • Set Unit[9] = Villager6
        • Set Unit[10] = Villager7
        • Set Unit[11] = Villager8
        • Set Unit[12] = Villager9
        • Set Unit[13] = Villager10
        • Set Unit[14] = Villager11
        • Set Unit[15] = Villager12
        • Set Unit[16] = Villager13
        • Set Unit[17] = Villager14
        • Set Unit[18] = Villager15
        • Set Unit[19] = King Of Villager
        • Custom script: set bj_wantDestroyGroup = true
        • For each (Integer A) from 4 to 19, do (Actions)
          • Loop - Actions
            • Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Unit-type of (Matching unit)) Equal to Unit[(Integer A)]) and (((Matching unit) is alive) Equal to True))) and do (Actions)
              • Loop - Actions
                • Set Count = (Count + 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Count Equal to 0
              • Then - Actions
                • Game - Display to (All players) the text: Capella Called Game
                • Wait 2.00 seconds
                • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
                • Game - Defeat Player 4 (Purple) with the message: Defeat!
              • Else - Actions



    Oh my god what happen to my trigger , there are some bug I haven't kill all of them I have won already @@ !!

    help me !!
     
  18. overcold_ice

    overcold_ice

    Joined:
    Apr 30, 2011
    Messages:
    356
    Resources:
    0
    Resources:
    0
    please describe your bug more . . .

    i guess you have killed all of player blue's units of TYPE VillagerX, or King of Villager

    is that right?
     
  19. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    DON'T set all those unit-type variables every time a unit dies. Rather set them once - at map initialization.

    Also, place the set bj_wantDestroyGroup = true line directly above the Unit Group - Pick all... line.
     
  20. o2bryan

    o2bryan

    Joined:
    Mar 9, 2009
    Messages:
    173
    Resources:
    0
    Resources:
    0
    The bug happen when i just started the game then I won already .

    I wan is kill all VillagerX and King Of Villager then win .

    @mr bean : ok I will place the set bj_wantDestroyGroup = true line directly above the Unit Group - Pick all... line.