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

Item Set System v.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: GywGod133
Item Set System
v2

Description:
Item Sets are a common feature in most RPG games that causes items to give more bonuses the more items belonging to the same set are gathered. This system mimics that effect with easy setup and configuration of items and the abilities/bonuses to be added per set level just by filling up a few variables.

Features:
- Seamless buff indicator update. It will not disappear nor will another one will show up to update it.
- Choice whether to add a buff indicator or not.
- Transformation abilities do not affect, and thus will not remove, the set effects.

Requires:
- none



1. Make sure that the option 'Automatically create unknown variables while pasting trigger data' in File->Preferences is checked.

2. Copy the entire trigger category/folder 'ItemSetSystemGUI' into the map.


1. Simply create a trigger with the 'Map Initialization' event and fill up the following variables with the values needed:

ItemSet_RegisterR_Item[array] -> up to six item-types
ItemSet_RegisterR_SetBonus[array] -> up to six abilities (one per set level)

Unless the set gives a bonus even with just one item present, skip 'ItemSet_RegisterR_SetBonus[1],' and go directly to 'ItemSet_RegisterR_SetBonus[2].'

2. If using buff placers to indicate the current set level (optional), use the following variables:

ItemSet_RegisterO_BuffPlacer[array] -> up to six abilities that places the buff
ItemSet_RegisterO_Buff[array] -> up to six buffs, each corresponding to the one applied by the buff placer

3. And then simply add the action 'Trigger - Run RegisterItemSet<gen> (ignoring Conditions)' at the end.

It should look somewhat like this:
Set ItemSet_RegisterR_Item[1] = <item1>
Set ItemSet_RegisterR_Item[2] = <item2>
Set ItemSet_RegisterR_Item[3] = <item3>
Set ItemSet_RegisterR_SetBonus[2] = <ability2>
Set ItemSet_RegisterR_SetBonus[3] = <ability3>
Trigger - Run RegisterItemSet<gen> (ignoring Conditions)

