This is a simple gui multiboard what do the following:
About importing:
- Copy cheat ability to your map for Damage detection system
- Copy all trigger to your map and you are done
Its easy, no?
Basic Description:
- keep tracking the scores, hero kill, last hits, assists and creep kill
- order the multiboard rows by amount(Asc/Desc)
More Description:
u can set few thing in setting trigger like:
- Ordered field (u can order the any field exclude player names) - this also work with ingame command
- You can set if a player leave then he can get a "left" name and keep him in multiboard or remove from multiboard the leaver player
- you can set in settings trigger the multiboard name, the column titles/colors/width/icons
- indifferent if player play with different color, its show the player row with same color than player
- you can turn on off/on the ordering in settings trigger and in game too
- you can choose asc ordering or desc ordering in settings trigger
- you can filter in settings trigger what player u want show in multiboard (example only user player, only computer, all or make if selection for that)
- you can set in settings trigger the points for: Hero kill, Hero assist killing, Hero last hit, Unit kill.
And more
- system detect the highest damage dealer, so killer is who dealed the highest damage and not who last hited the boss
- who dealed damage on boss but not highest get assist hero score, who last hited the boss get last hit point
- the data stored with array system and u can handle pretty easily everything i just give a example:
Mb_Player[index] = player number, Mb_Player_Index[player number] = index
so u can manipulate it easily
-
if somebody want then i can make a shorter version what could be faster, in jass what also gui friendly just have a few more custom script line
map init1
Map Init
Events
Map initialization
Conditions
Actions
Set ColorCodes[1] = |CFFFF0303
Set ColorCodes[2] = |CFF0042FF
Set ColorCodes[3] = |CFF1CE6B9
Set ColorCodes[4] = |CFF540081
Set ColorCodes[5] = |CFFFFFC01
Set ColorCodes[6] = |CFFFE8A0E
Set ColorCodes[7] = |CFF20C000
Set ColorCodes[8] = |CFFE55BB0
Set ColorCodes[9] = |CFF959697
Set ColorCodes[10] = |CFF7EBFF1
Set ColorCodes[11] = |CFF106246
Set ColorCodes[12] = |CFF4E2A04
Set ColorCodes[13] = |CFF303030
Set PlayerColorList[1] = Red
Set PlayerColorList[2] = Blue
Set PlayerColorList[3] = Teal
Set PlayerColorList[4] = Purple
Set PlayerColorList[5] = Yellow
Set PlayerColorList[6] = Orange
Set PlayerColorList[7] = Green
Set PlayerColorList[8] = Pink
Set PlayerColorList[9] = Gray
Set PlayerColorList[10] = Light Blue
Set PlayerColorList[11] = Dark Green
Set PlayerColorList[12] = Brown
Set PlayerColorList[13] = Black
Hashtable - Create a hashtable
Set Damage_Table = (Last created hashtable)
settings
Settings
Events
Map initialization
Conditions
Actions
-------- multiboard title --------
Set Mb_Title = Kill Scoreboard
-------- how many row u want --------
Set Mb_Max_Col = 6
-------- Column names + width + color + icon --------
Set Mb_Col_Names[1] = Player Names
Set Mb_Col_Names[2] = Score
Set Mb_Col_Names[3] = Hero Kill
Set Mb_Col_Names[4] = Assist
Set Mb_Col_Names[5] = Last Hits
Set Mb_Col_Names[6] = Unit Kill
Set Mb_Col_Width[1] = 8.00
Set Mb_Col_Width[2] = 6.00
Set Mb_Col_Width[3] = 6.00
Set Mb_Col_Width[4] = 6.00
Set Mb_Col_Width[5] = 6.00
Set Mb_Col_Width[6] = 6.00
Set Mb_Col_Color[1] = |CFFFFFFa0
Set Mb_Col_Color[2] = |CFFFFFFa0
Set Mb_Col_Color[3] = |CFFFFFFa0
Set Mb_Col_Color[4] = |CFFFFFFa0
Set Mb_Col_Color[5] = |CFFFFFFa0
Set Mb_Col_Color[6] = |CFFFFFFa0
Set Mb_Icon[1] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
Set Mb_Icon[2] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
Set Mb_Icon[3] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
Set Mb_Icon[4] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
Set Mb_Icon[5] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
Set Mb_Icon[6] = UI\MiniMap\MinimapIcon\MinimapIconGold.blp
-------- enable the multiboard ordering --------
Set OrderingOn = True
-------- if ordered field = --------
-------- 1 = Total Point --------
-------- 2 = Hero Kill --------
-------- 3 = Assist Kill --------
-------- 4 = Last Hit Kill --------
-------- 5 = Creep Kill --------
Set OrderedField = 1
-------- OrderDesc make order from highest number till lowest --------
Set OrderDesc = True
-------- Score/Point setting for different kill type --------
-------- Dont forget if u kill alone a hero then u get last hit + killing points too --------
-------- Point highest damage on enemy hero --------
Set OrderPHeroKill = 2
-------- Point for last hit on enemy hero --------
Set OrderPHeroLastHit = 1
-------- Point for assist in killing enemy hero --------
Set OrderPHeroAss = 1
-------- Point for normal unit or creep --------
Set OrderPUnit = 1
-------- Remove Player from multiboard if he leave from game? --------
Set OrderRemoveLeaver = False
-------- pick all player who is controled by user --------
Set PlayerGroup = (All players)
create multiboard
Create multiboard
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Game - Display to (All players) for 10000.00 seconds the text: |cff7070ffChat comm...
Set Mb_Length = 6
Set TempNr = (Number of players in PlayerGroup)
Multiboard - Create a multiboard with Mb_Max_Col columns and (TempNr + 1) rows, titled Mb_Title
Set Multiboard = (Last created multiboard)
For each (Integer a) from 1 to Mb_Max_Col, do (Actions)
Loop - Actions
Multiboard - Set the icon for Multiboard item in column a, row 1 to Mb_Icon[a]
Multiboard - Set the width for Multiboard item in column a, row 1 to Mb_Col_Width[a]% of the total screen width
Multiboard - Set the text for Multiboard item in column a, row 1 to (Mb_Col_Color[a] + (Mb_Col_Names[a] + |r))
Player Group - Pick every player in PlayerGroup and do (Actions)
Loop - Actions
Set Player = (Picked player)
Set i = (Player number of Player)
Set Mb_Index = (Mb_Index + 1)
Set Mb_Player[Mb_Index] = i
Set Mb_Player_Index[i] = Mb_Index
Set PlayerName[i] = (Name of Player)
For each (Integer a) from 1 to 13, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Color of Player) Equal to PlayerColorList[a]
Then - Actions
Set PlayerColor[i] = ColorCodes[a]
Set a = 13
Else - Actions
For each (Integer a) from 1 to Mb_Max_Col, do (Actions)
Loop - Actions
Multiboard - Set the icon for Multiboard item in column a, row (Mb_Index + 1) to UI\Minimap\MinimapIconCreepLoc.blp
Multiboard - Set the width for Multiboard item in column a, row (Mb_Index + 1) to Mb_Col_Width[a]% of the total screen width
Multiboard - Set the text for Multiboard item in column 1, row (Mb_Index + 1) to ((ColorCodes[i] + (Name of (Player(i)))) + |r)
((Killing unit) belongs to an enemy of (Triggering player)) Equal to True
((Triggering unit) is A structure) Equal to False
((Owner of (Killing unit)) is in PlayerGroup) Equal to True
Actions
Set k = (Player number of (Owner of (Killing unit)))
Set TempNr = Mb_Player_Index[k]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A Hero) Equal to True
Then - Actions
Set cv = (Custom value of (Triggering unit))
Set dmg = 0.00
Set HighestDamage = 0.00
Set Boolean = False
For each (Integer a) from 1 to 12, do (Actions)
Loop - Actions
Set dmg = (Load cv of a from Damage_Table)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
dmg Greater than 0.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
dmg Greater than HighestDamage
Then - Actions
Set HighestDamage = dmg
Set HighestDD = a
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HighestDamage Greater than (Total_Damage_Dealt[cv] - 1.00)
Then - Actions
Set Mb_HeroKill[Mb_Player_Index[HighestDD]] = (Mb_HeroKill[Mb_Player_Index[HighestDD]] + 1)
Set Mb_TotalKill[TempNr] = (Mb_TotalKill[TempNr] + OrderPHeroKill)
Game - Display to (All players) the text: ((PlayerColor[HighestDD] + (Name of (Player(HighestDD)))) + (|r killed + ((Name of (Triggering unit)) + ( with |cffff7070 + ((String(HighestDamage)) + |r damage)))))
Else - Actions
For each (Integer a) from 1 to 12, do (Actions)
Loop - Actions
Set dmg = (Load cv of a from Damage_Table)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
dmg Greater than 0.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
a Not equal to HighestDD
Then - Actions
Set Mb_HeroAssist[Mb_Player_Index[a]] = (Mb_HeroAssist[Mb_Player_Index[a]] + 1)
Game - Display to (All players) the text: ((PlayerColor[a] + (Name of (Player(a)))) + (|r assisted in killing + ((Name of (Triggering unit)) + ( with |cffff7070 + ((String(dmg)) + |r damage)))))
Set Mb_TotalKill[TempNr] = (Mb_TotalKill[TempNr] + OrderPHeroAss)
Else - Actions
Game - Display to (All players) the text: ((PlayerColor[a] + (Name of (Player(a)))) + (|r killed + ((Name of (Triggering unit)) + ( with |cffff7070 + ((String(dmg)) + |r damage)))))
Set Mb_TotalKill[TempNr] = (Mb_TotalKill[TempNr] + OrderPHeroKill)
Set Mb_HeroKill[Mb_Player_Index[a]] = (Mb_HeroKill[Mb_Player_Index[a]] + 1)
Else - Actions
Set Mb_HeroLastHit[TempNr] = (Mb_HeroLastHit[TempNr] + 1)
Set Mb_TotalKill[TempNr] = (Mb_TotalKill[TempNr] + OrderPHeroLastHit)
Else - Actions
Set Mb_TotalKill[TempNr] = (Mb_TotalKill[TempNr] + OrderPUnit)
Set Mb_CreepKill[TempNr] = (Mb_CreepKill[TempNr] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempNr Greater than 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderingOn Equal to True
Then - Actions
For each (Integer a) from 1 to (TempNr - 1), do (Actions)
Loop - Actions
Set b = (TempNr - a)
Set c = (b + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderedField Equal to 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mb_TotalKill[c] Greater than Mb_TotalKill[b]
Then - Actions
Set Boolean = True
Else - Actions
Set Boolean = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderedField Equal to 2
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mb_HeroKill[c] Greater than Mb_HeroKill[b]
Then - Actions
Set Boolean = True
Else - Actions
Set Boolean = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderedField Equal to 3
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mb_HeroLastHit[c] Greater than Mb_HeroLastHit[b]
Then - Actions
Set Boolean = True
Else - Actions
Set Boolean = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderedField Equal to 4
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mb_HeroAssist[c] Greater than Mb_HeroAssist[b]
Then - Actions
Set Boolean = True
Else - Actions
Set Boolean = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderedField Equal to 5
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mb_CreepKill[c] Greater than Mb_CreepKill[b]
Then - Actions
Set Boolean = True
Else - Actions
Set Boolean = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Boolean Equal to True
Then - Actions
Set i = Mb_TotalKill[c]
Set Mb_TotalKill[c] = Mb_TotalKill[b]
Set Mb_TotalKill[b] = i
Set i = Mb_HeroKill[c]
Set Mb_HeroKill[c] = Mb_HeroKill[b]
Set Mb_HeroKill[b] = i
Set i = Mb_CreepKill[c]
Set Mb_CreepKill[c] = Mb_CreepKill[b]
Set Mb_CreepKill[b] = i
Set i = Mb_Player[c]
Set Mb_Player[c] = Mb_Player[b]
Set Mb_Player[b] = i
Set Mb_Player_Index[Mb_Player[c]] = c
Set Mb_Player_Index[Mb_Player[b]] = b
Else - Actions
Else - Actions
Else - Actions
Set Total_Damage_Dealt[cv] = 0.00
Hashtable - Clear all child hashtables of child cv in Damage_Table
Trigger - Run Multiboard update <gen> (ignoring conditions)
multiboard update
Multiboard update
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderDesc Equal to True
Then - Actions
For each (Integer a) from 1 to Mb_Index, do (Actions)
Loop - Actions
Set TempNr = Mb_Player[a]
Multiboard - Set the text for Multiboard item in column 1, row (a + 1) to ((PlayerColor[TempNr] + PlayerName[TempNr]) + |r)
Multiboard - Set the text for Multiboard item in column 2, row (a + 1) to ((PlayerColor[TempNr] + (String(Mb_TotalKill[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 3, row (a + 1) to ((PlayerColor[TempNr] + (String(Mb_HeroKill[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 4, row (a + 1) to ((PlayerColor[TempNr] + (String(Mb_HeroLastHit[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 5, row (a + 1) to ((PlayerColor[TempNr] + (String(Mb_HeroAssist[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 6, row (a + 1) to ((PlayerColor[TempNr] + (String(Mb_CreepKill[a]))) + |r)
Else - Actions
For each (Integer a) from 1 to Mb_Index, do (Actions)
Loop - Actions
Set b = ((Mb_Index + 1) - a)
Set TempNr = Mb_Player[a]
Multiboard - Set the text for Multiboard item in column 1, row (b + 1) to ((ColorCodes[TempNr] + (Name of (Player(Mb_Player[a])))) + |r)
Multiboard - Set the text for Multiboard item in column 2, row (b + 1) to ((ColorCodes[TempNr] + (String(Mb_TotalKill[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 3, row (b + 1) to ((ColorCodes[TempNr] + (String(Mb_HeroKill[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 4, row (b + 1) to ((ColorCodes[TempNr] + (String(Mb_HeroLastHit[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 5, row (b + 1) to ((ColorCodes[TempNr] + (String(Mb_HeroAssist[a]))) + |r)
Multiboard - Set the text for Multiboard item in column 6, row (b + 1) to ((ColorCodes[TempNr] + (String(Mb_CreepKill[a]))) + |r)
player leave
Player Leave the game
Events
Player - Player 1 (Red) leaves the game
Player - Player 2 (Blue) leaves the game
Player - Player 3 (Teal) leaves the game
Player - Player 4 (Purple) leaves the game
Player - Player 5 (Yellow) leaves the game
Player - Player 6 (Orange) leaves the game
Player - Player 7 (Green) leaves the game
Player - Player 8 (Pink) leaves the game
Player - Player 9 (Gray) leaves the game
Player - Player 10 (Light Blue) leaves the game
Player - Player 11 (Dark Green) leaves the game
Player - Player 12 (Brown) leaves the game
Conditions
Mb_Player_Index[(Player number of (Triggering player))] Not equal to 0
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OrderRemoveLeaver Equal to True
Then - Actions
Set a = Mb_Player_Index[(Player number of (Triggering player))]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
a Not equal to Mb_Index
Then - Actions
Set Mb_CreepKill[a] = Mb_CreepKill[Mb_Index]
Set Mb_HeroAssist[a] = Mb_HeroAssist[Mb_Index]
Set Mb_HeroKill[a] = Mb_HeroKill[Mb_Index]
Set Mb_HeroLastHit[a] = Mb_HeroLastHit[Mb_Index]
Set Mb_TotalKill[a] = Mb_TotalKill[Mb_Index]
Set Mb_Player[a] = Mb_Player[Mb_Index]
Set Mb_Player_Index[Mb_Player[a]] = Mb_Player_Index[Mb_Player[Mb_Index]]
Else - Actions
Multiboard - Change the number of rows for Multiboard to Mb_Index
Set Mb_Index = (Mb_Index - 1)
Else - Actions
Set PlayerName[(Player number of (Triggering player))] = -- Left ---
Set UG = (Units owned by (Triggering player))
Unit Group - Pick every unit in UG and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Custom script: call DestroyGroup(udg_UG)
Combat Stat Timer
InCombatTimer
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
For each (Integer a) from 1 to CombatIndex, do (Actions)
Loop - Actions
Set cv = CombatI2CV[a]
Set CombatTimer[cv] = (CombatTimer[cv] - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CombatTimer[a] Less than 1
Then - Actions
Set CombatTimer[cv] = 0
Set Total_Damage_Dealt[cv] = 0.00
Hashtable - Clear all child hashtables of child CombatPlayer[a] in Damage_Table
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
a Not equal to CombatIndex
Then - Actions
Set CombatI2CV[a] = CombatI2CV[CombatIndex]
Set CombatTimer[CombatI2CV[a]] = CombatTimer[CombatI2CV[CombatIndex]]
Set CombatPlayer[a] = CombatI2CV[CombatIndex]
Else - Actions
Set CombatIndex = (CombatIndex - 1)
Set a = (a - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CombatIndex Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
and another thins are optional, that i dont posted coz simple things like this
Kick Player Command
Events
Player - Player 1 (Red) types a chat message containing (Substring(-kick , 1, 6)) as A substring
Conditions
(Length of (Entered chat string)) Greater than 6
Actions
Set String = (Substring((Entered chat string), 7, ((Length of (Entered chat string)) - 7)))
Set PlayerNumber = (Integer(String))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PlayerNumber Greater than 0
PlayerNumber Less than 13
Then - Actions
Game - Defeat (Player(PlayerNumber)) with the message: Defeat!
Else - Actions
Credit: Bribe for Gui Damage Engine - i used it for detect the killer/assister
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
13:44, 17th Jul 2012
Magtheridon96:
Currently, this isn't very modular.
I think you shouldn't handle assists and kills.
You should allow the user to configure an update trigger.
In...
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
13:44, 17th Jul 2012
Magtheridon96:
Currently, this isn't very modular.
I think you shouldn't handle assists and kills.
You should allow the user to configure an update trigger.
In that trigger, he would assign the new values for kills, assists, deaths, and all kinds of things.
To make this more configurable, you should use a hashtable.
In the hashtable, you would use the first key as a player index and the second as an index for whatever you want to store.
(For example, if 1 -> Kills and 2 -> Deaths, then the keys 5,2 would point to Player 5's deaths.)
Also, there are null icons showing up in the multiboard. You should only show icons where it's needed.
See, a multiboard system needs to allow users to create their very own multiboard.
This is in need of a major update.
If you can actually pull this off and make a "Make-Your-Own" Multiboard system, then it would get a 4.1/5 from me.
You don't need to use the "leaves with defeat events", the "leaves" events will suffice.
Also, there's no linked list in there o-o
You don't need one though.
You don't need to use the "leaves with defeat events", the "leaves" events will suffice.
Also, there's no linked list in there o-o
You don't need one though.
about linked list, i thought linked list when u make this
index = index +1
data1[index] = blabla
data2[index] = blabla
data3[index] = blabla
and i use it for order the multiboard for correct order also for remove player. this easier than check everyplayer, if example have 3 user player then i check 3 player
if killer do atleast 1 dmg then he get assist too but be serious, what game where the healer the killer? mostly in mmorpg example allways have healer+tank+damage dealer. since this not about drop and exp share, i think its ok, mainly because mostly i guess have less game where healer allways just heal somebody at boss and do 0 damage.
in my map i made damage based experience, there i check if assisters are ally of killer, then assisters also get similiar exp but i guess here this useless.
allocatindex function just increase the index by 1, right?
next and prev is global or local?
what is prev[0] ? is 0 or last stored index? (how i hate the this multiple array index things )
ah, then seems isnt linked list just array job what i made, other side u got any downside with my trigger working?
No, it doesn't increase it by 1, it finds an index either by adding 1 if there are no instances to recycle, but if there is something to recycle, it would just use that.
This is what we call Dynamic Indexing.
To allocate an index, all you need is an integer array and an integer (recycler[] and count)
You find an index like this:
JASS:
set index = recycler[0]
if index == 0 then
set count = count + 1
set index = count
else
set recycler[0] = recycler[index]
endif
You recycle an index (meaning deallocate) like this:
JASS:
set recycler[index] = recycler[0]
set recycler[0] = index
You would loop from 1 to count to iterate through all instances.
This isn't the best solution when you're allocating a lot of instances, then deallocating a lot, but trust me, it's fine.
the real killer is always the one who deals the killing blow...
at the very least you can add the option to configure the killer part so the user can choose if it will be the real killer or the one who dealt most damage...
the real killer is always the one who deals the killing blow...
at the very least you can add the option to configure the killer part so the user can choose if it will be the real killer or the one who dealt most damage...
if u ever player mmorpg like perfect world, muonline there not the killing blow important, the most of damage, what the mob drop (if attacker dont was in party/squade) then the highest damage dealer could pick, this way u avoid the kill steal, example when u attack a mob longer than coming somebody and last hit the mob its fair if he get the kill only coz he last hitted? i doubt
anyway u can customize the points in settings for last hit and kill also the column names, so u can rename to highest damage, as u want, there is the settings trigger
You would loop from 1 to count to iterate through all instances.
This isn't the best solution when you're allocating a lot of instances, then deallocating a lot, but trust me, it's fine.
then where have adcantage from it? (a bit annoying when sombody post vjass then i cant decide what was global and what was local )
so overall its something like this?
JASS:
function Trig_increase_Actions takes nothing returns nothing
set udg_index = allocate()
set udg_next[udg_index] = 0
set udg_prev[udg_index] = udg_prev[0]
set udg_next[udg_prev[0]] = udg_index
set udg_prev[0] = udg_index
endfunction
//===========================================================================
function InitTrig_increase takes nothing returns nothing
set gg_trg_increase = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_increase, Player(0), "1", true )
call TriggerAddAction( gg_trg_increase, function Trig_increase_Actions )
endfunction
JASS:
function Trig_rnd_decrease_Actions takes nothing returns nothing
call deallocate(GetRandomInt(0,udg_index))
endfunction
//===========================================================================
function InitTrig_rnd_decrease takes nothing returns nothing
set gg_trg_rnd_decrease = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_rnd_decrease, Player(0), "2", true )
call TriggerAddAction( gg_trg_rnd_decrease, function Trig_rnd_decrease_Actions )
endfunction
JASS:
function allocate takes nothing returns integer
local integer this = udg_prev[0]
if this == 0 then
set udg_index = udg_index + 1
return udg_index
endif
set udg_prev[0] = udg_prev[this]
return this
endfunction
function deallocate takes integer this returns nothing
set udg_prev[this] = udg_prev[0]
set udg_prev[0] = this
endfunction
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.