• 🏆 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!

[General] Simple kill streak

Status
Not open for further replies.
Level 4
Joined
Dec 16, 2013
Messages
84
Sry for my english
Hi guys, could you explain to me how to trigger kill streak?

I dont want complicated kills streak like dota.
I want kill streak like so:

-The first hero who's give a killing blow, will gain a first blood
-When hero kill another hero within specific time, he will get continuous kill, like double kill, triple kill, ultra kill, rampage
- If a hero killing an enemy without dying, he will get killin spree, dominating, etc until beyond godlike
- And if the hero died under status continuous kill and killing streak,
Set game message like: A hero ended B Hero's godlike and reset contionus kill back to normal

Could you guys explain it to me?
 
Level 11
Joined
Jan 23, 2015
Messages
788
For the killing streak, simply count the kills and reset on death.
For first blood, just run the trigger when someone kills another and destroy it.
For double kill, you also need to count the kills and reset on death, but you need timer for each player to shut down double kill when the time expires.
For the messages, first you need to check whether the dying unit has some streak (for this you also need a boolean to check this, e.g. Player1isKSpree = true), and then display a message accordingly.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
For the killing streak, simply count the kills and reset on death.
For first blood, just run the trigger when someone kills another and destroy it.
For double kill, you also need to count the kills and reset on death, but you need timer for each player to shut down double kill when the time expires.
For the messages, first you need to check whether the dying unit has some streak (for this you also need a boolean to check this, e.g. Player1isKSpree = true), and then display a message accordingly.

Roberts' Way seems fine. But this: ''Player1isKSpree = true'' is better to be Changed with: ''PlayerisKSpree[1] = True''
The reason is: It Has a Little, Little reduced filesize, AND Is 100% Useable In From Each Integer Variable, from X To X. There you can put an If/Then/Else.
 
Level 11
Joined
Jan 23, 2015
Messages
788
Roberts' Way seems fine. But this: ''Player1isKSpree = true'' is better to be Changed with: ''PlayerisKSpree[1] = True''
The reason is: It Has a Little, Little reduced filesize, AND Is 100% Useable In From Each Integer Variable, from X To X. There you can put an If/Then/Else.

Yep, that's a more-simplier way. Set Player number of Killing Unit for the index.
 
Level 4
Joined
Dec 16, 2013
Messages
84

Wow it awesome,
I worked yeah, but i confused.
I mean, that's so confusing for me.

I can't make it work without paste the demo map trigger.

How to make that system work like in this?
-Time elapsed 0.01 seconds turn that sytem

Im pretty sure if i understand vjass that is easy thing, but i spent 2 hours still can't figure it out.

I already the documentaion many times, still confusing. Help

-----
i have an idea to use the demo map trigger (the tutorial, a message type "start" thing), i just need to delete the tutorial, leave the trigger, and put the time elapsed 0.0.1 seconds event.
But how?

thanks
 
Level 4
Joined
Dec 16, 2013
Messages
84
here, but its not my trigger.
the testmap trigger

