2939 Posts in 460 Topics - by 2181 Members - Latest Member: CoolRed

Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: Advanced Streak System v4.3.0.0  (Read 7128 times)

Rating
Average Score
« Created: June 08, 2017, 02:46:15 PM by moyack »

  • Awesome Global Code Moderator
  • Recognized User
  • Rookie - level 2
  • *
  • Posts: 83
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 516
  • vJass Incarnate
    • View Profile
Advanced Streak System v4.3.0.0
« on: June 25, 2013, 07:11:38 PM »
This is an advanced and dynamic streak system that supports:
- Killing Streaks
- Multikills
- Player Assists

You can have up to 8190 types of streaks.
You can add a whole new streak to the game anytime you want.

I'm not supporting AIDS or Damage for your own good...
Problem /bro/?

The code doesn't fit in here, so here's the documentation instead:
Now it can be posted totally :D ~moyack

Code: jass  [Select]
  1. /*******************************************************************
  2. *       _   ___  ___
  3. *      /_\ / __|/ __|
  4. *     / _ \\__ \\__ \
  5. *    /_/ \_|___//___/
  6. *    v4.3.0.0
  7. *    By Magtheridon96
  8. *
  9. *    - This is an advanced player streak system.
  10. *       - Provides:
  11. *           - Spree Tracking
  12. *           - Assist Detecting
  13. *           - Multikill Detecting
  14. *       - It is:
  15. *           - Dynamic
  16. *           - Easy to Use
  17. *           - Easy to Configure
  18. *
  19. *   Configurable:
  20. *   -------------
  21. *
  22. *       - function GetBounty            takes integer killerId, integer dyingId, unit killingUnit, unit dyingUnit   returns integer
  23. *       - function GetLostGold          takes integer gold                                                          returns integer
  24. *       - function GetAssistGold        takes integer gold, integer numberAssisters                                 returns integer
  25. *
  26. *       - function KillingPlayerFilter  takes integer playerId  returns boolean
  27. *       - function AssistPlayerFilter   takes integer playerId  returns boolean
  28. *       - function DyingPlayerFilter    takes integer playerId  returns boolean
  29. *
  30. *    API:
  31. *    ----
  32. *       struct StreakSystem:
  33. *
  34. *               - static method newStreak
  35. *                   takes
  36. *                       string streakName       :   The name of the streak (ex: "dominating")
  37. *                       string streakDisplay    :   The string that will be concatenated with the spree text (ex: "is dominating!")
  38. *                       string soundPath        :   The sound that will play
  39. *                       integer duration        :   The duration of the sound
  40. *                   returns
  41. *                       nothing
  42. *
  43. *                   - Creates a new streak-type in-game.
  44. *
  45. *               - static method newMulti
  46. *                   takes
  47. *                       string text             :   The string that will be concatenated with the player name (ex: "is a Combowhore!")
  48. *                       string soundPath        :   The sound that will play
  49. *                       integer duration        :   The duration of the sound
  50. *                   returns
  51. *                       nothing
  52. *
  53. *                   - Creates a new multikill-type in-game.
  54. *
  55. *               - static method enableGoldGain takes nothing returns nothing
  56. *               - static method disableGoldGain takes nothing returns nothing
  57. *               - static method isGoldGainEnabled takes nothing returns boolean
  58. *                   - Management of KillingPlayer-Goldgain
  59. *
  60. *               - static method enableGoldLoss takes nothing returns nothing
  61. *               - static method disableGoldLoss takes nothing returns nothing
  62. *               - static method isGoldLossEnabled takes nothing returns boolean
  63. *                   - Management of DyingPlayer-Goldloss
  64. *
  65. *               - static method getBountyBase takes nothing returns integer
  66. *               - static method setBountyBase takes integer i returns nothing
  67. *                   - Management of Gold Bounty base
  68. *
  69. *               - static method getBountyIncrement takes nothing returns integer
  70. *               - static method setBountyIncrement takes integer i returns nothing
  71. *                   - Management of Bounty Formula Factor
  72. *
  73. *               - static method enable takes nothing returns nothing
  74. *               - static method disable takes nothing returns nothing
  75. *               - static method isEnabled takes nothing returns boolean
  76. *                   - Management of System Enabling/Disabling
  77. *
  78. *               - static method reset takes nothing returns nothing
  79. *                   - Resets all current sprees, assists and multikills
  80. *
  81. *   Requirements:
  82. *   ¯¯¯¯¯¯¯¯¯¯¯¯¯
  83. *       1- DamageEvent              - Nestharus
  84. *       2- UnitIndexer              - Nestharus
  85. *       3- Table                    - Bribe
  86. *       4- TimerUtils               - Vexorian
  87. *       5- SoundTools               - Magtheridon96
  88. *       6- RegisterPlayerUnitEvent  - Magtheridon96
  89. *       7- CombatDataStorage        - Magtheridon96 (Optional)
  90. *
  91. *******************************************************************/
  92. library ASS requires DamageEvent, UnitIndexer, SoundTools, Table, RegisterPlayerUnitEvent, TimerUtils, optional CombatDataStorage
  93.  
  94.     // CONFIGURATION
  95.    
  96.     globals
  97.         // Max interval between Multikills (seconds)
  98.         private constant    real            MULTI_TIME              = 10
  99.         // Multikill Buffer Interval (seconds)
  100.         private constant    real            MULTI_UPDATE            = 1
  101.         // Are sounds 3D?
  102.         private constant    boolean         S3D                     = false
  103.         // Firstblood bonus
  104.         private constant    integer         FIRST_GOLD              = 200
  105.         // Duration of the text messages
  106.         private constant    real            TEXT_DURATION           = 8.00
  107.         // Interval between streak and multikill sounds
  108.         private constant    real            INTERVAL                = 0.50
  109.         // Assist Decay time (seconds)
  110.         private constant    real            ASSIST_DECAY            = 45
  111.         // Can the heroes of leavers get streaks?
  112.         private constant    boolean         LEAVER_HEROES           = false
  113.         // Leavers can assist?
  114.         private constant    boolean         LEAVER_ASSIST           = false
  115.         // Initial Gold base
  116.         private             integer         baseGold                = 210
  117.         // Gold increment according to formulas
  118.         private             integer         goldIncrement           = 10
  119.         // Do you lose gold when you die?
  120.         private             boolean         loseGold                = true
  121.         // Do you gain gold when you kill?
  122.         private             boolean         gainGold                = true
  123.         // Do you want floating texts?
  124.         private constant    boolean         TEXTTAGS                = true
  125.         // Give gold to assisters?
  126.         private constant    boolean         ASSIST_GOLD             = true
  127.         // Does Suicide end a spree?
  128.         private constant    boolean         SUICIDE_ENDS            = false
  129.         // Does a Death end a multikill?
  130.         private constant    boolean         DEATH_END_MULTI         = true
  131.     endglobals
  132.    
  133.     private module Configuration
  134.         private static method onInit takes nothing returns nothing
  135.             set firstSound = NewSound("Sound\\Interface\\GoodJob.wav", 2548, false, S3D)
  136.            
  137.             // Feel free to configure these
  138.             call thistype.newStreak("", "", "", 0) // This was intended because I wanted to add 2 empty instances to the stack.
  139.             call thistype.newStreak("", "", "", 0) // Without these, 1 kill would count as a streak.
  140.             call thistype.newStreak("|cff80ff80killing spree|r",   "is on a |cff80ff80killing spree|r!",               "Sound\\Interface\\GoodJob.wav", 2548)
  141.             call thistype.newStreak("|cffff80c0dominating|r",      "is |cffff80c0dominating|r!",                       "Sound\\Interface\\GoodJob.wav", 2548)
  142.             call thistype.newStreak("|cffffff80mega-kill|r",       "has a |cffffff80mega-kill|r!",                     "Sound\\Interface\\GoodJob.wav", 2548)
  143.             call thistype.newStreak("|cffff8000unstoppable|r",     "is |cffff8000unstoppable|r!",                      "Sound\\Interface\\GoodJob.wav", 2548)
  144.             call thistype.newStreak("|cff00ffa2wicked sick|r",     "is |cff00ffa2wicked sick|r!",                      "Sound\\Interface\\GoodJob.wav", 2548)
  145.             call thistype.newStreak("|cffff0080monster kill|r",    "has a |cffff0080monster kill|r!",                  "Sound\\Interface\\GoodJob.wav", 2548)
  146.             call thistype.newStreak("|cffff0000GODLIKE|r",         "is |cffff0000GODLIKE|r!",                          "Sound\\Interface\\GoodJob.wav", 2548)
  147.             call thistype.newStreak("|cffffa500beyond Godlike|r",  "is |cffffa500beyond Godlike. SOMEONE KILL HIM|r!", "Sound\\Interface\\GoodJob.wav", 2548)
  148.            
  149.             call thistype.newMulti("got a |cff0028ffDouble Kill|r!!",   "Sound\\Interface\\GoodJob.wav", 2548)
  150.             call thistype.newMulti("got a |cff40ff40Triple Kill|r!!!",  "Sound\\Interface\\GoodJob.wav", 2548)
  151.             call thistype.newMulti("got an |cff00bfffUltra-Kill|r!!!!", "Sound\\Interface\\GoodJob.wav", 2548)
  152.             call thistype.newMulti("is on a |cff00ced1Rampage|r!!!!!",  "Sound\\Interface\\GoodJob.wav", 2548)
  153.            
  154.             set thistype.colors[0]  = "|cffff0303"
  155.             set thistype.colors[1]  = "|cff0042ff"
  156.             set thistype.colors[2]  = "|cff1ce6b9"
  157.             set thistype.colors[3]  = "|cff540081"
  158.             set thistype.colors[4]  = "|cfffffc01"
  159.             set thistype.colors[5]  = "|cfffeba0e"
  160.             set thistype.colors[6]  = "|cff20c000"
  161.             set thistype.colors[7]  = "|cffe55bb0"
  162.             set thistype.colors[8]  = "|cff959697"
  163.             set thistype.colors[9]  = "|cff7ebff1"
  164.             set thistype.colors[10] = "|cff106246"
  165.             set thistype.colors[11] = "|cff4e2a04"
  166.         endmethod
  167.     endmodule
  168.    
  169.     private keyword Spree
  170.    
  171.     // Configurable Functions:
  172.    
  173.     private function GetBounty takes integer m, integer n, unit k, unit d returns integer
  174.         return baseGold + goldIncrement * Spree(n).streak + goldIncrement * Spree(m).streak
  175.     endfunction
  176.    
  177.     private function GetLostGold takes integer g returns integer
  178.         return g / 3
  179.     endfunction
  180.    
  181.     private function GetAssistGold takes integer g, integer n returns integer
  182.         return g / n
  183.     endfunction
  184.    
  185.     private function KillingPlayerFilter takes integer playerId returns boolean
  186.         return playerId < 12
  187.     endfunction
  188.    
  189.     private function AssistPlayerFilter takes integer playerId returns boolean
  190.         return playerId < 12
  191.     endfunction
  192.    
  193.     private function DyingPlayerFilter takes integer playerId returns boolean
  194.         return playerId < 12
  195.     endfunction
  196.    
  197.     // *******************************************
  198.     // DO NOT EDIT BELOW THIS LINE!! YOU HEAR ME??
  199.     // *******************************************
  200.    
  201.     globals
  202.         // Table for Timer Data storage
  203.         private Table cache
  204.     endglobals
  205.    
  206.     private keyword Assist
  207.    
  208.     struct StreakSystem extends array
  209.    
  210.         readonly static integer maxSpree = 0
  211.         readonly static integer minSpree = 1
  212.         readonly static integer maxMulti = 1
  213.        
  214.         readonly static Sound firstSound
  215.         readonly static Sound array sounds
  216.         readonly static Sound array multiSound
  217.        
  218.         readonly static string array strings
  219.         readonly static string array multiString
  220.         readonly static string array endString
  221.         readonly static string array colors
  222.        
  223.         static boolean firstblood = false
  224.         static boolean enabled = true
  225.        
  226.         static method newStreak takes string streakName, string streakDisplay, string soundPath, integer duration returns nothing
  227.             if streakName == "" then
  228.                 set minSpree = minSpree + 1
  229.                 set maxSpree = maxSpree + 1
  230.                 return
  231.             endif
  232.            
  233.             set maxSpree = maxSpree + 1
  234.             set strings[maxSpree] = " " + streakDisplay
  235.             set endString[maxSpree] = "'s " + streakName
  236.             set sounds[maxSpree] = NewSound(soundPath, duration, false, S3D)
  237.         endmethod
  238.        
  239.         static method newMulti takes string text, string soundPath, integer duration returns nothing
  240.             set maxMulti = maxMulti + 1
  241.             set multiString[maxMulti] = " " + text
  242.             set multiSound[maxMulti] = NewSound(soundPath, duration, false, S3D)
  243.         endmethod
  244.        
  245.         static method enableGoldGain takes nothing returns nothing
  246.             set gainGold = true
  247.         endmethod
  248.        
  249.         static method disableGoldGain takes nothing returns nothing
  250.             set gainGold = false
  251.         endmethod
  252.        
  253.         static method isGoldGainEnabled takes nothing returns boolean
  254.             return gainGold
  255.         endmethod
  256.        
  257.         static method enableGoldLoss takes nothing returns nothing
  258.             set loseGold = true
  259.         endmethod
  260.        
  261.         static method disableGoldLoss takes nothing returns nothing
  262.             set loseGold = false
  263.         endmethod
  264.        
  265.         static method isGoldLossEnabled takes nothing returns boolean
  266.             return loseGold
  267.         endmethod
  268.        
  269.         static method getBountyBase takes nothing returns integer
  270.             return baseGold
  271.         endmethod
  272.        
  273.         static method setBountyBase takes integer i returns nothing
  274.             set baseGold = i
  275.         endmethod
  276.        
  277.         static method getBountyIncrement takes nothing returns integer
  278.             return goldIncrement
  279.         endmethod
  280.        
  281.         static method setBountyIncrement takes integer i returns nothing
  282.             set goldIncrement = i
  283.         endmethod
  284.        
  285.         static method reset takes nothing returns nothing
  286.             local integer i = 11
  287.            
  288.             loop
  289.                 set Spree(i).streak = 0
  290.                 set Spree(i).counter = 0
  291.                 set Spree(i).multikills = 0
  292.                 set Spree(i).off = false
  293.                
  294.                 exitwhen i == 0
  295.                 set i = i - 1
  296.             endloop
  297.            
  298.             call Assist.refresh()
  299.         endmethod
  300.        
  301.         static method enable takes nothing returns nothing
  302.             set enabled = true
  303.         endmethod
  304.        
  305.         static method disable takes nothing returns nothing
  306.             set enabled = false
  307.         endmethod
  308.        
  309.         static method isEnabled takes nothing returns boolean
  310.             return enabled
  311.         endmethod
  312.        
  313.         implement Configuration
  314.     endstruct
  315.    
  316.     private struct Spree extends array
  317.         integer streak
  318.         integer multikills
  319.         boolean off
  320.         real counter
  321.     endstruct
  322.    
  323.     // You mad Jesus4Lyf?
  324.     private struct Assist extends array
  325.         integer number
  326.        
  327.         Table bool
  328.         Table decay
  329.        
  330.         static thistype array next
  331.         static thistype array prev
  332.        
  333.         method reset takes nothing returns nothing
  334.             set this.number = 0
  335.             call this.bool.flush()
  336.             call this.decay.flush()
  337.         endmethod
  338.        
  339.         static method refresh takes nothing returns nothing
  340.             local thistype this = next[0]
  341.             loop
  342.                 exitwhen this == 0
  343.                 call this.reset()
  344.                 set this = next[this]
  345.             endloop
  346.         endmethod
  347.        
  348.         static method index takes nothing returns nothing
  349.             set next[GetIndexedUnitId()] = 0
  350.             set prev[GetIndexedUnitId()] = prev[0]
  351.             set next[prev[0]] = GetIndexedUnitId()
  352.             set prev[0] = GetIndexedUnitId()
  353.             set thistype(GetIndexedUnitId()).number = 0
  354.             set thistype(GetIndexedUnitId()).bool = Table.create()
  355.             set thistype(GetIndexedUnitId()).decay = Table.create()
  356.         endmethod
  357.        
  358.         static method deindex takes nothing returns nothing
  359.             set next[prev[GetIndexedUnitId()]] = next[GetIndexedUnitId()]
  360.             set prev[next[GetIndexedUnitId()]] = prev[GetIndexedUnitId()]
  361.             set thistype(GetIndexedUnitId()).number = 0
  362.             call thistype(GetIndexedUnitId()).bool.destroy()
  363.             call thistype(GetIndexedUnitId()).decay.destroy()
  364.         endmethod
  365.        
  366.         static method filter takes unit u returns boolean
  367.             return IsUnitType(u,UNIT_TYPE_HERO)
  368.         endmethod
  369.        
  370.         implement UnitIndexStruct
  371.     endstruct
  372.    
  373.     private function AssistBuffer takes nothing returns boolean
  374.         local integer id = GetPlayerId(GetOwningPlayer(DamageEvent.source))
  375.        
  376.         static if LEAVER_ASSIST then
  377.             if not AssistPlayerFilter(id) or DamageEvent.source == null or not IsUnitType(DamageEvent.target,UNIT_TYPE_HERO) or Assist(DamageEvent.targetId).bool.boolean[id] then
  378.                 return false
  379.             endif
  380.         else
  381.             if Spree(id).off or not AssistPlayerFilter(id) or DamageEvent.source == null or not IsUnitType(DamageEvent.target,UNIT_TYPE_HERO) or Assist(DamageEvent.targetId).bool.boolean[id] then
  382.                 return false
  383.             endif
  384.         endif
  385.        
  386.         set Assist(DamageEvent.targetId).bool.boolean[id] = true
  387.         set Assist(DamageEvent.targetId).number = Assist(DamageEvent.targetId).number + 1
  388.         set Assist(DamageEvent.targetId).decay.real[id] = ASSIST_DECAY
  389.        
  390.         return false
  391.     endfunction
  392.    
  393.     private function MultiBuffer takes nothing returns nothing
  394.         local integer i = 11
  395.         local integer k = 11
  396.        
  397.         loop
  398.             set Spree(i).counter = Spree(i).counter - 1
  399.            
  400.             if Spree(i).counter == 0 then
  401.                 set Spree(i).multikills = 0
  402.             endif
  403.            
  404.             exitwhen i == 0
  405.             set i = i - 1
  406.         endloop
  407.        
  408.         set i = Assist.next[0]
  409.        
  410.         loop
  411.             exitwhen i == 0
  412.            
  413.             loop
  414.                 set Assist(i).decay[k] = Assist(i).decay[k] - 1
  415.                
  416.                 if Assist(i).decay[k] == 0 then
  417.                     set Assist(i).bool.boolean[k] = false
  418.                     set Assist(i).number = Assist(i).number - 1
  419.                 endif
  420.                
  421.                 exitwhen k == 0
  422.                 set k = k - 1
  423.             endloop
  424.            
  425.             set k = 11
  426.             set i = Assist.next[i]
  427.         endloop
  428.     endfunction
  429.    
  430.     static if LEAVER_HEROES then
  431.         private function OnLeave takes nothing returns boolean
  432.             set Spree(GetPlayerId(GetTriggerPlayer())).off = true
  433.             return false
  434.         endfunction
  435.     endif
  436.    
  437.     // Wrapper used for readability/configuration
  438.     private function Print takes string s returns nothing
  439.         call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, TEXT_DURATION, s)
  440.     endfunction
  441.    
  442.     // I can make this function uglier if you want..
  443.     private function DoMulti takes nothing returns nothing
  444.         local timer tmr = GetExpiredTimer()
  445.         local integer timerId = GetHandleId(tmr)
  446.         local integer timerData = GetTimerData(tmr)
  447.        
  448.         if 0 < cache.real[timerId] and timerData > StreakSystem.maxMulti then
  449.        
  450.             call Print(cache.string[timerId] + StreakSystem.multiString[StreakSystem.maxMulti])
  451.             call RunSound(StreakSystem.multiSound[StreakSystem.maxMulti])
  452.            
  453.         elseif 0 < cache.real[timerId] and timerData > 1 and timerData <= StreakSystem.maxMulti then
  454.            
  455.             call Print(cache.string[timerId] + StreakSystem.multiString[timerData])
  456.             call RunSound(StreakSystem.multiSound[timerData])
  457.            
  458.         endif
  459.        
  460.         call ReleaseTimer(tmr)
  461.         set tmr = null
  462.     endfunction
  463.    
  464.     private function Process takes player killingPlayer, player dyingPlayer, unit killingUnit, unit dyingUnit returns nothing
  465.         local timer delayTimer = NewTimer()
  466.        
  467.         local integer index = 11
  468.         local integer killingId = GetPlayerId(killingPlayer)
  469.         local integer dyingId = GetPlayerId(dyingPlayer)
  470.        
  471.         local integer killingGold = GetPlayerState(killingPlayer, PLAYER_STATE_RESOURCE_GOLD)
  472.        
  473.         local integer timerId = GetHandleId(delayTimer)
  474.         local integer bounty = GetBounty(killingId, dyingId, killingUnit, dyingUnit)
  475.        
  476.         local string assistString = ""
  477.        
  478.         local string killingName = StreakSystem.colors[killingId] + GetPlayerName(killingPlayer) + "|r"
  479.         local string dyingName = StreakSystem.colors[dyingId] + GetPlayerName(dyingPlayer) + "|r"
  480.        
  481.         local player tempPlayer = null
  482.         local integer unitId = GetUnitUserData(dyingUnit)
  483.        
  484.         static if TEXTTAGS then
  485.             local real cameraCenter = GetCameraField(CAMERA_FIELD_TARGET_DISTANCE) / 2
  486.             local texttag tag
  487.         endif
  488.        
  489.         if Assist(unitId).number > 1 then
  490.             set assistString = " Assists: "
  491.            
  492.             loop
  493.            
  494.                 set tempPlayer = Player(index)
  495.                
  496.                 if IsPlayerEnemy(tempPlayer, dyingPlayer) and Assist(unitId).bool.boolean[index] and index != killingId and index != dyingId and not Spree(index).off then
  497.                     set assistString = assistString + StreakSystem.colors[index] + GetPlayerName(tempPlayer) + "|r/"
  498.                    
  499.                     static if LIBRARY_CombatDataStorage then
  500.                         call IncreasePlayerAssistsById(index)
  501.                     endif
  502.                    
  503.                     static if ASSIST_GOLD then
  504.                         call SetPlayerState(tempPlayer, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(tempPlayer, PLAYER_STATE_RESOURCE_GOLD) + GetAssistGold(bounty, Assist(unitId).number))
  505.                         static if TEXTTAGS then
  506.                             set tag = CreateTextTag()
  507.                            
  508.                             call SetTextTagText(tag, "|cffffcc00+" + I2S(GetAssistGold(bounty, Assist(unitId).number)), 0.024)
  509.                             call SetTextTagPos(tag, GetCameraEyePositionX(), GetCameraEyePositionY() + cameraCenter, 16.0)
  510.                            
  511.                             call SetTextTagVelocity(tag, 0.0, 0.0355)
  512.                             call SetTextTagVisibility(tag, GetLocalPlayer() == tempPlayer)
  513.                             call SetTextTagFadepoint(tag, 1.5)
  514.                            
  515.                             call SetTextTagLifespan(tag, 2.0)
  516.                             call SetTextTagPermanent(tag, false)
  517.                            
  518.                             set tag = null
  519.                         endif
  520.                     endif
  521.                    
  522.                 endif
  523.                
  524.                 exitwhen index == 0
  525.                 set index = index - 1
  526.             endloop
  527.            
  528.             set assistString = SubString(assistString, 0, StringLength(assistString) - 1)
  529.         endif
  530.        
  531.         call Assist(unitId).reset()
  532.        
  533.         if gainGold then
  534.        
  535.             call SetPlayerState(killingPlayer, PLAYER_STATE_RESOURCE_GOLD, killingGold + bounty)
  536.            
  537.             static if TEXTTAGS then
  538.            
  539.                 set tag = CreateTextTag()
  540.                
  541.                 call SetTextTagText(tag, "|cffffcc00+" + I2S(bounty), 0.024)
  542.                 call SetTextTagPos(tag, GetCameraEyePositionX(), GetCameraEyePositionY() + cameraCenter, 16.0)
  543.                
  544.                 call SetTextTagVelocity(tag, 0.0, 0.0355)
  545.                 call SetTextTagVisibility(tag, GetLocalPlayer() == killingPlayer)
  546.                 call SetTextTagFadepoint(tag, 1.5)
  547.                
  548.                 call SetTextTagLifespan(tag, 2.0)
  549.                 call SetTextTagPermanent(tag, false)
  550.                
  551.                 set tag = null
  552.             endif
  553.         endif
  554.        
  555.         if loseGold then
  556.             call SetPlayerState(dyingPlayer, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(dyingPlayer, PLAYER_STATE_RESOURCE_GOLD) - GetLostGold(bounty))
  557.         endif
  558.        
  559.         if StreakSystem.firstblood then
  560.        
  561.             if Spree(dyingId).streak >= StreakSystem.minSpree and Spree(dyingId).streak <= StreakSystem.maxSpree then
  562.                 call Print(dyingName + StreakSystem.endString[Spree(dyingId).streak] + " streak has been ended by " + killingName + " for |cffffcc00" + I2S(bounty) + "|r gold." + assistString)
  563.             elseif Spree(dyingId).streak > StreakSystem.maxSpree then            
  564.                 call Print(dyingName + StreakSystem.endString[StreakSystem.maxSpree] + " streak has been ended by " + killingName + " for |cffffcc00" + I2S(bounty) + "|r gold." + assistString)
  565.             else
  566.                 call Print(killingName + " pwned " + dyingName + "'s head for |cffffcc00" + I2S(bounty) + "|r gold." + assistString)
  567.             endif
  568.            
  569.             if Spree(killingId).streak >= StreakSystem.minSpree and Spree(killingId).streak <= StreakSystem.maxSpree then
  570.            
  571.                 call Print(killingName + StreakSystem.strings[Spree(killingId).streak])
  572.                 call RunSound(StreakSystem.sounds[Spree(killingId).streak])
  573.                
  574.             elseif Spree(killingId).streak > StreakSystem.maxSpree then
  575.            
  576.                 call Print(killingName + StreakSystem.strings[StreakSystem.maxSpree])
  577.                 call RunSound(StreakSystem.sounds[StreakSystem.maxSpree])
  578.                
  579.             endif
  580.         else
  581.        
  582.             set StreakSystem.firstblood = true
  583.             call Print(killingName + " pwned " + dyingName + "'s head for |cffffcc00" + I2S(bounty) + "|r gold." + assistString + "\n" + killingName + " just drew |cffff0000firstblood|r!")
  584.            
  585.             call RunSound(StreakSystem.firstSound)
  586.             call SetPlayerState(killingPlayer, PLAYER_STATE_RESOURCE_GOLD, killingGold + FIRST_GOLD)
  587.         endif
  588.        
  589.         set Spree(killingId).multikills = Spree(killingId).multikills + 1
  590.         set Spree(dyingId).streak = 0
  591.        
  592.         call SetTimerData(delayTimer, Spree(killingId).multikills)
  593.         set cache.real[timerId] = Spree(killingId).counter
  594.         set cache.string[timerId] = killingName
  595.         call TimerStart(delayTimer, INTERVAL, false, function DoMulti)
  596.        
  597.         set tempPlayer = null
  598.         set delayTimer = null
  599.     endfunction
  600.    
  601.     private function Main takes nothing returns nothing
  602.         local unit dyingUnit = GetTriggerUnit()
  603.         local unit killingUnit = GetKillingUnit()
  604.        
  605.         local player dyingPlayer = GetTriggerPlayer()
  606.         local player killingPlayer = GetOwningPlayer(killingUnit)
  607.        
  608.         local integer killingId = GetPlayerId(killingPlayer)
  609.         local integer dyingId = GetPlayerId(dyingPlayer)
  610.        
  611.         loop
  612.             exitwhen not StreakSystem.enabled or not IsUnitType(dyingUnit, UNIT_TYPE_HERO)
  613.            
  614.             static if LEAVER_STREAK then
  615.                 if not KillingPlayerFilter(killingId) or not DyingPlayerFilter(dyingId) or killingUnit == null or killingPlayer == null then
  616.                     call Assist(GetUnitUserData(dyingUnit)).reset()
  617.                     exitwhen true
  618.                 endif
  619.             else
  620.                 if not KillingPlayerFilter(killingId) or not DyingPlayerFilter(dyingId) or killingUnit == null or killingPlayer == null or Spree(killingId).off then
  621.                     call Assist(GetUnitUserData(dyingUnit)).reset()
  622.                     exitwhen true
  623.                 endif
  624.             endif
  625.            
  626.             if IsPlayerAlly(killingPlayer, dyingPlayer) and killingPlayer != dyingPlayer then
  627.            
  628.                 call Print(StreakSystem.colors[killingId] + GetPlayerName(killingPlayer) + "|r has denied his ally " + StreakSystem.colors[dyingId] + "|r!")
  629.                 call Assist(GetUnitUserData(dyingUnit)).reset()
  630.                
  631.                 exitwhen true
  632.             elseif dyingPlayer == killingPlayer then
  633.            
  634.                 call Print(StreakSystem.colors[killingId] + GetPlayerName(dyingPlayer) + "|r has killed himself!")
  635.                
  636.                 static if SUICIDE_ENDS then
  637.                     set Spree(killingId).streak = 0
  638.                 endif
  639.                
  640.                 call Assist(GetUnitUserData(dyingUnit)).reset()
  641.                
  642.                 exitwhen true
  643.             endif
  644.            
  645.             set Spree(killingId).streak = Spree(killingId).streak + 1
  646.             set Spree(killingId).counter = MULTI_TIME
  647.            
  648.             static if DEATH_END_MULTI then
  649.                 set Spree(dyingId).multikills = 0
  650.                 set Spree(dyingId).counter = MULTI_TIME
  651.             endif
  652.            
  653.             call Process(killingPlayer, dyingPlayer, killingUnit, dyingUnit)
  654.            
  655.             exitwhen true
  656.         endloop
  657.        
  658.         set dyingUnit = null
  659.         set killingUnit = null
  660.         set dyingPlayer = null
  661.         set killingPlayer = null
  662.     endfunction
  663.    
  664.     private module Init
  665.         private static method onInit takes nothing returns nothing
  666.             static if LEAVER_HEROES then
  667.                 local trigger t = CreateTrigger()
  668.                 local integer i = 15
  669.                 loop
  670.                     call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_LEAVE)
  671.                     exitwhen i == 0
  672.                     set i = i - 1
  673.                 endloop
  674.                 set t = null
  675.             endif
  676.             call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_DEATH, function Main)
  677.             call DamageEvent.ANY.register(Condition(function AssistBuffer))
  678.             call TimerStart(CreateTimer(), MULTI_UPDATE, true, function MultiBuffer)
  679.             set cache = Table.create()
  680.         endmethod
  681.     endmodule
  682.     private struct Inits extends array
  683.         implement Init
  684.     endstruct
  685.    
  686. endlibrary

