HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Erratic multiboard behaviour

07-23-2004, 04:55 PM#1
Anitarf
I have a multiboard on which, whenever a hero dies, a trigger updates all the "kills" fields with the killcount variables (the multiboard update trigger is called by the herodeathdetection trigger which, before calling the boardupdate, increases the killcount variable for the owner of killing unit).

Now here's where stuff goes wrong: When a hero dies, the board doesn't change, it remains the same. Then, one or three hero deaths later, the multiboard updates, and at that point it displays the kills correctly, including the kills it did not display before. So I am assuming the kills are being detected correctly (altrough I did have some issues with me loosing a point, as if I died to creeps, instead of the opponent gaining a point, but that didn't show up in recent tests, so I assume that problem is gone), but then why, if the kill detection trigger runs OK and modifys the variables correctly, the multiboard sometimes doesn't refresh, and sometimes it does?
07-23-2004, 05:02 PM#2
Shimrra
Could you post the triggers?
07-23-2004, 05:34 PM#3
johnfn
Additionally, why dont you just force a multiboard refresh every second or two. Although the triggers are needed to diagnose the problem, just a forced refresh every now and then should (if the kills are set correctly) work.
07-23-2004, 05:52 PM#4
Anitarf
Yes, I have been thinking about a periodic refresh, since the trigger works occasionally, if I try to run it every second, then eventually it should refresh. Still, I'd like to know what's wrong. Here are the triggers (I'm ashamed, they're so long, but there's just no shorter way).

KillsTotal is a integer variable array for every player 1-12, and 13-14 for the total of both teams. The first trigger checks for three possible causes of death (killed by creeps, killed by enemy and killed by teammate) and alters variables accordingly, then runs the multiboard refresh trigger. As you can see, there are already debug messages in here, and testing has shown that this trigger works OK.

Code:
Kill detection
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Owner of (Killing unit)) Equal to Neutral Hostile
            Then - Actions
                Game - Display to (All players) the text: Killed by Creeps! -...
                Set TempInteger = (((Player number of (Owner of (Dying unit))) / 7) + 1)
                Set KillsTotal[(Player number of (Owner of (Dying unit)))] = (KillsTotal[(Player number of (Owner of (Dying unit)))] - 1)
                Set KillsTotal[(TempInteger + 12)] = (KillsTotal[(TempInteger + 12)] - 1)
                Trigger - Run MultiBoard Refresh <gen> (ignoring conditions)
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) the text: (((Name of (Owner of (Dying unit))) + s Hero has been killed by ) + (Name of (Owner of (Killing unit))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Killing unit)) is an enemy of (Owner of (Dying unit))) Equal to True
            Then - Actions
                Set TempInteger = (((Player number of (Owner of (Killing unit))) / 7) + 1)
                Set KillsTotal[(Player number of (Owner of (Killing unit)))] = (KillsTotal[(Player number of (Owner of (Killing unit)))] + 1)
                Set KillsTotal[(TempInteger + 12)] = (KillsTotal[(TempInteger + 12)] + 1)
                For each (Integer A) from 1 to NumberOfHeroes, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Owner of Hero[(Integer A)]) Equal to (Owner of (Killing unit))
                            Then - Actions
                                Set TempInteger = (((Hero level of (Dying unit)) - (Hero level of Hero[(Integer A)])) x 25)
                                Player - Add (TempInteger + 50) to (Owner of (Killing unit)) Current gold
                                Trigger - Run MultiBoard Refresh <gen> (ignoring conditions)
                                Skip remaining actions
                            Else - Actions
                                Do nothing
            Else - Actions
                Set TempInteger = (((Player number of (Owner of (Killing unit))) / 7) + 1)
                Set KillsTotal[(Player number of (Owner of (Killing unit)))] = (KillsTotal[(Player number of (Owner of (Killing unit)))] - 1)
                Set KillsTotal[(TempInteger + 12)] = (KillsTotal[(TempInteger + 12)] - 1)
                Set TempInteger = ((Owner of (Killing unit)) Current gold)
                Player - Set (Owner of (Killing unit)) Current gold to 0
                Player - Add TempInteger to (Owner of (Dying unit)) Current gold
                Trigger - Run MultiBoard Refresh <gen> (ignoring conditions)

The second trigger refreshes the Multiboard, first all the players that are playing, then the total numbers for both teams.

Code:
MultiBoard Refresh
    Events
    Conditions
    Actions
        Set TempInteger = 1
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If ((Integer A) Equal to 7) then do (Set TempInteger = (TempInteger + 1)) else do (Do nothing)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) slot status) Not equal to Is unused
                    Then - Actions
                        Set TempInteger = (TempInteger + 1)
                        Multiboard - Set the text for (Last created multiboard) item in column 2, row TempInteger to (String(KillsTotal[(Integer A)]))
                    Else - Actions
        Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to (String(KillsTotal[13]))
        Multiboard - Set the text for (Last created multiboard) item in column 2, row Team2LocInBoard to (String(KillsTotal[14]))
07-23-2004, 08:35 PM#5
zotax
Theres an easier way than having a totally different refresh trigger. When creating a multiboard, use an array eg MultiboardPlayerRow[] and set the number of each row into the variable. Eg:

If player 1 slot satus=playing
Then
Multiboard set the text for column 1 row 1 to Kills
Multiboard set the text for column 2 row 1 to Kills
Set variable MultiboardPlayerRow[1]=1

The 1 in the array brackets refers to the player number and the 1 to the row number. Using this, you can make your kill/death trigger a lot more efficent:

A unit dies

Set kills[player number of owner of killing unit] = [kills[player number of owner of killing unit] + 1
Multiboard - Set text in column 1 row MultiboardPlayerRow[Player Number of owner of killing unit] to Kills[Player Number of onwer of killing unit]
Set deaths[player number of owner of dying unit] = [deaths[player number of owner of dying unit] + 1
Multiboard - Set text in column 1 row MultiboardPlayerRow[Player Number of owner of dying unit] to Deaths[Player Number of onwer of deaths unit]

Using this method youll basically eliminate some lag as the enitre board isnt having to be reset each timea unit dies. It will probably also solve your refresh-delay problem. Oh and if you want help working it into a loop, I can show you how to do that
07-23-2004, 09:08 PM#6
Anitarf
One variable more, some processing less... yeah, sounds like a good idea, I'll try that. The only problem is that if it still occasionally doesn't work, then it will take a lot more time for it to display properly (the way it's currently done, it displays for all players so at least when the multiboard doesn't refresh, it is soon corrected when another hero dies).