That's it.


  • Example1 Assassin Set
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Assassin --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = Cloak of Shadows
      • Set ItemSet_RegisterR_Item[2] = Silent Killer
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Assassin 2/2 (+30% attack speed)
      • -------- Optional: --------
      • Set ItemSet_RegisterO_BuffPlacer[1] = Set: Assassin (Buff Placer - 1)
      • Set ItemSet_RegisterO_BuffPlacer[2] = Set: Assassin (Buff Placer - 2)
      • Set ItemSet_RegisterO_Buff[1] = |cff87ceebSet:|r Assassin (1)
      • Set ItemSet_RegisterO_Buff[2] = |cff87ceebSet:|r Assassin (2)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)
  • Example2 Dragon Slayer Set
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Dragon Slayer Set --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = |cffff0000Dragon's Heart|r
      • Set ItemSet_RegisterR_Item[2] = |cffff0000Flamestone Helmet|r
      • Set ItemSet_RegisterR_Item[3] = |cffff0000Gauntlet of the Dragon Slayer|r
      • Set ItemSet_RegisterR_Item[4] = |cffff0000Tablet of the Dragon Slayer|r
      • Set ItemSet_RegisterR_Item[5] = |cffff0000The Anvil of Broken Claws|r
      • Set ItemSet_RegisterR_Item[6] = |cffff0000The Dragon Eater|r
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Dragon Slayer 2/6 (+5 HP regeneration)
      • Set ItemSet_RegisterR_SetBonus[3] = Set: Dragon Slayer 3/6 (+5 armor)
      • Set ItemSet_RegisterR_SetBonus[4] = Set: Dragon Slayer 4/6 (+20 attack damage)
      • Set ItemSet_RegisterR_SetBonus[5] = Set: Dragon Slayer 5/6 (+500 HP)
      • Set ItemSet_RegisterR_SetBonus[6] = Set: Dragon Slayer 6/6 (+25 Strength)
      • -------- Optional: --------
      • Set ItemSet_RegisterO_BuffPlacer[1] = Set: Dragon Slayer (Buff Placer - 1)
      • Set ItemSet_RegisterO_BuffPlacer[2] = Set: Dragon Slayer (Buff Placer - 2)
      • Set ItemSet_RegisterO_BuffPlacer[3] = Set: Dragon Slayer (Buff Placer - 3)
      • Set ItemSet_RegisterO_BuffPlacer[4] = Set: Dragon Slayer (Buff Placer - 4)
      • Set ItemSet_RegisterO_BuffPlacer[5] = Set: Dragon Slayer (Buff Placer - 5)
      • Set ItemSet_RegisterO_BuffPlacer[6] = Set: Dragon Slayer (Buff Placer - 6)
      • Set ItemSet_RegisterO_Buff[1] = |cff87ceebSet:|r Dragon Slayer (1)
      • Set ItemSet_RegisterO_Buff[2] = |cff87ceebSet:|r Dragon Slayer (2)
      • Set ItemSet_RegisterO_Buff[3] = |cff87ceebSet:|r Dragon Slayer (3)
      • Set ItemSet_RegisterO_Buff[4] = |cff87ceebSet:|r Dragon Slayer (4)
      • Set ItemSet_RegisterO_Buff[5] = |cff87ceebSet:|r Dragon Slayer (5)
      • Set ItemSet_RegisterO_Buff[6] = |cff87ceebSet:|r Dragon Slayer (6)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)
  • Example3 Wizard Set
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Wizard --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = Staff of Power
      • Set ItemSet_RegisterR_Item[2] = Magic Talisman
      • Set ItemSet_RegisterR_Item[3] = Robe of the Magi
      • Set ItemSet_RegisterR_Item[4] = |cffff8c00Grimoire of Souls|r
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Wizard 2/4 (+100% mana regeneration)
      • Set ItemSet_RegisterR_SetBonus[3] = Set: Wizard 3/4 (+120 mana)
      • Set ItemSet_RegisterR_SetBonus[4] = Set: Wizard 4/4 (+10 Intelligence)
      • -------- Optional: --------
      • Set ItemSet_RegisterO_BuffPlacer[1] = Set: Wizard (Buff Placer - 1)
      • Set ItemSet_RegisterO_BuffPlacer[2] = Set: Wizard (Buff Placer - 2)
      • Set ItemSet_RegisterO_BuffPlacer[3] = Set: Wizard (Buff Placer - 3)
      • Set ItemSet_RegisterO_BuffPlacer[4] = Set: Wizard (Buff Placer - 4)
      • Set ItemSet_RegisterO_Buff[1] = |cff87ceebSet:|r Wizard (1)
      • Set ItemSet_RegisterO_Buff[2] = |cff87ceebSet:|r Wizard (2)
      • Set ItemSet_RegisterO_Buff[3] = |cff87ceebSet:|r Wizard (3)
      • Set ItemSet_RegisterO_Buff[4] = |cff87ceebSet:|r Wizard (4)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)


  • Example1 Assassin Set No Buffs
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Assassin --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = Cloak of Shadows
      • Set ItemSet_RegisterR_Item[2] = Silent Killer
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Assassin 2/2 (+30% attack speed)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)
  • Example2 Dragon Slayer Set No Buffs
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Dragon Slayer Set --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = |cffff0000Dragon's Heart|r
      • Set ItemSet_RegisterR_Item[2] = |cffff0000Flamestone Helmet|r
      • Set ItemSet_RegisterR_Item[3] = |cffff0000Gauntlet of the Dragon Slayer|r
      • Set ItemSet_RegisterR_Item[4] = |cffff0000Tablet of the Dragon Slayer|r
      • Set ItemSet_RegisterR_Item[5] = |cffff0000The Anvil of Broken Claws|r
      • Set ItemSet_RegisterR_Item[6] = |cffff0000The Dragon Eater|r
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Dragon Slayer 2/6 (+5 HP regeneration)
      • Set ItemSet_RegisterR_SetBonus[3] = Set: Dragon Slayer 3/6 (+5 armor)
      • Set ItemSet_RegisterR_SetBonus[4] = Set: Dragon Slayer 4/6 (+20 attack damage)
      • Set ItemSet_RegisterR_SetBonus[5] = Set: Dragon Slayer 5/6 (+500 HP)
      • Set ItemSet_RegisterR_SetBonus[6] = Set: Dragon Slayer 6/6 (+25 Strength)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)
  • Example3 Wizard Set No Buffs
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Wizard --------
      • -------- Required: --------
      • Set ItemSet_RegisterR_Item[1] = Staff of Power
      • Set ItemSet_RegisterR_Item[2] = Magic Talisman
      • Set ItemSet_RegisterR_Item[3] = Robe of the Magi
      • Set ItemSet_RegisterR_Item[4] = |cffff8c00Grimoire of Souls|r
      • Set ItemSet_RegisterR_SetBonus[2] = Set: Wizard 2/4 (+100% mana regeneration)
      • Set ItemSet_RegisterR_SetBonus[3] = Set: Wizard 3/4 (+120 mana)
      • Set ItemSet_RegisterR_SetBonus[4] = Set: Wizard 4/4 (+10 Intelligence)
      • Trigger - Run RegisterItemSet <gen> (ignoring conditions)
