1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. Units have been turned into heroes in our latest Icon Contest! Vote for the best icon set at the Icon Contest #18 Poll!
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] VERY VERY VERY strange returning values

Discussion in 'Triggers & Scripts' started by Saishy, Feb 16, 2009.

  1. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    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)

    Code (vJASS):
    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?
     
  2. Soga-

    Soga-

    Joined:
    Jul 20, 2008
    Messages:
    374
    Resources:
    0
    Resources:
    0
    Where's the event?
     
  3. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    • 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
     
  4. Soga-

    Soga-

    Joined:
    Jul 20, 2008
    Messages:
    374
    Resources:
    0
    Resources:
    0
    Okay, I'm still a bit confused. Can you show me a couple of screenshots or describe the multiboard more clearly?
     
  5. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    Of course!
     

    Attached Files:

    Last edited: Feb 16, 2009
  6. Soga-

    Soga-

    Joined:
    Jul 20, 2008
    Messages:
    374
    Resources:
    0
    Resources:
    0
    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.
     
  7. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    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: Feb 17, 2009