System Swap System

Vestras

Retired
Reaction score
248
Swap System​

Story
I was chatting with Romek on MSN, looking for a system idea. Suddenly I come upon an idea; a swap system. I told Romek, asked him if it could be useful. And here is the result.

Implementing
Implementing is easy; just import the dummy and the trigger, and set the raw code in the code to match your imported dummy's raw code. (To view raw codes, press CTRL + D in object editor)

Why gamecache?
Because I didn't want to create a struct for just player id storing and speed doesn't really matter in such a system.

What is it?
This system registers when a player types -swaphero, puts up a dialog for the typing player which asks what player the typing player wants to swap with. When selected, a dialog is shown for the choosen player, which asks if he/she wants to swap with the typing player. If yes, replaces the hero of the typing player with the choosen player's hero. Of course items is transfered.

Code
JASS:
//*********************************************************
//* VESSwapSystem    
//* ------------
//*                                                         
//*    By Vestras     
//*    Implementation
//*    
//*    Simply import the trigger Table and this trigger
//*    into your map and change the configuration
//*    until it fits your needs.
//*
//*    Credits 
//*    I would like to thank Romek for helping me a little
//*    and telling me I should make this
//*    Furthermore, I would like to thank Flare for his
//*    eternal pester about me improving the code <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue    :p" loading="lazy" data-shortname=":p" />
//*    Without him this script would leak badly
//*    And when using this, remember to credit me!                                                            
//*********************************************************

library VESSwapSystem initializer Initialize_VESSetup uses Table

globals
    private constant string COMMAND        = &quot;-swaphero&quot; // The command
    private constant real MAXELAPSED       = 60          // Maximum elapsed game time before you can&#039;t swap anymore
                                                         // Use 0 if there should be no limit
    private constant boolean DIVIDETEAM    = false       // Make players only able to swap with teammates?
    private constant integer PLAYERSTEAM   = 6           // Number of players on each team
                                                         // Will only be used if DIVIDETEAM is true
    private constant boolean USEHERONAMES  = true        // Use hero names instead of player names?
                                                         // Will use player names if the players don&#039;t got any heroes
    // Necessary
    private timer REGTIMER  = CreateTimer()
    private group GRP       = CreateGroup()
    private group NOSWAP    = CreateGroup()
    private trigger tc      = CreateTrigger()
    private StringTable st
    
    private boolean array ALRDYSWP[12]
    private button array BUTN [12][12]
endglobals

private function GetPlayerNameColored takes player id returns string // thanks to Vexorian for this function
 local playercolor col=GetPlayerColor(id)
 local string r=GetPlayerName(id)
    if col == PLAYER_COLOR_RED then
        set r=&quot;|cffff0000&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_BLUE then
        set r=&quot;|cff0000ff&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_CYAN then
        set r=&quot;|cff93ffc9&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_PURPLE then
        set r=&quot;|cff400080&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_YELLOW then
        set r=&quot;|cffffff00&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_ORANGE then
        set r=&quot;|cffff8000&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_GREEN then
        set r=&quot;|cff00c400&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_PINK then
        set r=&quot;|cffff80c0&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_LIGHT_GRAY then
        set r=&quot;|cff808080&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_LIGHT_BLUE then
        set r=&quot;|cffc1c1ff&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_AQUA then
        set r=&quot;|cff5e5e2f&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_BROWN then
        set r=&quot;|cff004000&quot;+r+&quot;|r&quot;
    else
        set r=&quot;|cff000000&quot;+r+&quot;|r&quot;
    endif
 //set col=null commented because Romek told me that playercolors don&#039;t leak
 return r
endfunction

