HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Player Group Problem (Yet, again.)

04-16-2005, 01:33 PM#1
Yukitan
Hello everyone, got a problem... Once again! :p

Can't figure this one out since it's a bit random. Here the two triggers I have problem with.

First Trigger
Code:
Melee aInitialization
    Events
        Map initialization
    Conditions
    Actions
        Set aplayergroup[0] = (All players)
        Player Group - Pick every player in aplayergroup[0] and do (Actions)
            Loop - Actions
                Set aplayer[0] = (Picked player)
                Player - Add 40 to aplayer[0] Current gold
                Set playerincomeainteger[(Player number of aplayer[0])] = 20
                Game - Display to (All players) the text: (Name of (aplayergrou[0]))
        Custom script: call DestroyForce( udg_aplayergroup[0] )
        Game - Display to (All players) the text: Melee aInitializati...
I also tried replacing:
Code:
Map initialization
with:
Code:
Time - Elapsed game time is 2.00 seconds

Second Trigger
Code:
Player Income Test
    Events
        Time - Every 5.00 seconds of game time
    Conditions
    Actions
        Set aplayergroup[0] = (All players)
        Player Group - Pick every player in aplayergroup[0] and do (Actions)
            Loop - Actions
                Set aplayer[0] = (Picked player)
                Set ainteger[0] = playerincomeainteger[(Player number of aplayer[0])]
                Player - Add ainteger[0] to aplayer[0] Current gold
        Custom script: call DestroyForce( udg_aplayergroup[0] )
        Game - Display to (All players) the text: Player Income Test ...

If the first Trigger is activated, the Second Trigger do anything and the First one actually *manage* to get blocked in a infinite loop. (Nothing happen with players, no one leave, win or lose.)

If I deactivate the first Trigger and keep the Second Trigger on Activated, then the second one work and, of course, the first one doesn't do anything.

I also tried this on a "new map" (no triggers except thoses two) so it's not something about another third Trigger interfering since it does the same thing.

Any idea, anyone?
Thanks for help.
04-16-2005, 10:00 PM#2
Tommi
That's because you destroy (All Players) force, when you run the trigger. Not wise. You see, Forces are pointers, since they are handle subtypes. As far as I see, there is no point in using aplayer[0] or aplayergroup[0], since you just substitute them with existing players/groups.
04-17-2005, 12:12 AM#3
Raptor--
Quote:
Originally Posted by Tommi
That's because you destroy (All Players) force, when you run the trigger. Not wise. You see, Forces are pointers, since they are handle subtypes. As far as I see, there is no point in using aplayer[0] or aplayergroup[0], since you just substitute them with existing players/groups.

hmm i thought internal pointers would be protected from that kinda misuse...

but yeah like he said, why are you even making the variables arrays if you only use index 0?
04-19-2005, 12:26 PM#4
Tommi
Nope. Actually they are not internal player groups, but they are created in Blizzard.j. These groups are (All players) and all single player player groups. Using them does not leak memory, but since they are normal player groups, they can be destroyed.