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

Team Kills and Victory

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
Recently I asked about how to simplify a trigger about one player kill victory (when he reaches x kills, he wins). Now I would like to know how could I do the same thing but for a team ? If a team has x kills he wins (this means adding the amount of kills of all the players in certain team).
 
Level 12
Joined
Jan 2, 2016
Messages
973
Distribute the teams in seperate player groups.
Make a trigger with event "a unit dies".
Conditions: killing unit is enemy of owner of dying unit
Actions: if the owner of killing unit is in... (let's say) "Group_1" set value of (integer) Team1_Score = Team1_Score + 1
if owner of killing unit is in "Group_2" set value of Team2_Score = Team2_Score +2
and so on..
EDIT: You don't really need to add the players in player groups. You could make conditions like "Player owner of killing unit equal to Player 1 or Player 2 or Player 3, etc" but it's easier if they are in player groups.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I made this under the assumption that player 1 is always on team 1 and player 6 is always on team 2. You just need these players to be consistently on the same team. If you don't have that, then I can help you make a trigger to cover those cases properly.

Replace 100 with the amount of kills required to win.

I don't know what happens when you make a team win, so I just left it there for you to fill in.

Note that this trigger counts kills against allies. You can add an extra check in the condition to see if the killing unit belongs to an enemy of the triggering unit. This will ensure it doesn't count team kills.
EDIT: I added it in since you will probably want it anyway.

  • Events
    • Unit - A unit dies
  • Conditions
    • Triggering unit belongs to an enemy of Owner of (Killing unit)
  • Actions
    • if
      • conditions
        • Owner of (Killing Unit) is an ally of Player 1
      • then actions
        • set team1score = team1score + 1
        • if
          • conditions
            • team1score greater than or equal to 100
          • then actions
            • ---- Make team 1 win ----
          • else actions
      • else actions
    • if
      • conditions
        • Owner of (Killing Unit) is an ally of Player 6
      • then actions
        • set team2score = team2score + 1
        • if
          • conditions
            • team2score greater than or equal to 100
          • then actions
            • ---- Make team 2 win ----
          • else actions
      • else actions
 

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
How to cover these cases properly ?

Also may I ask, I have a multiboard that counts kills for each player that looks like:

Kills Team Battle
Events
Unit - A unit Dies
Conditions
And - All (Conditions) are true
Conditions
My conditions
Actions
Set Y = (Player number of (Owner of (Killing unit)))
Set Kills[Y] = (Kills[Y] + 1)
Game - Display to (All players) for 4.00 seconds the text: Dead noob sob and everything.

And then :

Update Kills Team Battle
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Multiboard - Set the text for (My board) item in column X, row X to (String(Kills[Y]))

You know what this means right ? Kill one unit, add one integer, then every second set the multiboard to this integer. But this works only for one player (as I said, I made everything for Free for All, single players). How could I do to the multiboard update the ammount of kills in the TEAM (again, by adding the ammount of kills of all players in certain team) ?

My english sucks hard man, I feel it.
 
Level 12
Joined
Jan 2, 2016
Messages
973
Pretty much the same way I explained earlier:
Event: a unit dies
Conditions: killing unit is enemy of dying unit
Actions: If owner of killing unit is in Group_1 then set TeamKills[0] to TeamKills[0]+1, else set TeamKills[1] to TeamKills[1]+1
and make the multiboard show this integer instead.
(you can rework that if you have more teams)
By the way.. updating the multiboard 10 times per second is a bit too much. Make the event run every 0,5 seconds instead (or even 1-ce per second)
 
Status
Not open for further replies.
Top