HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Desparate Trig Help

07-22-2003, 12:21 AM#1
AedonX
Hey, I can't seem to figure out this trigger. I'm thinking I'll need to create a leaderboard for it, but if possible I'd really like not to. I need to make it so that whoever controls the most units in a specific region (A), they will get another kill added to their total every 5 seconds. Thanks.
07-22-2003, 01:05 AM#2
Hivemind
You dont need a leaderboard for that. If you already have one it can be added to the kill total posted on that one. You need to have a kill array variable (one slot for each player). Here is a sample that covers player 1, 2 and part of 3. You will need to extend it to cover all the players. The if/then/elce functions are multiple. You will need to add one for each player checking for greater than all other players. This is all done within one trigger.

Region A Kill Add
Events
Time - Every 5.00 seconds of game time

Conditions

Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Region A owned by Player 1 (Red))) Greater than (Number of units in (Units in Region A owned by Player 2 (Blue)))
(Number of units in (Units in Region A owned by Player 1 (Red))) Greater than (Number of units in (Units in Region A owned by Player 3 (Teal)))

Then - Actions
Set Kills[1] = (Kills[1] + 1)

Else - Actions
Do nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Region A owned by Player 2 (Blue))) Greater than (Number of units in (Units in Region A owned by Player 1 (Red)))
(Number of units in (Units in Region A owned by Player 2 (Blue))) Greater than (Number of units in (Units in Region A owned by Player 3 (Teal)))

Then - Actions
Set Kills[2] = (Kills[2] + 1)

Else - Actions
Do nothing
07-22-2003, 04:29 AM#3
element_5
Or you can use just one trigger and five variables:

Code:
|---------------------------------------------------|
|Variables Used                                     |
|---------------------------------------------------|
|Name          Type                    Initial Value|
|---------------------------------------------------|
|blnTied       Boolean                 False        |
|intKillCount  Integer Array (16)      0            |
|intMostUnits  Integer                 0            |
|intNumUnits   Integer Array (16)      0            |
|plrWinning    Player                  - None -     |
|---------------------------------------------------|

King of the Hill
    Events
        Time - Every 5.00 seconds of game time
    Conditions
        (Number of units in (Units in Region 000 <gen>)) Greater than 0
    Actions
        Set intMostUnits = 0
        For each (Integer A) from 0 to 15, do (Actions)
            Loop - Actions
                Set intNumUnits[(Integer A)] = 0
        Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Actions)
            Loop - Actions
                For each (Integer A) from 1 to 16, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked unit) is in (Units owned by (Player((Integer A))))) Equal to True
                                ((Picked unit) is alive) Equal to True
                            Then - Actions
                                Set intNumUnits[((Integer A) - 1)] = (intNumUnits[((Integer A) - 1)] + 1)
                            Else - Actions
                                Do nothing
        For each (Integer A) from 1 to 16, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) slot status) Equal to Is playing
                        intNumUnits[((Integer A) - 1)] Greater than or equal to intMostUnits
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                intMostUnits Equal to intNumUnits[((Integer A) - 1)]
                            Then - Actions
                                Set blnTied = True
                            Else - Actions
                                Set blnTied = False
                        Set intMostUnits = intNumUnits[((Integer A) - 1)]
                        Set plrWinning = (Player((Integer A)))
                    Else - Actions
                        Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                blnTied Equal to False
            Then - Actions
                Set intKillCount[((Player number of plrWinning) - 1)] = (intKillCount[((Player number of plrWinning) - 1)] + 1)
                Game - Display to (All players) the text: ((Player  + (String((Player number of plrWinning)))) + ( is in control of the region and have   + ((String(intKillCount[((Player number of plrWinning) - 1)])) +  points)))
            Else - Actions
                Game - Display to (All players) the text: Currently tied
I have attached a sample map in case you want to C&P the trigger :gsmile: