changing team trigger help

Stretch

New Member
Reaction score
0
Ok guys I will try be as clear as I can.

What I want is, when the unit "king" dies, that triggering player changes to team 2 and gets 2 builders spawned at a certain location they are also allied with every other player in team 2 and all of team 2 are allied with them.

Keep in mind the player might be allied with one or more players from team 1 (its optional).

here's an example:
player 1's king dies
he loses control of all his units
he gets made allies with all of team 2
two builders spawn for him at team 2's base

I would like this adding onto my existing trigger where they lose troops, this trigger is below.

Trigger:
  • Defeat Human
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Blue) Dies
      • Unit - A unit owned by Player 3 (Teal) Dies
      • Unit - A unit owned by Player 4 (Purple) Dies
      • Unit - A unit owned by Player 5 (Yellow) Dies
      • Unit - A unit owned by Player 6 (Orange) Dies
      • Unit - A unit owned by Player 7 (Green) Dies
      • Unit - A unit owned by Player 8 (Pink) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to King
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Game - Give all (Triggering player) units to the Neutral Victim player
      • Quest - Display to (All players) the Mission Failed message: ((Name of (Triggering player)) + has been defeated!)


the "has been defeated!" message will be changed but that isn't really relevant right now ^^

Thanks in advance guys :)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
use a generic unit event:
Trigger:
  • Unit - A unit dies


the condition is fine.

the actions should be:
(BEWARE!!! HANDWRITTEN!)
Trigger:
  • Actions
    • set TempGroup = (units owned by (Owner of (Triggering Player)))
    • unit group - pick all units in TempGroup and do
      • loop actions
        • change owner of picked unit to WHATEVER
    • player group - pick all players in TEAM 2 and do
      • loop actions
        • Make (Owner of (Triggering Unit)) treat (picked player) as an ally with shared vision
        • Make (picked player) treat (Owner of (Triggering Unit)) as an ally with shared vision
    • unit - create 2 BUILDER for (Owner of (Triggering Unit)) at SOMEPOSITION facing 270.00 degree

the TEAM 2 should be a player group (force) created somewhere at map init or later or whatever you like.
all capital-letter-only words are some constants or globals you have to set yourself cause i aint know what exactly your map is like.

something like this.
 

Ashlebede

New Member
Reaction score
43
use a generic unit event:
Trigger:
  • Unit - A unit dies

I disagree. Using the generic event will take more time upon map initialization and will also trigger when, say, neutral hostile units die. If he already entered it for every player individually, there is absolutely no need to make it worse. It would be having went through all the trouble for no reason at all. He should, at least, keep it as it is, since it is better like that, although, in a normal situation, he should have used a generic event.
 

Stretch

New Member
Reaction score
0
thank you so much Accname, you help me once again, I had to edit a few things to make it work but you helped tons, thanks to you i'm getting much better with variables :)

edit: haha ash I have already changed it to what accname put but if it does reduce the time at map initialization I will put time back into reversing it, I like a nice fast start up map
 

Stretch

New Member
Reaction score
0
hmm I have a problem where these players are still able to ally and unally the other team and vice versa, is there anyway I can stop the triggering player being able to ally other players by typing -ally (example: -ally red) also I was wanting it so he treats all players not in team 2 as enemies and they do same and won't be able to ally him.

here is my triggers

