HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"Advanced" Multiboard trouble

01-01-2007, 10:49 AM#1
Fulla
Basically im trying to create a Multiboard only as big as necessary.

So if there are
- 5 players, it has 5 rows
- 10 players, it has 10 rows.

At same time having KILLS // DEATHS in each players Row.

So I needed to create a trigger that would register players to a "Player_Slot" for the Multiboard.

i.e.
- Player 1 is playing = Row 1
- Player 2 not playing = Do Nothing
- Player 3 is playing = Row 2
- Player 4 is playing = Row 3
- Player 5 is playing = Row 4
- Player 6 not playing = Do Nothing
etc. etc.

Trigger:
Actions
Set tempinteger = 1
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
Collapse Then - Actions
Set Player_Slot[(Integer A)] = tempinteger
Set tempinteger = (tempinteger + 1)
Else - Actions

The Problem is, when I now go to change a players Kills // Deaths, with
(Sorry combo of GUI / JASS)

Collapse JASS:
    local player kp = GetOwningPlayer(GetKillingUnit())
    local integer f1 = GetConvertedPlayerId(kp)

    set udg_Player_Kills[f1] = udg_Player_Kills[f1] + 1
    call MultiboardSetItemValueBJ(udg_Multiboard, 2, udg_Player_Slot[f1], I2S(udg_Player_Kills[f1]))

So what happens? EVERY slot in Column 2 becomes that value? (Kills Column).

I really have no idea :-(
01-01-2007, 11:04 AM#2
Chocobo
Code:
    local player kp = GetOwningPlayer(GetKillingUnit())

    local integer f1 = GetConvertedPlayerId(kp)



    set udg_Player_Kills[f1] = udg_Player_Kills[f1] + 1

    call MultiboardSetItemValueBJ(udg_Multiboard, 2, udg_Player_Slot[f1], I2S(udg_Player_Kills[f1]))


What did you intend if the row is not the same?


Trigger:
Collapse Actions
Set tempinteger = 1
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Player((Integer A)) Equal to (Owner of (Killing unit))
Collapse Then - Actions
Set tempinteger = (Integer A)
Else - Actions
Else - Actions
Custom Script : call MultiboardSetItemValueBJ(udg_Multiboard, 2, tempinteger, I2S(udg_Player_Kills[f1]))



Edit :

Quote:
Originally Posted by Fulla;385288
Simply to >>>

A player kills another player (Hero kills Hero)
Set the Player Kills of the Killing player = + 1

Then alter multiboard to show this.

Quote:
Originally Posted by Chocobo
What did you intend...

..about setting the value in a wrong row?


- Player 1 is playing = Row 1
- Player 2 not playing = Do Nothing
- Player 3 is playing = Row 2
- Player 4 is playing = Row 3
- Player 5 is playing = Row 4
- Player 6 not playing = Do Nothing

Kills (example : P3 kills someone) :
Code:
Actions
    Set tempinteger = 0
    For each (Integer A) from 1 to 12, 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
                Then - Actions
                    Set tempinteger = (tempinteger + 1)
                       If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              If - Conditions
                                     (Player((Integer A)) Equal to (Owner of (Killing unit))
                              Then - Actions
                                      [b][u]Teh ACTIONS you want[/u][/b]
                                      Custom Script :     call MultiboardSetItemValueBJ(udg_Multiboard, 2, tempinteger, I2S(udg_Player_Kills[f1]))
                                       Skip Remaining Actions
                              Else - Actions
                Else - Actions

(Integer A) loop :
-> P1 : First condition true, second false
-> P2 : First condition false
-> P3 : First condition true, second true, teh ACTIONS you want, custom script, skip remaining actions


Y, I wrote a bit fast, and I forget +1.
01-01-2007, 11:08 AM#3
Fulla
Sorry,

- The first part was simply for setting up the Multiboard.
(i.e. the layout is left as it is for rest of game)

- The 2nd part was the bit used when a Player Kills another Player.
01-01-2007, 11:39 AM#4
Fulla
Ah ok, seem I wasnt to clear in first post.
The first part, allocates players to their rows, once its done its done.

Only the part im concerned with is altering the board, for the players Kills.

Once the board has been setup, it should be some thing like this>
if ONLY Player 1 / 3 / 5 / 7 are playing>>
Player_Slot[1] = 1
Player_Slot[3] = 2
Player_Slot[5] = 3
Player_Slot[7] = 4

Now assuming that worked, I can alter the multiboard when a player gets a kill.

Collapse JASS:
    local player kp = GetOwningPlayer(GetKillingUnit())
    local integer f1 = GetConvertedPlayerId(kp)

    set udg_Player_Kills[f1] = udg_Player_Kills[f1] + 1
    call MultiboardSetItemValueBJ(udg_Multiboard, 2, udg_Player_Slot[f1], I2S(udg_Player_Kills[f1]))

So its NOT necessary to re-check which players are playing etc. each time, simply by using udg_Player_Slot it should auto allocate the correct row.

BUT instead, whenever I sued udg_Player_Slot every single figure in that colum becomes that value.

So e.g. Player 1 gets a kill, No other players have a kill.
it SHOULD become>> (Ignoring Deaths)

Code:
Players            Kills               Deaths
Player 1            1                     0
Player 2            0                     0
Player 3            0                     0
etc.

but INSTEAD, it screws up and this happens

Code:
Players            Kills                Deaths
Player 1            1                     0
Player 2            1                     0
Player 3            1                     0
etc.

My only assumption can be the first part, (allocating Player_Slots) somehow screws up

(Double Post)
Sry, need to re-clarify.
01-01-2007, 04:20 PM#5
Ammorth
In JASS, the player numbers start at 0, instead of 1. That being said, I think that when you get the killing player (if it's player 1) it returns 0, but you think it would return 1. The player 0 then has a multiboard slot of 0. If you use 0 as an argument with changing multiboards, it will change all the values in the same row/column.

Try change your trigger to this:
Collapse try this:
    local player kp = GetOwningPlayer(GetKillingUnit())
    local integer f1 = GetConvertedPlayerId(kp) + 1

    set udg_Player_Kills[f1] = udg_Player_Kills[f1] + 1
    call MultiboardSetItemValueBJ(udg_Multiboard, 2, udg_Player_Slot[f1], I2S(udg_Player_Kills[f1]))
01-01-2007, 09:33 PM#6
Relyte
You could be lazy and just make it so that if a player is not playing, you put a "-" or NP in their slot, for example,
___________
player |K|D|
player1|3|4|
player2|-|-|
etc...