HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Team sorting trigger

04-11-2005, 10:07 PM#1
Linera
I'm making a map where there is 2 teams. I can't seem to make a trigger work where it will sort the players into 1 of the 2 teams based on what their hero is they picked. this is all to be done in-game.


Thanks for your help.
-Linera-
04-12-2005, 12:10 AM#2
johnfn
Code:
Teams
    Events
        Time - Elapsed game time is 60.00 seconds
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        PickedHero[(Integer A)] Equal to Footman
                    Then - Actions
                        Set Team1Counter = (Team1Counter + 1)
                        Set Team1[Team1Counter] = (Player((Integer A)))
                    Else - Actions
                        Set Team2Counter = (Team2Counter + 1)
                        Set Team2[Team2Counter] = (Player((Integer A)))

And TADA! Although that might use a variable or two too many.
04-12-2005, 01:30 AM#3
Linera
I think you didn't understand what i want to do.

It will set the allies and enemies for each player.

For example, if player 1 and player 2 both have a human hero they are allied, but if player 1 has a human hero but player 2 has a orc hero they and set to enemy.
04-12-2005, 01:42 AM#4
johnfn
Ok...Add this at the end.
Code:
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 12, do (Actions)
                    Loop - Actions
                        Player - Make Team1[(Integer A)] treat Team1[(Integer B)] as an Ally with shared vision
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 12, do (Actions)
                    Loop - Actions
                        Player - Make Team2[(Integer A)] treat Team2[(Integer B)] as an Ally with shared vision
I'm not sure if you can ally with player 0 or not but it shouldnt be that worrisome.
04-12-2005, 01:46 AM#5
Jackyquah
Add Variable Orc and Human Player Group
when
TriggeringPlayer Pick Hero
if Hero Race is Human then
Pick Every Player in Human Group do
(Picked Player) treat Ally to TriggeringPlayer
TriggeringPlayer treat ally to (Picked Player)
Pick every Player in Orc Group do
(Picked Player treat Enemy to Triggering Player
Triggering Player treat Enemy to (Picked Player)

add Triggering Player to Human Player Group
endif
...
04-12-2005, 01:49 AM#6
johnfn
Thats pretty much what I did except I used player arrays rather then player groups... (oops...) And I'm pretty sure you cant do hero race comparisons... I think.
04-12-2005, 02:06 AM#7
Jackyquah
Quote:
Originally Posted by johnfn
I'm pretty sure you cant do hero race comparisons... I think.

Oh, I didn't know that, thanx for info.

I guess Linera know the logic.
04-12-2005, 05:13 AM#8
Linera
Thanks dude, I forgot all about Integer A and B
04-12-2005, 02:08 PM#9
Linera
it didn't work. here is my trigger.

--------------------------------------------------------------------------------------------------------
Chossing Done
Events
Time - Every 0.10 seconds of game time
Conditions
playersDONE Equal to Playernumbers
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
Unit - Make (Picked unit) Vulnerable
Unit - Make Deputy Rainer 0028 <gen> Invulnerable
Unit - Make Ivycity Castle 0001 <gen> Invulnerable
Unit - Make Hell Fort 0016 <gen> Invulnerable
Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Loop - Actions
-------- computer --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
Character[(Player number of (Owner of (Picked unit)))] Equal to Dwarf Warrior
Character[(Player number of (Owner of (Picked unit)))] Equal to High Elf Warrior
Character[(Player number of (Owner of (Picked unit)))] Equal to Human Warrior
Then - Actions
Player - Make (Picked player) treat Player 11 (Dark Green) as an Enemy
Player - Make (Picked player) treat Player 12 (Brown) as an Ally
Player - Make Player 12 (Brown) treat (Picked player) as an Ally
Player - For (Picked player), turn Experience sharing Off toward Player 12 (Brown)
Player Group - Add (Picked player) to goodgroup
Player Group - Add Player 12 (Brown) to goodgroup
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
Character[(Player number of (Owner of (Picked unit)))] Equal to Orc Warrior
Character[(Player number of (Owner of (Picked unit)))] Equal to Troll Warrior
Character[(Player number of (Owner of (Picked unit)))] Equal to Undead Warrior
Then - Actions
Player - Make (Picked player) treat Player 11 (Dark Green) as an Ally
Player - Make (Picked player) treat Player 12 (Brown) as an Enemy
Player - Make Player 11 (Dark Green) treat (Picked player) as an Ally
Player - For (Picked player), turn Experience sharing Off toward Player 11 (Dark Green)
Player Group - Add (Picked player) to evilgroup
Player Group - Add Player 11 (Dark Green) to evilgroup
Else - Actions
Do nothing
-------- Players --------
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
For each (Integer B) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) is in goodgroup) Equal to True
((Player((Integer B))) is in goodgroup) Equal to True
Then - Actions
Player - Make (Player((Integer A))) treat (Player((Integer B))) as an Ally
Player - Make (Player((Integer B))) treat (Player((Integer A))) as an Ally
Player - For (Player((Integer A))), turn Experience sharing Off toward (Player((Integer B)))
Player - For (Player((Integer B))), turn Experience sharing Off toward (Player((Integer A)))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) is in evilgroup) Equal to True
((Player((Integer B))) is in evilgroup) Equal to True
Then - Actions
Player - Make (Player((Integer A))) treat (Player((Integer B))) as an Ally
Player - Make (Player((Integer B))) treat (Player((Integer A))) as an Ally
Player - For (Player((Integer A))), turn Experience sharing Off toward (Player((Integer B)))
Player - For (Player((Integer B))), turn Experience sharing Off toward (Player((Integer A)))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) is in evilgroup) Equal to True
((Player((Integer B))) is in goodgroup) Equal to True
Then - Actions
Player - Make (Player((Integer A))) treat (Player((Integer B))) as an Enemy
Player - Make (Player((Integer B))) treat (Player((Integer A))) as an Enemy
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) is in goodgroup) Equal to True
((Player((Integer B))) is in evilgroup) Equal to True
Then - Actions
Player - Make (Player((Integer A))) treat (Player((Integer B))) as an Enemy
Player - Make (Player((Integer B))) treat (Player((Integer A))) as an Enemy
Else - Actions
Do nothing
-------- pvp --------
Game - Display to (All players) the text: Everyone has create...
Game - Display to (All players) the text: |c00FF0000PvP is no...
-------- gates --------
Destructible - Open Gate (Horizontal) 0007 <gen>
Destructible - Open Demonic Gate (Vertical) 0000 <gen>
Trigger - Turn off (This trigger)
--------------------------------------------------------------------------------------------------------

