• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Streak System

Status
Not open for further replies.
Level 5
Joined
Jul 30, 2012
Messages
93
Hi,

i have copied this streak system from somewhere then changed values for myself.But it doesn't work fine. *-* After we die, it ignores 5 seconds and writes double and triple etc. whenever i kill someone.But at first it's ok.After our hero die, it becomes distorted.

  • System Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Trigger - Run Setup Streak Strings <gen> (ignoring conditions)
      • Trigger - Turn on System Streak Kill <gen>
      • Trigger - Turn on System Timers <gen>
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to System Timers <gen> the event (Time - ExtraStreak_Timer[(Integer A)] expires)
  • System Streak Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Triggering unit) is an illusion) Equal to False
      • ((Owner of (Killing unit)) controller) Not equal to (Neutral Hostile controller)
    • Actions
      • Set Streak_Kills[(Player number of (Owner of (Killing unit)))] = (Streak_Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • Set ExtraStreak_Kills[(Player number of (Owner of (Killing unit)))] = (ExtraStreak_Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • Set Streak_Kills[(Player number of (Owner of (Triggering unit)))] = 0
      • Countdown Timer - Start ExtraStreak_Timer[(Player number of (Owner of (Killing unit)))] as a One-shot timer that will expire in 5.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ExtraStreak_Kills[(Player number of (Owner of (Killing unit)))] Greater than or equal to 2
        • Then - Actions
          • Custom script: call PolledWait (0.27)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ExtraStreak_Kills[(Player number of (Owner of (Killing unit)))] Greater than or equal to 5
            • Then - Actions
              • Game - Display to (All players) the text: (Isim[(Player number of (Owner of (Killing unit)))] + ExtraStreak_Strings[5])
            • Else - Actions
              • Game - Display to (All players) the text: (Isim[(Player number of (Owner of (Killing unit)))] + ExtraStreak_Strings[ExtraStreak_Kills[(Player number of (Owner of (Killing unit)))]])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Streak_Kills[(Player number of (Owner of (Killing unit)))] Greater than or equal to 3
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Streak_Kills[(Player number of (Owner of (Killing unit)))] Greater than or equal to 8
            • Then - Actions
              • Game - Display to (All players) the text: (Isim[(Player number of (Owner of (Killing unit)))] + Streak_Strings[8])
            • Else - Actions
              • Game - Display to (All players) the text: (Isim[(Player number of (Owner of (Killing unit)))] + Streak_Strings[Streak_Kills[(Player number of (Owner of (Killing unit)))]])
        • Else - Actions
  • System Timers
    • Events
    • Conditions
    • Actions
      • For each (Integer ExtraStreakInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ExtraStreak_Timer[ExtraStreakInt]) Equal to 0.00
            • Then - Actions
              • Set ExtraStreak_Kills[ExtraStreakInt] = 0
            • Else - Actions
Can someone tell how to fix ?
 
this system basically needs to be scrapped and redone.

for a streak system u need to use a hashtable or a unit indexer.

u need to store every unit in the hashtable when the unit gets placed on map and remove the unit from the hashtable when that unit dies.

in a loop trigger u have to increase a counter for that unit in the hashtable.
if the counter hits the max interval number u then need to reset the units kill count.

in a unit dies trigger u need to get the killing unit. Then u get that units id and reset the counter in the hashtable for that unit and increase its kill count.

On a side note u should learn how to make ur triggers more efficient. Anythign u use twice or more store into a variable and use that instead.
For example u use Player number of owner of killing unit a lot. u can easily change it to this.

  • System Streak Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Triggering unit) is an illusion) Equal to False
      • ((Owner of (Killing unit)) controller) Not equal to (Neutral Hostile controller)
    • Actions
      • Set tempInt = (Player number of (Owner of (Killing unit)))
      • Set Streak_Kills[tempInt] = (Streak_Kills[tempInt] + 1)
      • Set ExtraStreak_Kills[tempInt] = (ExtraStreak_Kills[tempInt] + 1)
      • Set Streak_Kills[(Player number of (Owner of (Triggering unit)))] = 0
      • Countdown Timer - Start ExtraStreak_Timer[tempInt] as a One-shot timer that will expire in 5.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ExtraStreak_Kills[tempInt] Greater than or equal to 2
        • Then - Actions
          • Custom script: call PolledWait (0.27)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ExtraStreak_Kills[tempInt] Greater than or equal to 5
            • Then - Actions
              • Game - Display to (All players) the text: (Isim[tempInt] + ExtraStreak_Strings[5])
            • Else - Actions
              • Game - Display to (All players) the text: (Isim[tempInt] + ExtraStreak_Strings[ExtraStreak_Kills[tempInt]])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Streak_Kills[tempInt] Greater than or equal to 3
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Streak_Kills[tempInt] Greater than or equal to 8
            • Then - Actions
              • Game - Display to (All players) the text: (Isim[tempInt] + Streak_Strings[8])
            • Else - Actions
              • Game - Display to (All players) the text: (Isim[tempInt] + Streak_Strings[Streak_Kills[tempInt]])
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This makes sure the timers are created:

  • System Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Trigger - Run Setup Streak Strings <gen> (ignoring conditions)
      • Trigger - Turn on System Streak Kill <gen>
      • Trigger - Turn on System Timers <gen>
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script : if udg_ExtraStreak_Timer[bj_forLoopAIndex] == null then
          • Custom script : set udg_ExtraStreak_Timer[[bj_forLoopAIndex] = CreateTimer()
          • Custom script : endif
          • Trigger - Add to System Timers <gen> the event (Time - ExtraStreak_Timer[(Integer A)] expires)

The polled wait makes the system not MUI, you should get rid of it or use local variable(s).
 
Status
Not open for further replies.
Top