[/TRIGGER]



1. Use Slow Aura (Tornado) as the base ability. Set the Data - Movement Speed Factor to 0.00 and Stats - Targets Allowed to Invulnerable, Self, Vulnerable.

2. Create the buff to be used as indicator using the Tornado (Slow Aura) and change the Text - Tooltip - Extended to indicate the current level of the set.

3. Repeat depending on the number of items on the corresponding set, make one for each set level. You may end up with quite a lot of individual abilities and buffs depending on how many you use.

In the demo map, there are a total of 12 custom abilities and buffs (2 for the Assassin, 4 for the Wizard and 6 for the Dragon Slayer).

237546-albums8067-picture96242.png


237546-albums8067-picture96244.png


237546-albums8067-picture96243.png






  • RegisterItemSet
    • Events
    • Conditions
    • Actions
      • Custom script: local integer i = 0
      • Set ItemSet_System_Count = (ItemSet_System_Count + 1)
      • Custom script: loop
      • Custom script: set i = i + 1
      • Custom script: if (udg_ItemSet_RegisterR_Item[i] != 0) then
      • Custom script: call SaveBoolean(udg_ItemSet_System_Hashtable, udg_ItemSet_RegisterR_Item[i], 0, true)
      • Custom script: call SaveInteger(udg_ItemSet_System_Hashtable, udg_ItemSet_RegisterR_Item[i], 1, udg_ItemSet_System_Count)
      • Custom script: call SaveInteger(udg_ItemSet_System_Hashtable, udg_ItemSet_System_Count, i, udg_ItemSet_RegisterR_Item[i])
      • Custom script: call SaveInteger(udg_ItemSet_System_Hashtable, udg_ItemSet_System_Count, i + 6, udg_ItemSet_RegisterR_SetBonus[i])
      • Custom script: call SaveInteger(udg_ItemSet_System_Hashtable, udg_ItemSet_System_Count, i + 12, udg_ItemSet_RegisterO_BuffPlacer[i])
      • Custom script: call SaveInteger(udg_ItemSet_System_Hashtable, udg_ItemSet_System_Count, i + 18, udg_ItemSet_RegisterO_Buff[i])
      • Custom script: endif
      • Custom script: set udg_ItemSet_RegisterO_Buff[i] = 0
      • Custom script: set udg_ItemSet_RegisterO_BuffPlacer[i] = 0
      • Custom script: set udg_ItemSet_RegisterR_Item[i] = 0
      • Custom script: set udg_ItemSet_RegisterR_SetBonus[i] = 0
      • Custom script: exitwhen i > 6
      • Custom script: endloop