I don't know what went wrong.
04-12-2005, 06:41 PM#10
Jackyquah
first,
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
Unit - Make (Picked unit) Vulnerable

I am not sure If this action will work correctly if your map contain more than 12 unit
since Unitgroup only can get up to 12 unit I assume it's no more than 12.



this condition it's player group enumerate looping (Picked unit) ???
example :
Conditions
Character[(Player number of (Owner of (Picked unit)))] Equal to Dwarf Warrior
the condition will false all the time
which doesn't do any action
the EvilGroup and GoodGroup still an empty group(No Player).
which make the next integer A and integer b looping useless since no condition is true
should be :
Character[(Player number of (Picked Player)] Equal to Dwarf Warrior

other than that it's should be work only the logic is very confusing and many unnecesary action on that trigger
If I am not wrong it's set alliance for all player and make allied player don't share experience. and Variable Character unit array is stored hero for each player
I think this is more efficient way

Code:
Player Group - Add Player 12 (Brown) to goodgroup
Player Group - Add Player 11 (Dark Green) to evilgroup
Player Group - Make goodgroup treat evilgroup as an Enemy
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
 If (All Conditions are True) then do (Then Actions) else do (Else Actions)
 If - Conditions
  ((Player((Integer A))) controller) Equal to User
 Then - Actions
  If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  If - Conditions
   Or - Any (Conditions) are true
   Conditions
    Character[(Integer A)] Equal to Dwarf Warrior
    Character[(Integer A)] Equal to High Elf Warrior
    Character[(Integer A)] Equal to Human Warrior
  Then - Actions
   Player Group - Pick every player in GoodGroup and do (Actions)
   Loop - Actions
    Player - Make (Picked player) treat Player((Integer A))) as an Ally
    Player - Make Player((Integer A))) treat (Picked player) as an Ally
    Player - For Player((Integer A))), turn Experience sharing Off toward (Picked player)
    Player - For (Picked player), turn Experience sharing Off toward Player((Integer A)))
   Player Group - Pick every player in EvilGroup and do (Actions)
   Loop - Actions
    Player - Make (Picked player) treat Player((Integer A))) as an Enemy
    Player - Make Player((Integer A))) treat (Picked player) as an Enemy
   Player Group - Add Player((Integer A))) to GoodGroup
  Else - Actions
   Do nothing
  If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  If - Conditions
   Or - Any (Conditions) are true
   Conditions
   Character[(Integer A)] Equal to Orc Warrior
   Character[(Integer A)] Equal to Troll Warrior
   Character[(Integer A)] Equal to Undead Warrior
  Then - Actions
   Player Group - Pick every player in GoodGroup and do (Actions)
   Loop - Actions
    Player - Make (Picked player) treat Player((Integer A))) as an Enemy
    Player - Make Player((Integer A))) treat (Picked player) as an Enemy
   Player Group - Pick every player in EvilGroup and do (Actions)
   Loop - Actions
    Player - Make (Picked player) treat Player((Integer A))) as an Ally
    Player - Make Player((Integer A))) treat (Picked player) as an Ally
    Player - For Player((Integer A))), turn Experience sharing Off toward (Picked player)
    Player - For (Picked player), turn Experience sharing Off toward Player((Integer A)))
   Player Group - Add Player((Integer A))) to Evilgroup
  Else - Actions
   Do nothing