private function GetUnitNameColored takes unit u returns string
 local playercolor col=GetPlayerColor(GetOwningPlayer(u))
 local string r=GetUnitName(u)
    if col == PLAYER_COLOR_RED then
        set r=&quot;|cffff0000&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_BLUE then
        set r=&quot;|cff0000ff&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_CYAN then
        set r=&quot;|cff93ffc9&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_PURPLE then
        set r=&quot;|cff400080&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_YELLOW then
        set r=&quot;|cffffff00&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_ORANGE then
        set r=&quot;|cffff8000&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_GREEN then
        set r=&quot;|cff00c400&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_PINK then
        set r=&quot;|cffff80c0&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_LIGHT_GRAY then
        set r=&quot;|cff808080&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_LIGHT_BLUE then
        set r=&quot;|cffc1c1ff&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_AQUA then
        set r=&quot;|cff5e5e2f&quot;+r+&quot;|r&quot;
    elseif col == PLAYER_COLOR_BROWN then
        set r=&quot;|cff004000&quot;+r+&quot;|r&quot;
    else
        set r=&quot;|cff000000&quot;+r+&quot;|r&quot;
    endif
 //set col=null commented because Romek told me that playercolors don&#039;t leak
 return r
endfunction

private function onSwapCommand_CondFilt takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true and GetOwningPlayer(GetFilterUnit()) == Player(st[&quot;tplayer&quot;])
endfunction

private function onSwap_CondFilt1 takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true and GetOwningPlayer(GetFilterUnit()) == Player(st[&quot;swapp&quot;])
endfunction

private function onSwap_CondFilt2 takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true and GetOwningPlayer(GetFilterUnit()) == Player(st[&quot;temps2&quot;])
endfunction

private function onSwapCommand_Conditions takes nothing returns boolean
    local player p = GetTriggerPlayer()
    local integer id = GetPlayerId(p)
    local unit s = null
    set st[&quot;tplayer&quot;] = id
    call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwapCommand_CondFilt))
    set s = FirstOfGroup(GRP)
    call GroupClear(GRP)
    if MAXELAPSED &gt; 0 then
        if not IsTriggerEnabled(tc) then
            call DisplayTextToPlayer(p, 0, 0, &quot;|cffff0000SWAP ERROR:|r You can&#039;t swap heroes anymore.&quot;)
            set s = null
            return false
        endif
    endif
    if GetUnitState(s, UNIT_STATE_LIFE) &lt;= 0 then
        call DisplayTextToPlayer(p, 0, 0, &quot;|cffff0000SWAP ERROR:|r Your hero must be alive in order to swap.&quot;)
        set s = null
        return false
    endif
    if ALRDYSWP[id] then
        call DisplayTextToPlayer(p, 0, 0, &quot;|cffff0000SWAP ERROR:|r You can&#039;t swap heroes more than once per game.&quot;)
        set s = null
        return false
    endif
    set s = null
    return true
endfunction

// By Flare
globals
    private integer array ItemIds[2][6]
    private integer array ItemCharges[2][6]
endglobals

private function SwapItems takes unit first, unit second returns nothing
    local integer i = 0
    local item itm
    loop
    exitwhen i == 6
        set itm = UnitItemInSlot (first, i)
        set ItemIds[0]<i> = GetItemTypeId (itm)
        set ItemCharges[0]<i> = GetItemCharges (itm)
        call RemoveItem (itm)
        set itm = UnitItemInSlot (second, i)
        set ItemIds[1]<i> = GetItemTypeId (itm)
        set ItemCharges[1]<i> = GetItemCharges (itm)
        call RemoveItem (itm)
        set i = i + 1
    endloop
    set i = 0
    loop
    exitwhen i == 6
        set itm = UnitAddItemById (first, ItemIds[1]<i>)
        call SetItemCharges (itm, ItemCharges[1]<i>)
        set itm = UnitAddItemById (second, ItemIds[0]<i>)
        call SetItemCharges (itm, ItemCharges[0]<i>)
        set i = i + 1
    endloop
    set itm = null
endfunction

private function onSwap takes nothing returns boolean
    local player p = GetTriggerPlayer()
    local integer pid = GetPlayerId(p)
    local integer id = st[&quot;swapp&quot;]
    local integer j = 0
    local unit s1
    local unit s2
    call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwap_CondFilt1))
    set s1 = FirstOfGroup(GRP)
    call GroupClear(GRP)
    if GetUnitState(s1, UNIT_STATE_LIFE) &lt;= 0 or s1 == null then
        call DisplayTextToPlayer(Player(id), 0, 0, &quot;|cffff0000SWAP ERROR:|r Your hero must be alive in order to swap.&quot;)
        set ALRDYSWP[pid] = false
        set s1 = null
        return false
    endif
    if ALRDYSWP[id] then
        call DisplayTextToPlayer(Player(id), 0, 0, &quot;|cffff0000SWAP ERROR:|r You can&#039;t swap heroes more than once per game.&quot;)
        set s1 = null
        return false
    endif
    set st[&quot;temps2&quot;] = pid
    call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwap_CondFilt2))
    set s2 = FirstOfGroup(GRP)
    call GroupClear(GRP)
    if IsUnitInGroup(s1, NOSWAP) then
        call DisplayTextToPlayer(Player(id), 0, 0, &quot;|cffff0000SWAP ERROR:|r One or more units are unable to be swapped.&quot;)
        set s1 = null
        set s2 = null
        return false
    elseif IsUnitInGroup(s2, NOSWAP) then
        call DisplayTextToPlayer(Player(id), 0, 0, &quot;|cffff0000SWAP ERROR:|r One or more units are unable to be swapped.&quot;)
        set s1 = null
        set s2 = null
        return false
    endif
    set ALRDYSWP[id] = true
    set ALRDYSWP[pid] = true
    call SwapItems(s1, s2)
	call SetUnitOwner(s1, p, true)
	call SetUnitOwner(s2, Player(id), true)
    if GetLocalPlayer() == p then
        call ClearSelection()
        call SelectUnit(s1, true)
    endif
    if GetLocalPlayer() == Player(id) then
        call ClearSelection()
        call SelectUnit(s2, true)
    endif
    set s1 = null
    set s2 = null
    return false