Defeat trigger for joining team 2
Trigger:
  • Defeat Human
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Blue) Dies
      • Unit - A unit owned by Player 3 (Teal) Dies
      • Unit - A unit owned by Player 4 (Purple) Dies
      • Unit - A unit owned by Player 5 (Yellow) Dies
      • Unit - A unit owned by Player 6 (Orange) Dies
      • Unit - A unit owned by Player 7 (Green) Dies
      • Unit - A unit owned by Player 8 (Pink) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to King
    • Actions
      • Set tempgroup = (Units owned by (Triggering player))
      • Unit Group - Pick every unit in tempgroup and do (Actions)
        • Loop - Actions
          • Game - Give all (Triggering player) units to the Neutral Victim player
      • Player Group - Pick every player in Team2 and do (Actions)
        • Loop - Actions
          • Player - Make (Triggering player) treat (Picked player) as an Ally with shared vision
          • Player - Make (Picked player) treat (Triggering player) as an Ally with shared vision
          • Player Group - Add (Triggering player) to Team2
      • Unit - Create 2 Builder for (Triggering player) at (Center of Region 019 <gen>) facing Default building facing degrees
      • Quest - Display to (All players) the Mission Failed message: ((Name of (Triggering player)) + has been defeated and joined the raiders!)
      • Camera - Pan camera for (Triggering player) to (Center of Region 019 <gen>) over 0.00 seconds


my ally trigger

Trigger:
  • Ally
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
      • Player - Player 2 (Blue) types a chat message containing -ally as A substring
      • Player - Player 3 (Teal) types a chat message containing -ally as A substring
      • Player - Player 4 (Purple) types a chat message containing -ally as A substring
      • Player - Player 5 (Yellow) types a chat message containing -ally as A substring
      • Player - Player 6 (Orange) types a chat message containing -ally as A substring
      • Player - Player 7 (Green) types a chat message containing -ally as A substring
      • Player - Player 8 (Pink) types a chat message containing -ally as A substring
      • Player - Player 9 (Gray) types a chat message containing -ally as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • Set stringvariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • stringvariable Equal to red
        • Then - Actions
          • Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • stringvariable Equal to blue
            • Then - Actions
              • Player - Make (Triggering player) treat Player 2 (Blue) as an Ally with shared vision
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • stringvariable Equal to teal
                • Then - Actions
                  • Player - Make (Triggering player) treat Player 3 (Teal) as an Ally with shared vision
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • stringvariable Equal to purple
                    • Then - Actions
                      • Player - Make (Triggering player) treat Player 4 (Purple) as an Ally with shared vision
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • stringvariable Equal to yellow
                        • Then - Actions
                          • Player - Make (Triggering player) treat Player 5 (Yellow) as an Ally with shared vision
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • stringvariable Equal to orange
                            • Then - Actions
                              • Player - Make (Triggering player) treat Player 6 (Orange) as an Ally with shared vision
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • stringvariable Equal to green
                                • Then - Actions
                                  • Player - Make (Triggering player) treat Player 7 (Green) as an Ally with shared vision
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • stringvariable Equal to pink
                                    • Then - Actions
                                      • Player - Make (Triggering player) treat Player 8 (Pink) as an Ally with shared vision
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • stringvariable Equal to gray
                                        • Then - Actions
                                          • Player - Make (Triggering player) treat Player 9 (Gray) as an Ally with shared vision
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • stringvariable Equal to lightblue
                                            • Then - Actions
                                              • Player - Make (Triggering player) treat Player 10 (Light Blue) as an Ally with shared vision
                                            • Else - Actions
                                              • Do nothing
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you would need to add another condition here:

Trigger:
  • Set stringvariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stringvariable Equal to red
        • (Player 1 (Red) is in TEAM2) Gleich (Triggering Player is in TEAM2)
      • Then - Actions
        • Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision
      • Else - Actions

with this way one player could only ally other players if either both are within TEAM2 or none of them is in TEAM2.
of course you can change this if needed, its just for you to get the basic idea.
 

Stretch

New Member
Reaction score
0
hey can I ask where you found this condition as i'm having trouble finding it, also can I ask what the gleich bit is in english? probably why im having trouble finding it :p
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
oh i am sorry, its a boolean comparison. blablaA equal to blablaB
 

Stretch

New Member
Reaction score
0
hmm i'm still having problems, I would like the condition to be where neither of the players are in team 2, so if they are in team 2 they will not be allied.

This is pretty much last important bit of my map and I want to get it right ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top