04-12-2005, 07:25 PM#11
Raptor--
wow try to keep it concise people... i originally wasn't gonna post anything cause it seemed like people were doing ok but now it just looks like a complete mess

Code:
SORTING Initial Set
    Events
        Unit - A unit Sells a unit
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Sold unit)) Equal to Footman
                        (Unit-type of (Sold unit)) Equal to Knight
            Then - Actions
                -------- //Buying human units adds the player to team1, humans + do anything else here like set invincible --------
                Player Group - Add (Owner of (Sold unit)) to var_pgroupTeams[1]
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Sold unit)) Equal to Grunt
                        (Unit-type of (Sold unit)) Equal to Raider
            Then - Actions
                -------- //Buying orc units adds the player to team2, orcs + do anything else here like set invincible --------
                Player Group - Add (Owner of (Sold unit)) to var_pgroupTeams[2]
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Sold unit)) Equal to Ghoul
                        (Unit-type of (Sold unit)) Equal to Abomination
            Then - Actions
                -------- //Buying undead units adds the player to team3, undead + do anything else here like set invincible --------
                Player Group - Add (Owner of (Sold unit)) to var_pgroupTeams[3]
            Else - Actions
                Do nothing
        -------- etc... --------
        Trigger - Run SORTING Sort All <gen> (checking conditions)

SORTING Sort All
    Events
    Conditions
    Actions
        Set con_MAXTEAMS = 3
        For each (Integer A) from 1 to con_MAXTEAMS, do (Actions)
            Loop - Actions
                -------- //This first loop chooses each team to ally/unally --------
                Player Group - Pick every player in var_pgroupTeams[(Integer A)] and do (Actions)
                    Loop - Actions
                        Set var_playerTemp = (Picked player)
                        For each (Integer B) from 1 to con_MAXTEAMS, do (Actions)
                            Loop - Actions
                                -------- //This second loop chooses the other teams as targets of alliance --------
                                Player Group - Pick every player in var_pgroupTeams[(Integer B)] and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Integer A) Equal to (Integer B)
                                            Then - Actions
                                                -------- //Own team!  Ally!  And any other functions that could be used on self team --------
                                                Player - Make var_playerTemp treat (Picked player) as an Ally with shared vision
                                            Else - Actions
                                                -------- //Not own team, conditions could be set here if wanted --------
                                                Player - Make var_playerTemp treat (Picked player) as an Enemy
                        -------- //These alliances happen to all players regardless --------
                        Player - Make var_playerTemp treat Player 11 (Dark Green) as an Enemy
                        Player - Make var_playerTemp treat Player 12 (Brown) as an Neutral

i wrote that on the spot in 5 minutes but it has everything u need, and its commented enough to know whats going on -- the second trigger is ran at the end of each buying session, but it can be ran whenever
04-12-2005, 09:08 PM#12
Anitarf
Quote:
Originally Posted by Jackyquah
first,
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
Unit - Make (Picked unit) Vulnerable

I am not sure If this action will work correctly if your map contain more than 12 unit
since Unitgroup only can get up to 12 unit I assume it's no more than 12.
I would just like to add a comment on this: as far as I know, this works just fine, the only thing that is capped to 12 units is issuing orders to unit groups. Other unit group actions accept unit groups of any size.

And please, Linera, paste your code in [code] tags please, it's easier to read.