endfunction

private function onSwapRequest takes player p returns nothing
    local integer id = st[&quot;swapp&quot;]
    local dialog d = DialogCreate()
    local button b = DialogAddButton(d, &quot;Yes&quot;, 0)
    local trigger t = CreateTrigger()
    call DialogAddButton(d, &quot;No&quot;, 0)
    call DialogSetMessage(d, &quot;Swap heroes with &quot; + GetPlayerNameColored(p) + &quot;?&quot;)
    call TriggerRegisterDialogButtonEvent(t, b)
    call TriggerAddCondition(t, Condition(function onSwap))
    call DialogDisplay(Player(id), d, true)
    set d = null
    set t = null
endfunction

private function onSwapWithPlayer takes nothing returns boolean
    local player p = GetTriggerPlayer()
    local integer j = 0
    loop
        if GetClickedButton() == BUTN[GetPlayerId(p)][j] and j &lt; 12 then // I had to do the j &lt; 12 (here and other places), because else it would fuck up the dialog
            set st[&quot;swapp&quot;] = j
        endif
        
        set j = j + 1
        exitwhen j == bj_MAX_PLAYER_SLOTS
    endloop
    call onSwapRequest(p)
    return false
endfunction

private function onSwapCommand_Actions takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local integer id = GetPlayerId(p)
    local dialog d = DialogCreate()
    local integer j = 0
    local trigger t = CreateTrigger()
    local trigger trg = CreateTrigger()
    local unit s = null
    local string str = &quot;&quot;
    call DialogSetMessage(d, &quot;Pick a player to swap heroes with&quot;)
    call  DialogAddButton(d, &quot;Cancel&quot;, 0)
    
    if not DIVIDETEAM then
        loop
            if Player(j) != p and j &lt; 12 then
                if not USEHERONAMES then
                    set BUTN[id][j + 1] = DialogAddButton(d, GetPlayerNameColored(Player(j)) + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                else
                    set st[&quot;temps2&quot;] = j
                    call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwap_CondFilt2))
                    if CountUnitsInGroup(GRP) &gt; 0 then
                        set s = FirstOfGroup(GRP)
                        set str = GetUnitNameColored(s)
                    else
                        set str = GetPlayerNameColored(Player(j))
                    endif
                    call GroupClear(GRP)
                    call st.flush(&quot;temps2&quot;)
                    set BUTN[id][j + 1] = DialogAddButton(d, str + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                endif
            call TriggerRegisterDialogButtonEvent(t, BUTN[id][j + 1])
            endif
            
            set j = j + 1
            exitwhen j == bj_MAX_PLAYER_SLOTS
        endloop
    else
        if id &lt; PLAYERSTEAM then
            loop
                if Player(j) != p then
                    if not USEHERONAMES then
                        set BUTN[id][j + 1] = DialogAddButton(d, GetPlayerNameColored(Player(j)) + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                    else
                        set st[&quot;temps2&quot;] = j
                        call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwap_CondFilt2))
                        if CountUnitsInGroup(GRP) &gt; 0 then
                            set s = FirstOfGroup(GRP)
                            set str = GetUnitNameColored(s)
                        else
                            set str = GetPlayerNameColored(Player(j))
                        endif
                        call GroupClear(GRP)
                        call st.flush(&quot;temps2&quot;)
                        set BUTN[id][j + 1] = DialogAddButton(d, str + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                    endif
                    call TriggerRegisterDialogButtonEvent(t, BUTN[id][j + 1])
                endif
                
                set j = j + 1
                exitwhen j == PLAYERSTEAM
            endloop
        else
            set j = PLAYERSTEAM
            loop
                if Player(j) != p then
                    if not USEHERONAMES then
                        set BUTN[id][j + 1] = DialogAddButton(d, GetPlayerNameColored(Player(j)) + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                    else
                        set st[&quot;temps2&quot;] = j
                        call GroupEnumUnitsInRect(GRP, bj_mapInitialPlayableArea, Filter(function onSwap_CondFilt2))
                        if CountUnitsInGroup(GRP) &gt; 0 then
                            set s = FirstOfGroup(GRP)
                            set str = GetUnitNameColored(s)
                        else
                            set str = GetPlayerNameColored(Player(j))
                        endif
                        call GroupClear(GRP)
                        call st.flush(&quot;temps2&quot;)
                        set BUTN[id][j + 1] = DialogAddButton(d, str + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                    endif
                    call TriggerRegisterDialogButtonEvent(t, BUTN[id][j + 1])
                endif
                
                set j = j + 1
                exitwhen j == PLAYERSTEAM * 2
            endloop
        endif
    endif
    call TriggerAddCondition(t, Condition(function onSwapWithPlayer))
    call DialogDisplay(p, d, true)
    set d = null
    set s = null
endfunction

function SetUnitMaySwap takes unit whichUnit, boolean flag returns boolean
    if flag then
        call GroupAddUnit(NOSWAP, whichUnit)
        set flag = true
    else
        if IsUnitInGroup(whichUnit, NOSWAP) then
            call GroupRemoveUnit(NOSWAP, whichUnit)
            set flag = true
        else
            call DisplayTextToPlayer(GetOwningPlayer(whichUnit), 0, 0, &quot;|cffff0000SWAP ERROR:|r The unit is already able to be swapped.&quot;)
            set flag = false
        endif
    endif
    return flag
endfunction

//===========================================================================
private function onEndCleanUp takes nothing returns nothing
    call st.destroy()
    call DestroyTimer(GetExpiredTimer())
    call DisableTrigger(tc)
endfunction
private function Initialize_VESSetup takes nothing returns nothing
    local integer j = 0
    
    loop
        call TriggerRegisterPlayerChatEvent(tc, Player(j), COMMAND, true) 
        
        set j = j + 1
        exitwhen j == bj_MAX_PLAYER_SLOTS
    endloop
    
    call TriggerAddCondition(tc, Condition(function onSwapCommand_Conditions))
    call TriggerAddAction(tc, function onSwapCommand_Actions)
    call TimerStart(REGTIMER, MAXELAPSED, false, function onEndCleanUp) // This is just a dummy timer for registering when the MAXELAPSED has passed
    set st = StringTable.create()
endfunction

endlibrary</i></i></i></i></i></i></i></i>


Credits
I would like to thank Romek for looking a little bit at the code and telling me that I should make this. :p
Furthermore, credit me when using this.

Test map
Test map is attached here:
 

Attachments

  • VESSwapSystem.JPG
    VESSwapSystem.JPG
    83.4 KB · Views: 451
  • VESSwapSystem 1.06.w3x
    27.7 KB · Views: 313

Flare

Stops copies me!
Reaction score
662
trg leaks in onSwapCommand_Actions - you created it, then overwrote it about 4 lines later :p

JASS:
set BUTN[j + 1] = b

Why the +1? Just use GetPlayerId retrieving the array index

Also
JASS:
                set b = DialogAddButton(d, GetPlayerNameColored(Player(j)) + &quot; [&quot; + I2S(j + 1) + &quot;]&quot;, 0)
                set BUTN[j + 1] = b

becomes
JASS:
set BUTN[j + 1] = DialogAddButton (d, GetPlayerNameColored (Player (j)) + &quot;[&quot; + I2S (j + 1) + &quot;]&quot;, 0)


Hmmm.....
JASS:
call onSwapRequest.execute(GetTriggerPlayer())

Any reason why you're .execute'ing the function, other than for the sake of using it

Why do you add the TriggerAddCondition in each part of the if? That's just silly - move it to the end, since it's common to all sections of the if. Quite pointless to add extra unnecessary code
 

Igor_Z

You can change this now in User CP.
Reaction score
61
Can u make it in GUI please? + can u make it without dialog?
 

Flare

Stops copies me!
Reaction score
662
Can u make it in GUI please? + can u make it without dialog?
... why should he make it in GUI? There is little configuration (and, depending on the map, there is probably none at all) and all you have to do is type -swaphero ingame.

And changing it to not use a dialog is wasteful IMO - if it works this way, it'd just be an almighty pain in the arse to change it.

Also, code-related thing
JASS:
call TimerStart(REGTIMER, 3600, false, function onEndCleanUp)

Replace 3600 with MAXELAPSED, make the chat message trigger a global, and disable it when REGTIMER elapsed. Seems pointless doing the check everytime -swaphero is used, when you could just disable the trigger and add some display messages there to indicate that the command is disabled

Also, why do you need a dummy unit? Just store the items being swapped in arrays, destroy the existing items and create new ones via the item ID's you stored (or just remove the items from the first hero and add them to the other hero, if it's possible) - less importing needed, especially with something that isn't really necessary anyway
 

Vestras

Retired
Reaction score
248
Updated.

> Flare

Any reason why I shouldn't use .execute?
Dummy > read the comment.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Any reason why I shouldn't use .execute?

Because it's over skilled, the function is not hudge, there is absolutely no need to create a trigger (yes i know it is created at the map init only) and execute it, just for that.

Also .execute is slower than a simple call.

In fact it's like using a machine gun for killing a rabbit, instead of a knife.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Also using a game cache just for that is lame, at least use the library Table if you don't want to use a struct, but wth you don't want it ?
 

PureOwnage

Minecraft Server OP, Inactive.
Reaction score
72
Can you put the names of the heroes in the dialog buttons?
Anyways +rep
 

ronaldo

New Member
Reaction score
0
Thanks for this, i will use it on my map and give credits to you. (now its better, because it use library Table )
 

Igor_Z

You can change this now in User CP.
Reaction score
61
I like it, it is good but i don't know JASS and i can't change anything in it... Thats why i asked for GUI version. Nvm gj to you
 

Flare

Stops copies me!
Reaction score
662
I like it, it is good but i don't know JASS and i can't change anything in it... Thats why i asked for GUI version. Nvm gj to you
But you don't even need to know JASS to use this. All you do is copy the system into your map, start the game with some players and type -swaphero # (# being a number between 1 and 12, presumably) and use the dialog options.

Also, the first part of the if in onSwapCommand_Conditions is now useless - once the timer is destroyed, there's no point trying to check the remaining time (and the timer elapsed after MAXELAPSED so...), and the IsTriggerEnabled check isn't needed either since while it's enabled, the system will be in effect and when the trigger is disabled, you won't be able to use the system through the chat command. If you want a "It's too late to swap" message, do it in onEndCleanup
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
The dummy unit requirement is useless and annoying.
Just use SetUnitPosition.

Also there is absolutely no need to make dynamic triggers, and use an (array) struct or why not a 2D array with constants integer instead of Table.
 

Flare

Stops copies me!
Reaction score
662
If you want to swap items without requiring a dummy
JASS:
globals
    integer array ItemIds[2][6]
    integer array ItemCharges[2][6]
endglobals

function SwapItems takes unit first, unit second returns nothing
    local integer i = 0
    local item itm
    loop
    exitwhen i == 6
        set itm = UnitItemInSlot (first, i)
        set ItemIds[0]<i> = GetItemTypeId (itm)
        set ItemCharges[0]<i> = GetItemCharges (itm)
        call RemoveItem (itm)
        set itm = UnitItemInSlot (second, i)
        set ItemIds[1]<i> = GetItemTypeId (itm)
        set ItemCharges[1]<i> = GetItemCharges (itm)
        call RemoveItem (itm)
        set i = i + 1
    endloop
    set i = 0
    loop
    exitwhen i == 6
        set itm = UnitAddItemById (first, ItemIds[1]<i>)
        call SetItemCharges (itm, ItemCharges[1]<i>)
        set itm = UnitAddItemById (second, ItemIds[0]<i>)
        call SetItemCharges (itm, ItemCharges[0]<i>)
        set i = i + 1
    endloop
    set itm = null
endfunction</i></i></i></i></i></i></i></i>

First and second unit had 2 completely different item-sets, items were swapped and replaced in precisely the same order they were found

Alternatively, instead of destroying the old items and recreating them, you could drop the items from both heroes, and then give first hero's items to second hero, and vice versa


EDIT: Also, those comments in the middle of the code - what's the point in them? So far, their only uses that I can see are (a) to try and make you look like you're incredible at JASS and everyone else is dumb and that we need explanations for simple things*, or (b) that Romek held your hand while doing this**

*
JASS:
// Because RemoveUnit(du) can bug -&gt; Any competent JASSers who read your code (well, competent JASSers are probably the only ones who are going to even bother) would already know this

// This is just a dummy timer for registering when the MAXELAPSED has passed -&gt; ... I thought the fact that it&#039;s interval is MAXELAPSED would&#039;ve given that away

// Just a dummy for holding items -&gt; Hmmm, maybe it could&#039;ve been a dummy caster, to piss people off when they are swapping heroes!


**
JASS:
//set col=null commented because Romek told me that playercolors don&#039;t leak -&gt; ... If Romek told you that you wouldn&#039;t die from jumping off a very tall cliff, would you do it?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
RemoveUnit is perfectly safe unless you need to detect the death of this dummy unit, and you don't need it both (the dummy and the hide+kill)
 

Vestras

Retired
Reaction score
248
Thanks Flare, everything works now :)
But can you tell me something -- why do we need 2DArrays for that?

About the comments >

I just wanted to clear up the code a bit, actually help. No harm meant.

Updated. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top