JASS:
function ItemSets takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local integer id = GetItemTypeId(GetManipulatedItem())
    local integer itemcount = 0
    local integer setlevel = 0
    local integer index = 0
    local integer sys_index = 0
    local integer array item_id
    local integer array buff_id
    local integer array buffp_id
    local integer array effect_id
    if (LoadBoolean(udg_ItemSet_System_Hashtable, id, 0) == true) then
        set sys_index = LoadInteger(udg_ItemSet_System_Hashtable, id, 1)
        loop
            exitwhen index > 6
            set item_id[index] = LoadInteger(udg_ItemSet_System_Hashtable, sys_index, index)
            set effect_id[index] = LoadInteger(udg_ItemSet_System_Hashtable, sys_index, index + 6)
            set buffp_id[index] = LoadInteger(udg_ItemSet_System_Hashtable, sys_index, index + 12)
            set buff_id[index] = LoadInteger(udg_ItemSet_System_Hashtable, sys_index, index + 18)
            if (item_id[index] != 0) and (UnitHasItemOfTypeBJ(u, item_id[index])) then
                set setlevel = setlevel + 1
            endif
            set index = index + 1
        endloop
        if (GetTriggerEventId() == EVENT_PLAYER_UNIT_DROP_ITEM) then
            set index = 0
            loop
                exitwhen index > 5
                if (GetItemTypeId(UnitItemInSlot(u, index)) == id) then
                    set itemcount = itemcount + 1
                endif
                set index = index + 1
            endloop
            if (itemcount - 1 == 0) then
                set setlevel = setlevel - 1
            endif
        endif
        set index = 0
        loop
            if (index <= setlevel) then
                if (GetUnitAbilityLevel(u, effect_id[index]) == 0) then
                    call UnitAddAbility(u, effect_id[index])
                    call UnitMakeAbilityPermanent(u, true, effect_id[index])
                    call SetPlayerAbilityAvailable(GetOwningPlayer(u), effect_id[index], false)
                endif
            else
                call UnitRemoveAbility(u, effect_id[index])
            endif
            if (index == setlevel) then
                call UnitAddAbility(u, buffp_id[index])
                call UnitMakeAbilityPermanent(u, true, buffp_id[index])
            else
                call UnitRemoveAbility(u, buff_id[index])
                call UnitRemoveAbility(u, buffp_id[index])
            endif
            set index = index + 1
            exitwhen index > 6
        endloop
    endif
    set u = null
    return false
endfunction

function InitTrig_ItemSetSystemGUIv2dot0 takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_PICKUP_ITEM)
    call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_DROP_ITEM)
    call TriggerAddCondition(trg, Condition(function ItemSets))
    set udg_ItemSet_System_Hashtable = InitHashtable()
    set trg = null
endfunction



1. The system will not recognize multiple instances of exactly the same type of item for increasing/decreasing the current set bonus level. They will be considered one and the same for determining the set level.

2. The system will check for items in a unit's inventory for any possible items belonging in the same set of the item they pick up or drop and configure the buffs and abilities/effects there. Moving an item around the inventory/arranging them doesn't do anything.

3. The system does assign a specific ability/effect to a specific item, so only the number of items will matter and will give the bonuses according to its set regardless of what items are present.


- Unfortunately, each item type can only be assigned to one set.
- Because of how only one ability can be registered per variable array, it literally limits the effects that can be given to the set per piece. One may use spellbooks to increase the amount. However, this is not advised because of how transformation abilities (Burrow, Chemical Rage, Destroyer Form, Metamorphosis or Stone Form based) removes these added abilities. The buff may persist for a few seconds, but the effects are immediately removed after transformation. If there won't be any using of any transformation abilities, then spellbooks may be used to accommodate the desired effect/s.


Pros
- Buff indicators update immediately without disappearing or another one reappearing while waiting for the previous one to expire
- Easy and foolproof setup

Cons
- Maybe redundant; too many systems of the same kind already present
- Creating the buff indicators may be a bother

Some Clarifications:
- the setup of a set may accept only one ability per set level, but it accepts spellbooks. Use it to add more abilities/effects unless there is a hero/unit that has a transformation (Burrow, Chemical Rage, Destroyer Form, Metamorphosis and Stone Form based) ability. Sure, the native function 'UnitMakeAbilityPermanent' may work on spellbooks and pass it on during transformations, but the same cannot be said for the abilities inside it.
- as for having a separate ability to apply each buff, a single ability with multiple levels would mess up and cause the buffs to persist or appear while another is active, defeating the purpose of having an instantaneous update of buffs