Feel free to comment and rate.
Credit isn't required, but it would be highly appreciated. (Just being humble :D)

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 986
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 5
  • WC3 Models: 25
  • WC3 Tutorials: 13
  • WC3 Tools: 10
  • WC3 Maps: 11
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Advanced Streak System v4.3.0.0
« Reply #1 on: June 25, 2013, 07:14:08 PM »
Moved from media section to the new JASS system section. And uber approved for awesomeness!!! YAY

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

  • Rookie - level 3
  • ***
  • Posts: 123
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 3
  • A FRENGERS
    • View Profile
Advanced Streak System v4.3.0.0
« Reply #2 on: June 25, 2013, 08:54:56 PM »
SO NEAT!! :3 :3
I would like to use this :3 :3
Well, I want DotA hero revive system or Compressed Tavern like something else :3 :3
That's would like cool @..@

 

New Hero Selection System for version 1.6!!!

Started by SonofJayBoard General Information

Replies: 3
Views: 5670
Last post July 01, 2013, 03:59:31 PM
by Chaosy
[System] Simulate 3D Sound

Started by PurgeandfireBoard Codes & Snippets

Replies: 7
Views: 14287
Last post July 15, 2013, 12:36:35 AM
by Purgeandfire
What people want in a Custom XP System?

Started by Naoto ShiroganeBoard Triggers & Scripting

Replies: 3
Views: 4030
Last post April 02, 2015, 06:36:41 PM
by moyack
WC3 - New map pool system: PTR 1.29 is coming!!!

Started by moyackBoard Warcraft III News

Replies: 0
Views: 164
Last post August 03, 2017, 08:25:42 AM
by moyack
[System] ElapsedGameTime

Started by Magtheridon96Board Codes & Snippets

Replies: 0
Views: 6567
Last post January 11, 2012, 01:30:59 PM
by Magtheridon96
Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!