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

[Trigger] Help with duel triggering...

Status
Not open for further replies.
Level 7
Joined
Jul 7, 2008
Messages
332
Hi, I am trying to make a duel for my map but I fail with that.

Heres the first trigger which works fine.

  • First Duel
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • -------- Creating a hero unit in arena for testing --------
      • Unit - Create 1 Testing Hero for Player 2 (Blue) at (Random point in Duel <gen>) facing Default building facing degrees
      • -------- Heroes, is a unit group of all heroes in map (Usable for players) --------
      • Unit Group - Pick every unit in Heroes and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to (Center of Duel <gen>)
      • Wait 2.00 game-time seconds
      • Game - Display to (All players) for 15.00 seconds the text: |c00F5F034DUEL TIME...
      • Unit - Pause all units
      • Unit - Set life of (Picked unit) to 100.00%
      • Unit - Set mana of (Picked unit) to 100.00%
      • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Enemy
      • Game - Display to (All players) for 3.00 seconds the text: |c00F5F0343!|r
      • Wait 1.00 game-time seconds
      • Game - Display to (All players) for 3.00 seconds the text: |c00F5F0342!|r
      • Wait 1.00 game-time seconds
      • Game - Display to (All players) for 3.00 seconds the text: |c00F5F0341!|r
      • Wait 1.00 game-time seconds
      • Game - Display to (All players) for 8.00 seconds the text: |c00F5F034Fight!!!|...
      • Unit - Unpause all units
      • -------- This trigger works fine --------
      • Trigger - Turn on First Duel Check <gen>
This trigger is the problem...I don't understand whats wrong with it.

  • First Duel Check
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Number of units in (Units in Duel <gen>)) Equal to 1
    • Actions
      • -------- Heres the problem this trigger just doesn't work, it doesn't even show the message so I guess something is wrong with the condition? --------
      • Game - Display to (All players) for 15.00 seconds the text: Duel Is Over, Congr...
      • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Ally with shared vision
      • Unit Group - Pick every unit in (Units in Duel <gen>) and do (Do nothing)
      • Set Winner[1] = (Picked unit)
      • Unit - Set life of Winner[1] to 100.00%
      • Unit - Set mana of Winner[1] to 100.00%
      • Unit - Move Winner[1] instantly to (Center of Hero Teleport TOWN <gen>)
      • Player - Add 50 to (Owner of Winner[1]) Current gold
Help please, if theres an open source map with a duel trigger, that could help me also.
 
Level 9
Joined
Apr 3, 2008
Messages
700
1. You need a boolean condition if triggering unit is a hero.
2. There is a memory leak in unit group.
3. If dueling units are not heroes or there is more than 1 unit in arena after 1 unit die, setting Winner variable won't work.
4. Why index of Winner is 1? Maybe you mean player number of owner of killing unit?
5. There is a memory leak in location (point) when you instantly move Winner.
6. When you make an alliance you can just ally all players with all players without condition.
 
Level 7
Joined
Jul 7, 2008
Messages
332
1. You need a boolean condition if triggering unit is a hero.
2. There is a memory leak in unit group.
3. If dueling units are not heroes or there is more than 1 unit in arena after 1 unit die, setting Winner variable won't work.
4. Why index of Winner is 1? Maybe you mean player number of owner of killing unit?
5. There is a memory leak in location (point) when you instantly move Winner.
6. When you make an alliance you can just ally all players with all players without condition.