Submitter's Notes:
This is my first attempt to ever submit a resource here, so I may have made some mistakes. Please point out any bugs/errors and I'll try my best to correct them.

Updates

- improved code with hashtables (thanks to IcemanBo for the idea)


:grin::grin:

Keywords:
item, set, system, item set system, gui
Contents

ItemSetSystem (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. 14:41, 18th May 2015 IcemanBo: http://www.hiveworkshop.com/forums/spells-569/item-set-system-v-2-a-263987/index2.html#post2685515

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
This seems quite limiting, will check later. Good job on deciding to try on submitting it though, don't give up even if you don't succeed. =)

Thanks. Yes, it is limited, but only because of transformations. If there aren't any, the limit doesn't apply.

I never though about buffs to highlight the set bonuses.
I will add this to my ItemSet system, when I find the time :)
I solved your one item one set bonus problem with another type of data structure.

What kind of data structure? Is in in vJass? Can you please share it?
:csmile::csmile:
 
Thanks. Yes, it is limited, but only because of transformations. If there aren't any, the limit doesn't apply.
Well you do know you can make abilities permanent right? It's a JASS only function.
q.b said:
What kind of data structure? Is in in vJass? Can you please share it?
:csmile::csmile:

Yeah his is in VJass.
 

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
Well you do know you can make abilities permanent right? It's a JASS only function.

Of course, I do. I wrote it at the first part of Some Clarifications. The function 'UnitMakeAbilityPermanent' does work for spellbooks, but only for the spellbook. The abilities inside it do not become permanent even if the spellbook does, so even if the spellbook remains after transformation, it'll be empty because the abilities inside it are removed by the said transformation.
 
Of course, I do. I wrote it at the first part of Some Clarifications. The function 'UnitMakeAbilityPermanent' does work for spellbooks, but only for the spellbook. The abilities inside it do not become permanent even if the spellbook does, so even if the spellbook remains after transformation, it'll be empty because the abilities inside it are removed by the said transformation.

Then track them and then identify them when this happens then re-add them.
 

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
Then track them and then identify them when this happens then re-add them.

There would be no need to use spellbooks if it was that easy to simply just track and make them permanent. Besides, I don't think there's a way to identify the abilities inside a spellbook (not that I know of).

I even tried tracking the transformation itself, but it required the recording of every transformation spell to be used in a map and their respective transformation times.

I'm considering using hashtables to try an idea I have in mind, but I don't want to use them if I can avoid it.
 
There would be no need to use spellbooks if it was that easy to simply just track and make them permanent. Besides, I don't think there's a way to identify the abilities inside a spellbook (not that I know of).

I even tried tracking the transformation itself, but it required the recording of every transformation spell to be used in a map and their respective transformation times.

I'm considering using hashtables to try an idea I have in mind, but I don't want to use them if I can avoid it.

Why record custom spells when you can't have new order ID's in the first place? It's easy to track every single transformation spell, just use their orders instead of abilities. New/custom abilities still can't escape this, only channel can and it doesn't transform.

Also there really is no need to use spell-books. :grin:
 

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
Why record custom spells when you can't have new order ID's in the first place? It's easy to track every single transformation spell, just use their orders instead of abilities. New/custom abilities still can't escape this, only channel can and it doesn't transform.

Also there really is no need to use spell-books. :grin:

Detecting a transformation order/cast/end/effect didn't work. I just tried them all, actually. Abilities inside a permanent spellbook would still get removed even with 0.01 transformation time.
 
Hashtables are an easy alternative and they're not that slow, You don't know how to detect those orders then, not your fault though... Not many know how to. I didn't even know how too for a while until I decided to look into it.

Edit:
Detecting a transformation order/cast/end/effect didn't work. I just tried them all, actually. Abilities inside a permanent spellbook would still get removed even with 0.01 transformation time.

http://www.hiveworkshop.com/forums/spells-569/duff-1-0-1-a-264019/
 
Last edited:

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
Hashtables are an easy alternative and they're not that slow, You don't know how to detect those orders then, not your fault though... Not many know how to. I didn't even know how too for a while until I decided to look into it.

Edit:


