Income trigger not working.

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
So yes, this trigger does not work. Nobody receives a message not get´s income even though the conditions are met.

  • Income
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set GoldOnePercentage[1] = ((Player 11 (Dark Green) Current gold) / Kills_UnitTotal[1])
      • Set GoldOnePercentage[2] = ((Player 12 (Brown) Current gold) / Kills_UnitTotal[2])
      • For each (Integer A) from 1 to 5, 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
              • Kills_Unit[(Integer A)] Greater than 0
              • Kills_UnitTotal[1] Greater than 0
            • Then - Actions
              • Player - Add (GoldOnePercentage[1] / Kills_Unit[(Integer A)]) to (Player((Integer A))) Current gold
              • Game - Display to (Player group((Player((Integer A))))) the text: (The Nation of Light gives you + (String((GoldOnePercentage[1] x Kills_Unit[(Integer A)]))))
            • Else - Actions
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,551
Have you tried displaying a message for all players before and after «Then - Actions»? If both don't display, your function met with a null argument (I'll explain what this is if you ask). If only the second doesn't display, the conditions are definitely not being met.
Also, be careful with dividing for Kills_UnitTotal. If that is the number of enemies killed, it might (or not, depending on how your map is played) cause a division by zero, which results in a fatal error.
Or, at least, should; it happens in JASS. I don't know whether Blizzard coded some smart function to avoid it.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
You were right about the dividing by 0 it seems, I moved a few things around and it now runs (And will show both the win and the how much gold you gain message.)
Thanks a lot, and yes I guess it does have some failsave.

At first it would not run either the then or else.

EDIT: For those interested here is the fixed version:

  • Events
    • Income
      • Events
        • Time - Every 120.00 seconds of game time
      • Conditions
      • Actions
        • For each (Integer A) from 1 to 5, 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
                • Kills_Unit[(Integer A)] Greater than 0
                • Kills_UnitTotal[1] Greater than 0
              • Then - Actions
                • Set GoldOnePercentage[1] = ((Player 11 (Dark Green) Current gold) / Kills_UnitTotal[1])
                • Player - Add (GoldOnePercentage[1] x Kills_Unit[(Integer A)]) to (Player((Integer A))) Current gold
                • Game - Display to (Player group((Player((Integer A))))) the text: (The Nation of Light gives you + (String((GoldOnePercentage[1] x Kills_Unit[(Integer A)]))))
                • Player - Set Player 11 (Dark Green) Current gold to 0
              • Else - Actions
 
Status
Not open for further replies.
Top