Count units in group and show how many of each type

Komaqtion

You can change this now in User CP.
Reaction score
469
Here's a trigger, which probably does everything as you say... The only problem is that it only works once :(

So if you could get help with that (Because I simply can't figure out what's wrong :() you'll be able to use it:

Trigger:
  • Unit Type Check
    • Events
      • Player - Player 1 (Red) types a chat message containing -check as An exact match
    • Conditions
    • Actions
      • Set Temp_Int = 0
      • Set Temp_Group = (Units currently selected by (Triggering player))
      • Set Temp_PGroup = (Player group((Triggering player)))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Temp_Unit is in Temp_Group2) Equal to False
            • Then - Actions
              • Set Temp_Int = (Temp_Int + 1)
              • Set Unit_Type[Temp_Int] = (Unit-type of Temp_Unit)
              • Unit Group - Add Temp_Unit to Unit_Group[Temp_Int]
              • Unit Group - Add Temp_Unit to Temp_Group2
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Unit_Type[Temp_Int] Equal to (Unit-type of (Picked unit))
                      • (Picked unit) Not equal to Temp_Unit
                      • ((Picked unit) is in Unit_Group[Temp_Int]) Equal to False
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to Unit_Group[Temp_Int]
                      • Unit Group - Add (Picked unit) to Temp_Group2
                    • Else - Actions
            • Else - Actions
          • Custom script: set udg_Temp_Unit = null
      • Game - Display to Temp_PGroup the text: You currently have ...
      • For each (Integer A) from 1 to Temp_Int, do (Actions)
        • Loop - Actions
          • Game - Display to Temp_PGroup the text: ((String((Number of units in Unit_Group[(Integer A)]))) + ( + (Name of (Random unit from Unit_Group[(Integer A)]))))
      • Custom script: call DestroyForce(udg_Temp_PGroup)
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: call DestroyGroup(udg_Unit_Group[bj_forLoopAIndex])
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Thx ill work with that then and come back with the result
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Sory for the dp but could i maby get the map
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
plz upload it throug TH im not a member of rapid share and it gives me all this crap you have reach you limit try later and i never even use it
 

Lord Regno

Active Member
Reaction score
19
Well I don't now the trigger upper but I now that this are working:

This is only for the player that tab the messenger:

Trigger:
  • Number of units
    • Events
      • Player - Player 1 (Red) types a chat message containing -number of units as An exact match
      • Player - Player 2 (Blue) types a chat message containing -number of units as An exact match
    • Conditions
    • Actions
      • Set footman = (Number of living Footman units owned by (Triggering player))
      • Set knight = (Number of living Knight units owned by (Triggering player))
      • Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: (You have + ((String(footman)) + (footmans + (and + ((String(knight)) + knights.)))))


If you want to have on all you have to make this:

Trigger:
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -number of units as An exact match
      • Player - Player 2 (Blue) types a chat message containing -number of units as An exact match
    • Conditions
    • Actions
      • Set footman_red = (Number of living Footman units owned by Player 1 (Red))
      • Set knight_red = (Number of living Knight units owned by Player 1 (Red))
      • Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: (Red have + ((String(footman_red)) + (footmans + (and + ((String(knight_red)) + knights.)))))
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Wow read the posts again that trigger is way off and im already helped thx
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top