• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] VERY VERY VERY strange returning values

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
Ok, I'm trying to fix my multiboard, its the last triggering thing to start my tech beta... But the multiboard don't seem to want be fixed!

When I kill player blue (computer) its all right, the kills and deaths are correctly actualized, but when he kills me all the rows of the killing column get his kill value!

When I kill the BJ return: 3, 1, 2, 5.
3 - Slot in multiboard for Red (correct)
1 - Killing Player +1 (correct, Red)
2 - Dying Player + 1 (correct, Blue)
5 - Slot in multiboard for Blue (correct)

But when he kills me: 0, 4, 1, 3
0 - Slot in multiboard for Blue (WRONG!)
4 - Killing Player + 1 (WRONG!)
1 - Dying Player + 1 (correct)
3 - Slot in multiboard for Red (correct)

JASS:
function Trig_Point_Actions takes nothing returns nothing
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 3, udg_Multiboard_Slot[GetPlayerId(GetOwningPlayer(GetKillingUnit())) + 1], I2S(udg_Points_Kill[GetPlayerId(GetOwningPlayer(GetKillingUnit())) + 1]) )
    call BJDebugMsg(I2S(udg_Multiboard_Slot[GetPlayerId(GetOwningPlayer(GetKillingUnit())) + 1]))
    call BJDebugMsg(I2S(GetPlayerId(GetOwningPlayer(GetKillingUnit())) + 1))
    
    if IsPlayerAlly(GetOwningPlayer(GetKillingUnit()), Player(0)) then
        set udg_Team_Kill[0] = udg_Team_Kill[0] + 1
        set udg_Team_Death[1] = udg_Team_Death[1] + 1
        if udg_Team_Kill[1] > 0 then
            set udg_Team_Kill[1] = udg_Team_Kill[1] - 1
        endif
    else
        set udg_Team_Kill[1] = udg_Team_Kill[1] + 1
        set udg_Team_Death[0] = udg_Team_Death[0] + 1
        if udg_Team_Kill[0] > 0 then
            set udg_Team_Kill[0] = udg_Team_Kill[0] - 1
        endif
    endif
    
    if udg_Points_Kill[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1] > 0 then
        set udg_Points_Kill[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1] = udg_Points_Kill[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1] - 1
    endif
    call BJDebugMsg(I2S(GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1))
    call BJDebugMsg(I2S(udg_Multiboard_Slot[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1]))
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 4, udg_Multiboard_Slot[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1], I2S(udg_Points_Death[GetPlayerId(GetOwningPlayer(GetDyingUnit())) + 1]) )
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 3, 2, I2S(udg_Team_Kill[0]) )
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 4, 2, I2S(udg_Team_Death[0]) )
    //Team 2
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 3, (3 + udg_Player_Count_team1), I2S(udg_Team_Kill[1]) )
    call MultiboardSetItemValueBJ( bj_lastCreatedMultiboard, 4, (3 + udg_Player_Count_team1), I2S(udg_Team_Death[1]) )
    call TriggerExecute( gg_trg_End_Point )
    
endfunction

//===========================================================================
function InitTrig_Point takes nothing returns nothing
    set gg_trg_Point = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Point, function Trig_Point_Actions )
endfunction

So, what is the problem?
 
