• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Defeat conditions.

Status
Not open for further replies.
Level 5
Joined
Mar 24, 2008
Messages
98
So, I have a project where I mixed in stuffs with Tree-tag and melee on it.
The are currently two game modes. Free for all and Team mode.

The game is simply like any other melee, except that you hunt down all of your enemies till none of their units survives.

I made a system for this but failed alot of times. :vw_wtf:
I've tried what I can but to no avail so I thought I should ask some help here.

I won't post the codes on my triggers since I believe it sucks and perhaps leaks alot. :vw_death: Though, what I did was create a Unitgroup for all players, add every units that are trained or built onto each unit group manually player by player. And pick them up every five seconds to check if there are still any units left.

The conditions were like this, If the number of units are 0 or all of them are dead, then it's the defeat of the player. aaand like I said above, it didn't work. :goblin_cry:

Help.... anyone ? :ogre_haosis:
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Well since you don't want post your trigger nor give the tried trigger with your need, I don't know how you try it, but I gave my best to this shit GUI and think this can help:

  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Set Group = (Units owned by (Player((Integer A))))
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in Group) Equal to 0
            • Then - Actions
              • Game - Defeat (Player((Integer A))) with the message: Defeat!
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Group)
Greetings and Peace
Dr. Boom
 
Level 5
Joined
Mar 24, 2008
Messages
98
Hey Dr. Boom! Thanks for the simple trigger.
I had an idea on how to do it. However, I failed to implement it. :goblin_boom:

Though, this is the trigger right?

  • Pick System Good
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set PickedGroupCheck = (Units owned by (Player((Integer A))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in PickedGroupCheck) Equal to 1
            • Then - Actions
              • Game - Display to (All players) for 3.00 seconds the text: ((Name of (Player((Integer A)))) + has been defeated!)
              • Game - Display to (Player group((Player((Integer A))))) for 10.00 seconds the text: You have been defea...
            • Else - Actions
          • Custom script: call DestroyGroup(udg_PickedGroupCheck)
I tried it in game and it worked. But sadly, there is a bug. Since, the text will keep appearing every 5 seconds announcing the defeated player. However, it will keep announcing the defeated player like...

Player 2 is defeated.
Next Pick.
Player 2 is defeated.

It'll still show, I want it not to. But I have no idea how. The Bug is that even the non-playing slots will also be announced.

E.G - Player 2 is occupied by a player.
Player 3,4, 6,7,8,9 isn't.

It'll announce like

Player 3 is defeated.
Player 4 is defeated.
Player 5 is defeated etc.

I forgot to tell that I separated the players by team XD
2 teams, from Player 1-4 and Player 6-9

P.S: PLUS rep to you doctor.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Mmm What about "Pick every player in (All Players) matching condition"

Option 1: Matching player is in Team A/B
Option 2: Player number of Picked Player is less than 6 (Team 1: 1, 2, 3, 4, 5) or more than 5 (Team 2: 6, 7, 8, 9, 10) Like Dota.

To prevent repeating the text, turn off the trigger.
 
Level 5
Joined
Mar 24, 2008
Messages
98
Hmmm... I will try that.

I forgot to tell about the game having Free for all mode as well so it kinda gets a little confusing. XD


Edit: Tried it again. Sigh, I'm no good at system triggers. oTL
 
Last edited:
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Okay sorry for my late response to this, but since my last help wasn't what you needed, I want give you this:

1) Create the following action in your initialization trigger:
  • Set PlayerGroup = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
2) Now you can use this check system, if a player becomes defeated:
  • Check
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units owned by (Picked player))) Equal to 0
            • Then - Actions
              • Player Group - Remove (Picked player) from PlayerGroup
              • Game - Display to (All players) for 5.00 seconds the text: (Player: + ((Name of (Picked player)) + has been defeated.))
              • Game - Display to (Player group((Picked player))) for 5.00 seconds the text: Defeat!
            • Else - Actions
      • Custom script: call DestroyForce(udg_PlayerGroup)
But at least you can to it much more easy in Jass, but I don't know your skills with it so..

Greetings and Peace
Dr. Boom
 
Level 16
Joined
May 1, 2008
Messages
1,605
The event is wrong in that trigger.. you meant 'every 5 seconds'.

But much better than that is to just register EVENT_PLAYER_LEAVE with

  • Player - Player 1 (Red) leaves the game

Nothing is better at this. First he just wanna check if a player has no units left not if a player leaves the game and second he might want to announce if a player is "dead" but the player still can watch his team how they doing.

And well yes my event is wrong, but no problem he can do this =P
 
Status
Not open for further replies.
Top