HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Pick Player ignoring first player picked?

09-11-2004, 10:18 PM#1
Yukitan
Ok, I made a "mini-custom" map and I do NOT understand the problem ...

Code:
WTF
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        set bj_wantDestroyGroup = true
        Set aj_playergroup[0] = (All players controlled by a Computer player)
        Player Group - Pick every player in aj_playergroup[0] and do (Actions)
            Loop - Actions
                Set aj_player[0] = (Picked player)
                Set aj_unitgroup[0] = (Unit Group - Create One)
                Set aj_unitgroup[1] = (Units owned by aj_player[0] matching (((Matching unit) is A structure) != True))
                Unit Group - Pick every unit in aj_unitgroup[1] and do (Actions)
                    Loop - Actions
                        Set aj_unit[0] = (Picked unit)
                        Unit Group - Add aj_unit[0] to aj_unitgroup[0]
                Unit Group - Destroy One aj_unitgroup[1]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in aj_unitgroup[0]) Greater than or equal to (>=) 6
                    Then - Actions
                        Unit Group - Order aj_unitgroup[0] to attack aj_point[0]
                    Else - Actions
                Unit Group - Destroy One aj_unitgroup[0]
        Player Group - Destroy One aj_playergroup[0]

So ...

Let me explain what happen with this : I pick every computer player (since they only constantly have 12 units non-structures it's no problem.) BUT ... The thing is, on the map there is only 2 computer players.

The first one is completely ignored (even if it have max units) ... Only the second computer will get it's units to do something. But other than that, the first computer will never get it's units ordered to go somewhere ...

No idea why!

Anyone have a idea of the problem?!
09-11-2004, 11:45 PM#2
Arohk
Actions
Set aj_playergroup[0] = (All players controlled by a Computer player)


try this

pick every player in (all players) and do if picked player is controlled by a computer player then do add picked player to aj_playergroup[0] else do nothing
09-11-2004, 11:54 PM#3
Vexorian
You are destroying that unit group twice for no reason, that is because you are setting bj_wantDestroyGroup to true for no reason, because It doesn't work on Player groups, it is actually destroying aj_unitgroup[1] ,because of the wantdestroy group, then you destroy that group again causing the thread to stop
09-11-2004, 11:58 PM#4
Yukitan
Quote:
Originally Posted by Arohk
Actions
Set aj_playergroup[0] = (All players controlled by a Computer player)


try this

pick every player in (all players) and do if picked player is controlled by a computer player then do add picked player to aj_playergroup[0] else do nothing


Thanks for your help Arohk. But unfortunately this is not working. =/
09-12-2004, 12:04 AM#5
Yukitan
Quote:
Originally Posted by Lord Vexorian
You are destroying that unit group twice for no reason, that is because you are setting bj_wantDestroyGroup to true for no reason, because It doesn't work on Player groups, it is actually destroying aj_unitgroup[1] ,because of the wantdestroy group, then you destroy that group again causing the thread to stop

Well ... I know that this is not working on playergroups ...

Even by removing what you said this still does not work ... I absolutely does not understand why.
09-12-2004, 12:08 AM#6
Vexorian
Quote:
Originally Posted by Yukitan
Well ... I know that this is not working on playergroups ...

Even by removing what you said this still does not work ... I absolutely does not understand why.
ARe you sure the other player is really declared as computer controlled?
09-12-2004, 12:09 AM#7
Yukitan
Quote:
Originally Posted by Lord Vexorian
ARe you sure the other player is really declared as computer controlled?

Yes it is.
09-12-2004, 12:45 AM#8
SpadeZ
I think the player variable is over writing itself with the Set "aj_player[0] = (Picked player)" action because this is only setting one player in the variable, therefore only one player is ordered to move his units.

Try changing the top part into this.
Code:
    Set aj_playergroup = (All players controlled by a Computer player)
    Player Group - Pick every player in aj_playergroup and do (Actions)
        Loop - Actions
            For each (Integer A) from 1 to 2, do (Actions)
                Loop - Actions
                    Set aj_player[(Integer A)] = (Picked player)
                    Set aj_unitgroup[0] = (Create Unit Group)
                    Unit Group - Add all units of (Units owned by aj_player[(Integer A)] matching (((Triggering unit) is A structure) Equal to True)) to aj_unitgroup[1]

I'm not sure if it will work, but its worth a try.
GL, .
09-12-2004, 02:06 AM#9
Yukitan
Thanks everyone for help! :)