Level 12
Joined
Mar 23, 2008
Messages
942
Where's the event?

  • Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • ((Dying unit) is an illusion) Equal to False
      • ((Owner of (Dying unit)) slot status) Equal to Is playing
      • ((Owner of (Dying unit)) is an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set Ress_Time[(Player number of (Owner of (Dying unit)))] = (2 x (Level of (Dying unit)))
      • Game - Display to (All players) the text: ((Player_Colors[(Player number of (Owner of (Killing unit)))] + ((Name of PlayerHero[(Player number of (Owner of (Killing unit)))]) + |r )) + ( pwned + ((Name of (Dying unit)) + ( for + ((String(Bounty[(Player number of (Owner of (Dying unit)))])) + gold!)
      • Player - Add Bounty[(Player number of (Owner of (Dying unit)))] to (Owner of (Killing unit)) Current gold
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bounty[(Player number of (Owner of (Dying unit)))] Greater than or equal to 100
        • Then - Actions
          • Set Bounty[(Player number of (Owner of (Dying unit)))] = (Bounty[(Player number of (Owner of (Dying unit)))] - (20 x KillsCombo[(Player number of (Owner of (Dying unit)))]))
        • Else - Actions
          • Set Bounty[(Player number of (Owner of (Dying unit)))] = 100
      • Set KillsCombo[(Player number of (Owner of (Dying unit)))] = 1
      • Set KillsCombo[(Player number of (Owner of (Killing unit)))] = (KillsCombo[(Player number of (Owner of (Killing unit)))] + 1)
      • Set Points_Kill[(Player number of (Owner of (Killing unit)))] = (Points_Kill[(Player number of (Owner of (Killing unit)))] + 1)
      • Set Points_Death[(Player number of (Owner of (Dying unit)))] = (Points_Death[(Player number of (Owner of (Dying unit)))] + 1)
      • Set Bounty[(Player number of (Owner of (Killing unit)))] = (Bounty[(Player number of (Owner of (Dying unit)))] + 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KillsCombo[(Player number of (Owner of (Killing unit)))] - 1) Equal to 2
          • (Remaining time for KillingTimer[(Player number of (Owner of (Killing unit)))]) Greater than 0.00
        • Then - Actions
          • Game - Display to (All players) the text: ((Player_Colors[(Player number of (Owner of (Killing unit)))] + ((Name of PlayerHero[(Player number of (Owner of (Killing unit)))]) + |r )) + just got a |cffffa000Double Kill|r!)
          • Sound - Play Double_Kill <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (KillsCombo[(Player number of (Owner of (Killing unit)))] - 1) Equal to 3
              • (Remaining time for KillingTimer[(Player number of (Owner of (Killing unit)))]) Greater than 0.00
            • Then - Actions
              • Game - Display to (All players) the text: ((Player_Colors[(Player number of (Owner of (Killing unit)))] + ((Name of PlayerHero[(Player number of (Owner of (Killing unit)))]) + |r )) + just got a |cff00ff00Triple Kill|r!)
              • Sound - Play triple_kill <gen>
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Mode Equal to |cff0000ffPoint|r
        • Then - Actions
          • Trigger - Run Point <gen> (ignoring conditions)
        • Else - Actions
      • Countdown Timer - Start KillingTimer[(Player number of (Owner of (Killing unit)))] as a One-shot timer that will expire in 15.00 seconds
Edit: I don't think there is any problems with the variable because it works perfectly when the blue player is the killing player o.o
 
Level 7
Joined
Jul 20, 2008
Messages
377
Okay, I'm still a bit confused. Can you show me a couple of screenshots or describe the multiboard more clearly?
 
Level 12
Joined
Mar 23, 2008
Messages
942
Okay, I'm still a bit confused. Can you show me a couple of screenshots or describe the multiboard more clearly?

Of course!
 

Attachments

  • error19.JPG
    error19.JPG
    193.9 KB · Views: 148
  • error20.JPG
    error20.JPG
    206.1 KB · Views: 127
Last edited:
Level 7
Joined
Jul 20, 2008
Messages
377
Well, I don't see anything that could be wrong with your GUI trigger, but I really suggest you rework the JASS one. Also, as a coding tip in JASS - you could just put that stuff into the main script for the map (in the trigger editor, highlight the map filename at the top of that list of triggers and folders) and then in GUI, do:

  • Custom script: call yourfunction()
Much more efficient than creating an entire trigger for a piece of JASS code without any event.

But again, try rewriting that JASS piece, the piece that actually updates the multiboard. It does look like an unfortunate mess to me.
 
Level 12
Joined
Mar 23, 2008
Messages
942
HUAUAUHAUHAUHUHAUHAUHUHA I FOUND THE PROBLEM XD

There was a random purple unit that I accidentally preplaced it on the map...
Since she don't have custom color I thought it was from blue xD

Kay case solved.
 
Last edited:
Status
Not open for further replies.
Top