http://www.hiveworkshop.com/forums/spells-569/duff-1-0-1-a-264019/

First, I'd like to say thank you for that because I finally found a way to pass abilities through transformations even without using 'UnitMakeAbilityPermanent.' It's a clever use of order events, but, unfortunately . . .

. . . it does not detect the reversal of a temporary transformation if the cooldown of the transformation ability is greater than its duration until an order is given to that unit. A manual order is needed to be issued for their current status to be detected.
 
q.b said:
. . . it does not detect the reversal of a temporary transformation if the cooldown of the transformation ability is greater than its duration until an order is given to that unit. A manual order is needed to be issued for their current status to be detected.

Could you explain a bit more? I would like to fix that bug if possible, but I don't know about it.
 

q.b

q.b

Level 3
Joined
Apr 21, 2014
Messages
21
Could you explain a bit more? I would like to fix that bug if possible, but I don't know about it.

You can actually see it for yourself by:

1. Having two units each with a transformation ability: one with cooldown set higher than its duration (+ transformation time, I'm not sure) and another one with cooldown set lower or equal to its duration.

2. Using your DUFF system to check the transformation, transform each unit one at a time, checking for the messages displayed by your system. The one with the cooldown <= duration will display the revert message while the other one will not display anything until you give an order to any unit.

I'm not sure how to explain it, but I think it's because, during the undoing of a temporary transformation, the transformation ability is actually cast (if it's on cooldown), so it is detected by events (cast, effect, finish, order). However, if it's not on cooldown, it will not be detected at all.

For your system to detect the reversal of the transformation with higher cooldown than its duration, an order (any) had to be given to any of the units present for the triggers to fire.
 
You can actually see it for yourself by:

1. Having two units each with a transformation ability: one with cooldown set higher than its duration (+ transformation time, I'm not sure) and another one with cooldown set lower or equal to its duration.

2. Using your DUFF system to check the transformation, transform each unit one at a time, checking for the messages displayed by your system. The one with the cooldown <= duration will display the revert message while the other one will not display anything until you give an order to any unit.

I'm not sure how to explain it, but I think it's because, during the undoing of a temporary transformation, the transformation ability is actually cast (if it's on cooldown), so it is detected by events (cast, effect, finish, order). However, if it's not on cooldown, it will not be detected at all.

For your system to detect the reversal of the transformation with higher cooldown than its duration, an order (any) had to be given to any of the units present for the triggers to fire.

That's actually something everyone shouldn't do, its a Blizzard bug. Recently discovered it in demonic rage by reyo which inspired my bankai spell.

It does eventually fix itself though I currently don't know how to fix it myself yet.
 
I recommend you to use a hastable and save boolean "true" to key "item type" of a registered item.
This will avoid unneeded looping in your core system to check if item is in a set or not.

Seems like there are some redundant operations.

We're used to use TriggerCondition over TriggerAction. It's slighly faster. :p

The system looks simple and might be useful. I like it.
 
Last edited:
Read my post above + ...

... with hastbales you not only remove the loop for item check, but you also could keep track of the number of items a unit currently has from a set.
This could again avoid an internal loop. :)

In case you won't keep track of the number of items of a set:
if .... and CountItemsOfSameType(u, GetItemTypeId(i)) - 1 == 0)
->
if .... and (c == 1)
 
Last edited:
  • Take more advantage of hashtable.
    Use hashtable to save the set_level for a unit.
    onDrop you decrease it, onPickUp you increase it.
    Then you don't need loops to know what ability to add/remove etc..
    As this is big part of the code implementation I value performance here.
  • itemcount - 1 == 0
    ->
    itemcount == 1
  • You cancel loop when index is higher than 6. Additionaly you can canel when itemType matches 0.
  • all SetPlayerAbilityAvailable(GetOwningPlayer(u), effect_id[index], false)
    ^Why?
  • (LoadBoolean(udg_ItemSet_System_Hashtable, id, 0) == true)
    ->
    LoadBoolean(udg_ItemSet_System_Hashtable, id, 0)
  • Nulling a static trigger is not necessarily needed, because it's never destroyed. (but I don't count this as mistake)
 
Top