Name | Type | is_array | initial_value |
ItemSet_RegisterO_Buff | buffcode | Yes | |
ItemSet_RegisterO_BuffPlacer | abilcode | Yes | |
ItemSet_RegisterR_Item | itemcode | Yes | |
ItemSet_RegisterR_SetBonus | abilcode | Yes | |
ItemSet_System_Count | integer | No | |
ItemSet_System_Hashtable | hashtable | No |
Item Set System - GUI v2.0
by q.b
* IMPLEMENTATION
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.
* HOW TO USE
1. Simply fill up the following variables with the values needed:
ItemSet_RegisterR_Item -> up to six item-types
ItemSet_RegisterR_SetBonus -> 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 -> up to six abilities that places the buff
ItemSet_RegisterO_Buff -> 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 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.
(?) Spellbooks can be used to apply more than one ability effect per set level. Simply fill in the set bonus variables
with the spellbook's ability id.
* MECHANICS
- The system will not recognize multiple instances of exactly the same type of item for determining the current set
bonus level. They will be considered one and the same for determining the set level.
* NOTES
- The buff fields in the registration of the set are not actually required. All that is needed for the set to function is to
register the items included in the set and their respective ability bonuses with respect to the number of set pieces they
need. If not using them, simply do not write anything on their variables.
* WARNING
- Spellbook Interactions with Transformation Abilities (any kind)
Unit transformations (like Burrow, Metamorphosis or Stone Form) will remove all of the set effects IF AND ONLY IF spellbooks
are used in the registration of the item set because of how transformation works. It can be instantly corrected by
simply dropping and picking up an item in a set.
For multiple sets in the same transformed unit, at least one item from each set must be dropped and picked up again
to fix them.
Ways around this problem were either too impractical and/or may simply make the system too complicated for casual use.
Although, 'UnitMakeAbilityPermanent' may indeed keep the spellbook from disappearing due to the transformation, it
won't do the same for all other abilities inside the said spellbook unless each and every ability inside the spellbook
is individually registered for the system to render as a permanent ability, but that would only make the implementation
and use of the system tedious.
* UPDATE
- v2.0
Updated: April 27, 2015
Uploaded:
- improved coding with the use of hashtables (thanks to Icemanbo for the idea)
- v1.0
March 24, 2015
- first release
Uploaded at: www.hiveworkshop.com
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