1. Ok, can you give me a hint for the right condition?
2. When it will work I will take care of memory leaks.
3. Dueling units are heroes.
4. Because there are several duels.
5. When it will work I will take care of memory leaks.
6. Its a hero siege map, the duel is just an extra event where players fight and the winner gets bonuses.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Try this:

  • DuelEnd
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set TempGroup = (Units in (DuelRegion) matching (((Matching unit) is A Hero) 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 1
        • Then - Actions
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Player - Add 50 to (Owner of (Picked unit)) Current gold
              • -------- Set life, mana here to 100% for picked unit --------
          • -------- Now, show your game message and change alliances --------
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
 
Level 7
Joined
Jul 7, 2008
Messages
332
Still don't work :/

  • First Duel Check
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set TempGroup = (Units in Duel <gen> matching (((Triggering unit) is A Hero) 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 1
        • Then - Actions
          • Unit - Set life of (Picked unit) to 100.00%
          • Unit - Set mana of (Picked unit) to 100.00%
          • Player - Add 50 to (Owner of (Picked unit)) Current gold
          • Unit - Move (Picked unit) instantly to (Center of Hero Teleport TOWN <gen>)
          • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Ally with shared vision
          • Player Group - Make (All players controlled by a User player) treat Player Group - Player 10 (Light Blue) as an Ally with shared vision
          • Game - Display to (All players) for 15.00 seconds the text: Duel Is Over, Congr...
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
Did I do something wrong?
 
Level 9
Joined
Apr 3, 2008
Messages
700
1. You've forgot to pick units in TempGroup.
  • Unit Group - Pick every unit in TempGroup and do (Actions)
2. This condition may not work because dying unit is still in unit group. Remove dying hero from TempGroup.
  • (Number of units in TempGroup) Equal to 1
 
Level 7
Joined
Jul 7, 2008
Messages
332
Right, how stupid of me.
Anyway it still doesn't work T_T

  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Set TempGroup = (Units in Duel <gen> matching (((Triggering unit) is A Hero) Equal to True))
    • Unit Group - Remove (Dying 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 1
      • Then - Actions
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
        • Unit - Set life of (Picked unit) to 100.00%
        • Unit - Set mana of (Picked unit) to 100.00%
        • Player - Add 50 to (Owner of (Picked unit)) Current gold
        • Unit - Move (Picked unit) instantly to (Center of Hero Teleport TOWN <gen>)
        • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Ally with shared vision
        • Player Group - Make (All players controlled by a User player) treat Player Group - Player 10 (Light Blue) as an Ally with shared vision
        • Game - Display to (All players) for 15.00 seconds the text: Duel Is Over, Congr...
      • Else - Actions
    • Custom script: call DestroyGroup(udg_TempGroup)
Should I just give up :/?
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Man, you have to add all actions when picking units from group under the loop. :S

NOT like this:
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
  • Unit - Set life of (Picked unit) to 100.00%
  • Unit - Set mana of (Picked unit) to 100.00%
  • Player - Add 50 to (Owner of (Picked unit)) Current gold
  • Unit - Move (Picked unit) instantly to (Center of Hero Teleport TOWN <gen>)
  • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Ally with shared vision
  • Player Group - Make (All players controlled by a User player) treat Player Group - Player 10 (Light Blue) as an Ally with shared vision
  • Game - Display to (All players) for 15.00 seconds the text: Duel Is Over, Congr...
Do it like this:
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • Unit - Set life of (Picked unit) to 100.00%
      • Unit - Set mana of (Picked unit) to 100.00%
      • Player - Add 50 to (Owner of (Picked unit)) Current gold
      • Unit - Move (Picked unit) instantly to (Center of Hero Teleport TOWN <gen>)
      • Player Group - Make (All players controlled by a User player) treat (All players controlled by a User player) as an Ally with shared vision
      • Player Group - Make (All players controlled by a User player) treat Player Group - Player 10 (Light Blue) as an Ally with shared vision
      • Game - Display to (All players) for 15.00 seconds the text: Duel Is Over, Congr...
Also, learn something about memory leaks.
 
Level 7
Joined
Jul 7, 2008
Messages
332
I know about memory leaks, I just don't bother with them until I make a trigger work like I want it to, and thanks I will check if it works later, playing now :D

Try adding the condition unit is alive equal to true in the:
Set TempGroup thing,,
That would prevent EVERY dead unit in there to be in the group,,


  • Actions
    • Set TempGroup = (Units in Duel <gen> matching ((((Triggering unit) is A Hero) Equal to True) and (((Triggering unit) is alive) Equal to True)))
Like this?
 
Last edited:
Status
Not open for further replies.
Top