JASS:
struct TestMap extends array
    static unit hero = null
    static real camDist = 0.
    static timer camDistLocker = CreateTimer()
    static real camX = 0.
    static real camY = 0.
    static timer camXYLocker = CreateTimer()
    static trigger restartTrig = CreateTrigger()
    static integer continue = 1
    static method tryCrash takes nothing returns integer
        return 1/continue
    endmethod
    static method print takes string s returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 5, s)
    endmethod
    static method printEx takes string s, real d returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, d, s)
    endmethod
    static method wait takes real time returns nothing
        call TriggerSleepAction(time)
    endmethod
    static method randomEnemy takes nothing returns player
        return Player(GetRandomInt(3,5))
    endmethod
    static method randomAlly takes nothing returns player
        return Player(GetRandomInt(1,2))
    endmethod
    static method makeEnemy takes real x, real y returns unit
        return CreateUnit(randomEnemy(), 'Hamg', x, y, 270)
    endmethod
    static method makeAlly takes real x, real y returns unit
        return CreateUnit(randomAlly(), 'Hmkg', x, y, 270)
    endmethod
    static method makeStrongAlly takes real x, real y returns unit
        return CreateUnit(randomAlly(), 'H000', x, y, 270)
    endmethod
    static method makeStrongEnemy takes real x, real y returns unit
        return CreateUnit(randomEnemy(), 'H000', x, y, 270)
    endmethod
    static method damage takes unit source, unit target, real amount returns nothing
        call UnitDamageTarget(source, target, amount, false, false, null, null, null)
    endmethod
    static method ally takes player p1, player p2 returns nothing
        call SetPlayerAlliance(p1, p2, ALLIANCE_PASSIVE,       true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_HELP_REQUEST,  true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_HELP_RESPONSE, true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_XP,     true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_SPELLS, true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_PASSIVE,       true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_HELP_REQUEST,  true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_HELP_RESPONSE, true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_XP,     true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_SPELLS, true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_VISION, true)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_VISION, true)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_VISION, false)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_VISION, false)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_CONTROL, false)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_CONTROL, false)
        call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
        call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
    endmethod
    static method giveVision takes nothing returns nothing
        call FogModifierStart(CreateFogModifierRect(Player(0),FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,true,true))
    endmethod
    static method lockDist takes nothing returns nothing
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, camDist, 0)
    endmethod
    static method lockXY takes nothing returns nothing
        call SetCameraPosition(camX, camY)
    endmethod
    static method lockCamDistance takes real distance returns nothing
        set camDist = distance
        call TimerStart(camDistLocker, 0.05, true, function thistype.lockDist)
    endmethod
    static method lockCamXY takes real x, real y returns nothing
        set camX = x
        set camY = y
        call TimerStart(camXYLocker, 0.05, true, function thistype.lockXY)
    endmethod
    static method unlockCamDistance takes nothing returns nothing
        call PauseTimer(camDistLocker)
    endmethod
    static method unlockCamXY takes nothing returns nothing
        call PauseTimer(camXYLocker)
    endmethod
    static method revive takes nothing returns nothing
        call ReviveHero(hero, GetUnitX(hero), GetUnitY(hero), false)
    endmethod
    static multiboard board = null
    static method setTitle takes integer col, string val returns nothing
        call MultiboardSetItemValue(MultiboardGetItem(board, 0, col), val)
    endmethod
    static method setBox takes integer col, integer val returns nothing
        call MultiboardSetItemValue(MultiboardGetItem(board, 1, col), I2S(val))
    endmethod
    static method multiboardUpdate takes nothing returns nothing
        if board==null then
            set board=CreateMultiboard()
            call MultiboardClear(board)
            call MultiboardSetColumnCount(board, 15)
            call MultiboardSetRowCount(board, 2)
            call MultiboardSetItemsStyle(board, true, false)
            call MultiboardDisplay(board, true)
            call MultiboardMinimize(board, false)
            call MultiboardSetItemsWidth(board, 0.02)
            call setTitle(0,  "K")
            call setTitle(1,  "Dt")
            call setTitle(2,  "A")
            call setTitle(3,  "Dn")
            call setTitle(4,  "S")
            call setTitle(5,  "St")
            call setTitle(6,  "S3")
            call setTitle(7,  "S4")
            call setTitle(8,  "S5")
            call setTitle(9,  "Mt")
            call setTitle(10, "M2")
            call setTitle(11, "M3")
            call setTitle(12, "M4")
            call setTitle(13, "M5")
            call setTitle(14, "CB")
        endif
        call setBox(0,  StreakSystem.getKillsById(0))
        call setBox(1,  StreakSystem.getDeathsById(0))
        call setBox(2,  StreakSystem.getAssistsById(0))
        call setBox(3,  StreakSystem.getDeniesById(0))
        call setBox(4,  StreakSystem.getSuicidesById(0))
        call setBox(5,  StreakSystem.getStreaksById(0))
        call setBox(6,  StreakSystem.getStreaksOfTypeById(0,3))
        call setBox(7,  StreakSystem.getStreaksOfTypeById(0,4))
        call setBox(8,  StreakSystem.getStreaksOfTypeById(0,5))
        call setBox(9,  StreakSystem.getMultikillsById(0))
        call setBox(10, StreakSystem.getMultikillsOfTypeById(0,2))
        call setBox(11, StreakSystem.getMultikillsOfTypeById(0,3))
        call setBox(12, StreakSystem.getMultikillsOfTypeById(0,4))
        call setBox(13, StreakSystem.getMultikillsOfTypeById(0,5))
        call setBox(14, StreakSystem.getCombobreakersById(0))
    endmethod
    static method startMultiboard takes nothing returns nothing
        call TimerStart(CreateTimer(), 0.01, true, function thistype.multiboardUpdate)
    endmethod
    static method createLeEnemies takes nothing returns nothing
        if GetRandomInt(0,1) == 0 then
            call makeEnemy(GetRandomReal(-1000,1000), GetRandomReal(-1000,1000))
        else
            call makeAlly(GetRandomReal(-1000,1000), GetRandomReal(-1000,1000))
        endif
    endmethod
    static boolean running = false
    private static method stop takes nothing returns nothing
        local unit u
        set continue = 0
        call DestroyTrigger(restartTrig)
        
        call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0, 0, 9001, null)
        loop
            set u = FirstOfGroup(bj_lastCreatedGroup)
            exitwhen u == null
            call GroupRemoveUnit(bj_lastCreatedGroup, u)
            call RemoveUnit(u)
        endloop
        call CreateUnit(Player(0), 'H000', 0, 0, 0)
        call TimerStart(CreateTimer(), 1, true, function thistype.createLeEnemies)
    endmethod
    private static method do takes nothing returns nothing
        local integer i = 0
        local unit u
        local unit v
        local unit u1
        local unit u2
        local unit u3
        local unit u4
        if not running then
            set running = true
            set hero = CreateUnit(Player(0), 'H000', 0, 0, 270)
            call wait(2)
            call print("Testing suicide.")
            call tryCrash()
            call wait(1)
            call tryCrash()
            call damage(hero, hero, 100000)
            call wait(2)
            call tryCrash()
            call print("Testing Denial.")
            call revive()
            call wait(1)
            call tryCrash()
            set u = makeAlly(0, -256)
            call IssueTargetOrder(hero, "attack", u)
            call wait(2)
            call RemoveUnit(u)
            call tryCrash()
            call print("Testing Streaks and Multikills.")
            loop
                set u = makeEnemy(0, -256)
                call IssueTargetOrder(hero, "attack", u)
                call wait(3)
                call tryCrash()
                call RemoveUnit(u)
                set i = i + 1
                exitwhen i == 5
            endloop
            call print("Testing Combobreaker")
            call PauseUnit(hero, true)
            set u = makeStrongEnemy(0, -256)
            call IssueTargetOrder(hero, "attack", u)
            call wait(5)
            call RemoveUnit(u)
            call tryCrash()
            call print("Testing Assists.")
            call ReviveHero(hero, 0, 0, false)
            call PauseUnit(hero, true)
            set u = makeAlly(256, 0)
            set v = makeEnemy(0, -256)
            call IssueTargetOrder(u, "attack", v)
            call wait(2)
            call tryCrash()
            call PauseUnit(hero, false)
            call IssueTargetOrder(hero, "attack", v)
            call wait(3)
            call tryCrash()
            call RemoveUnit(u)
            call RemoveUnit(v)
            call print("Testing Assists Again.")
            call PauseUnit(hero, true)
            set u1 = makeAlly(0,0)
            set u2 = makeAlly(0,0)
            set u3 = makeAlly(0,0)
            set u4 = makeAlly(0,0)
            set v = makeEnemy(0, -256)
            call IssueTargetOrder(u1, "attack", v)
            call IssueTargetOrder(u2, "attack", v)
            call IssueTargetOrder(u3, "attack", v)
            call IssueTargetOrder(u4, "attack", v)
            call wait(3)
            call tryCrash()
            call PauseUnit(hero, false)
            call IssueTargetOrder(hero, "attack", v)
            call wait(2)
            call tryCrash()
            call RemoveUnit(u1)
            call RemoveUnit(u2)
            call RemoveUnit(u3)
            call RemoveUnit(u4)
            call RemoveUnit(v)
            call print("Random Tests")
            call print("Watch Carefully")
            set u = makeStrongAlly(256,256)
            call SetUnitTimeScale(u, 0.3)
            set u = makeStrongAlly(-256,256)
            call SetUnitTimeScale(u, 0.3)
            set u = makeStrongEnemy(-256,-256)
            call SetUnitTimeScale(u, 0.3)
            set u = makeStrongEnemy(256,-256)
            call SetUnitTimeScale(u, 0.3)
            set u = makeEnemy(0,0)
            call SetUnitTimeScale(u, 0.3)
            set u = makeAlly(0,0)
            call SetUnitTimeScale(u, 0.3)
            set u = makeEnemy(0,0)
            call SetUnitTimeScale(u, 0.3)
            set u = makeAlly(0,0)
            call SetUnitTimeScale(u, 0.3)
            call wait(6)
            call tryCrash()
            call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0, 0, 8000, null)
            loop
                set u = FirstOfGroup(bj_lastCreatedGroup)
                exitwhen u == null
                call GroupRemoveUnit(bj_lastCreatedGroup, u)
                call RemoveUnit(u)
            endloop
            set running = false
        endif
    endmethod
    static method run takes nothing returns nothing
        local trigger t
        call startMultiboard()
        call giveVision()
        call lockCamDistance(2500)
        call lockCamXY(0,0)
        call ally(Player(0), Player(1))
        call ally(Player(0), Player(2))
        call ally(Player(1), Player(2))
        call ally(Player(4), Player(5))
        call ally(Player(4), Player(6))
        call ally(Player(5), Player(6))
        call do()
        call TriggerRegisterPlayerChatEvent(restartTrig, Player(0), "restart", true)
        call TriggerAddAction(restartTrig, function thistype.do)
        call DestroyTrigger(GetTriggeringTrigger())
        call ClearTextMessages()
        call printEx("Type 'restart' to restart the entire demonstration.", 60)
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "stop", true)
        call TriggerAddAction(t, function thistype.stop)
        call printEx("Type 'stop' to start the user trial. You can type 'stop' while a restart has been done and it will skip to the user trial just fine", 60)
        set t = null
    endmethod
    private static method config takes nothing returns nothing
        //Configuration:
        call StreakSystem.setFirstBloodSound("Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.setComboBreakerSound("Sound\\Interface\\GoodJob.wav", 2548)
        
        call StreakSystem.setMinimumStreak(3)
        call StreakSystem.newStreak("|cff80ff80killing spree|r",  "is on a |cff80ff80killing spree|r!",               "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffff80c0dominating|r",     "is |cffff80c0dominating|r!",                       "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffffff80mega-kill|r",      "has a |cffffff80mega-kill|r!",                     "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffff8000unstoppable|r",    "is |cffff8000unstoppable|r!",                      "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cff00ffa2wicked sick|r",    "is |cff00ffa2wicked sick|r!",                      "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffff0080monster kill|r",   "has a |cffff0080monster kill|r!",                  "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffff0000GODLIKE|r",        "is |cffff0000GODLIKE|r!",                          "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newStreak("|cffffa500beyond Godlike|r", "is |cffffa500beyond Godlike. SOMEONE KILL HIM|r!", "Sound\\Interface\\GoodJob.wav", 2548)
        
        call StreakSystem.newMultikill("got a |cff0028ffDouble Kill|r!!",   "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newMultikill("got a |cff40ff40Triple Kill|r!!!",  "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newMultikill("got an |cff00bfffUltra-Kill|r!!!!", "Sound\\Interface\\GoodJob.wav", 2548)
        call StreakSystem.newMultikill("is on a |cff00ced1Rampage|r!!!!!",  "Sound\\Interface\\GoodJob.wav", 2548)
    endmethod
    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "start", true)
        call TriggerAddAction(t, function thistype.run)
        call config()
        set t = null
        call print("Type 'start' to begin.")
    endmethod
endstruct
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Here it is then. There are few tweaks that could be useful but I didn't add. Killing allies counts in the kill spree for example, but it's kinda hard to test if they attack you. I didn't add a message for ending killing sprees either. But it's a simple if block so should not be any issue for you to add if you know jass.

JASS:
library KillStreak initializer TimerInit

	globals
		group killStreakGroup = CreateGroup()
		private hashtable hash = InitHashtable()
		private string array rank
	endglobals
	
	private function UnitDies takes nothing returns nothing
		local unit u = GetKillingUnit()
		local integer h
		local integer count
		if IsUnitType(u, UNIT_TYPE_HERO) then
			call GroupAddUnit(killStreakGroup, u)
			set h = GetHandleId(u)
			set count = LoadInteger(hash, h, 2) + 1
			call SaveReal(hash, h, 1, 0)
			call SaveInteger(hash, h, 2, count)
			debug call BJDebugMsg("Kill Streak System: current kills for " + GetUnitName(u) + " " + I2S(count))
			if count > 1 then
				call BJDebugMsg(GetUnitName(u) + " " + rank[count])
			endif
		else
			debug call BJDebugMsg("Kill Streak System: The killed target was not a hero!")
		endif
	endfunction

	private function GroupFunction takes nothing returns nothing
		local unit u = GetEnumUnit()
		local integer h = GetHandleId(u)
		local real count = LoadReal(hash, h, 1) + 0.03
		if count >= 10 then
			call FlushChildHashtable(hash, h)
			call GroupRemoveUnit(killStreakGroup, u)
			debug call BJDebugMsg("Kill Streak System: " + GetUnitName(u) + "'s killing spree timer has been reset!")
		else
			call SaveReal(hash, h, 1, count)
		endif
	endfunction

	private function TimeCall takes nothing returns nothing
		call ForGroup(killStreakGroup, function GroupFunction)
	endfunction
	
	private function TimerInit takes nothing returns nothing
		local trigger t = CreateTrigger()
		call TimerStart(CreateTimer(), 0.03, true, function TimeCall)
		call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
		call TriggerAddAction(t, function UnitDies)
		set rank [2] = "Double kill!"
		set rank [3] = "Tripple kill!"
		set rank [4] = "is dominating!"
		set rank [5] = "Monster kill!"
	endfunction

endlibrary
 

Attachments

  • Simple Killstreak.w3x
    18.5 KB · Views: 62
Level 30
Joined
Jan 31, 2010
Messages
3,551
Import guide:
Before anything else, you'll need to copy the Libraries this system uses from the triggers, to your map. This system offers you a selection between several systems, so if you are already using one of those in your map, you don't need to use up a whole new library to make it work.
First of all, go and copy DamageEvents to your map (You can use the "Window" tab where File and Edit are to very quickly switch between your map and ASS). Then copy UnitIndexer, SoundTools and Event by Nestharus. Then copy WorldBounds, PriorityEvent, BinaryHeap, TimerUtils, Table, AVL and RegisterPlayerUnitEvent.

Then go to Object Editor, and copy up the ability Unit Indexing. Then go to Triggers and UnitIndexer, click anywhere in the script, hold CRTL and hit F. Type out "A@!!" without punctuations. The system will move your page to where the system should be. Go to Object Editor again, find the newly imported ability, and hit CTRL + D. Remember what's it first four letters are like "A00D" for an example. Go to Triggers, and replace "A@!!" with those four letters. Lastly, copy the ASS in your map. Then set up the spree sounds and texts and you're good to go.

edit: kinda late eh? Anyways, please be kind to link us the "better" system so that we can point out it's flaws or congratulate you on finding one. I haven't saw anything better than Mag's system so far.
 
Level 4
Joined
Dec 16, 2013
Messages
84
Import guide:
Before anything else, you'll need to copy the Libraries this system uses from the triggers, to your map. This system offers you a selection between several systems, so if you are already using one of those in your map, you don't need to use up a whole new library to make it work.
First of all, go and copy DamageEvents to your map (You can use the "Window" tab where File and Edit are to very quickly switch between your map and ASS). Then copy UnitIndexer, SoundTools and Event by Nestharus. Then copy WorldBounds, PriorityEvent, BinaryHeap, TimerUtils, Table, AVL and RegisterPlayerUnitEvent.

Then go to Object Editor, and copy up the ability Unit Indexing. Then go to Triggers and UnitIndexer, click anywhere in the script, hold CRTL and hit F. Type out "A@!!" without punctuations. The system will move your page to where the system should be. Go to Object Editor again, find the newly imported ability, and hit CTRL + D. Remember what's it first four letters are like "A00D" for an example. Go to Triggers, and replace "A@!!" with those four letters. Lastly, copy the ASS in your map. Then set up the spree sounds and texts and you're good to go.

edit: kinda late eh? Anyways, please be kind to link us the "better" system so that we can point out it's flaws or congratulate you on finding one. I haven't saw anything better than Mag's system so far.

http://www.hiveworkshop.com/forums/...-0-7-a-251977/?prev=search=streak&d=list&r=20

btw thanks for the tutorial, i did that long time ago. But still confusing
correction, maybe mag system is better but jondrean is more simple for me hehe.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
You don't have to reset double triple... kill on death. It only needs a timer, a hero can have a rampage after he got triple kill and died with his still continuing spell effects, dmg over times etc...

According to my logic it's not a kill streak if you're dead. I know LoL don't agree with me though.
 
Status
Not open for further replies.
Top