Hi and thanks for taking your time to look at my post <3
My map will contain 50+ custom unit types, which each has 9 abilities (upgrades) to choose from (unique abilities). When a player chooses an upgrade for their given unit type, it will only apply to the specific players specific unit type (ex Footman for Player 1). When choosing the upgrade, all Footmen for player 1 will be added the specific ability (under conditions of max 3 total abilities and resource costs etc.) and future Footmen will have it as well for player 1 only when bought.
So far the upgrade system works, but some abilities are not added and when you buy a new unit, only the last bought ability is added and the new ones are not saved.
For this I have created (with help from chatgpt) a Hashtable system "TFT_UnitUpgradeTable" using this storing system using 999 and 998:
How many upgrades the players unit type has (max 3): Save ((Player number x 1000) + Custom value of Unit Type) of 999 in TFT_UnitUpgradeTable.
If the players unit type already has the upgrade 1=true, 0=not: ((Save Player number x 1000) + Custom value of Unit Type) of 998 in TFT_UnitUpgradeTable.
Does the players unit type has less than 3 (999) and not learned the specific ability (998) it is supposed to add the ability to add the ability.
999 is saved as variable TFT_AbilityUpgradesTableIndex.
998 is saved as variable TFT_AbilitySelectionTableIndex.
I will try to showcase my triggers here so far:
This trigger fires when Upgrade Ability on the Unit type is selected. It creates and targets a dummy unit with 9 abilities altered to the unit types abilities for selection.
Now you select the ability you want in the dummy unit menu, checking for the saved data in the hashtable. If it matches the conditions it will run TFT Apply Abilities in the second trigger below.
I split them up to be able to run Apply Abilities trigger for all units when chosen and for future units when entering the map.
The ability variables for dummy unit and for unit types are preset here:
This is for adding abilities when a unit enters the map:
I am having trouble with this because I think I have made a more detailed system than intended and I am not used to be working both MUI and hashtables...
I hope someone may be able to help me. I have attached the map. Thanks in advance!
My map will contain 50+ custom unit types, which each has 9 abilities (upgrades) to choose from (unique abilities). When a player chooses an upgrade for their given unit type, it will only apply to the specific players specific unit type (ex Footman for Player 1). When choosing the upgrade, all Footmen for player 1 will be added the specific ability (under conditions of max 3 total abilities and resource costs etc.) and future Footmen will have it as well for player 1 only when bought.
So far the upgrade system works, but some abilities are not added and when you buy a new unit, only the last bought ability is added and the new ones are not saved.
For this I have created (with help from chatgpt) a Hashtable system "TFT_UnitUpgradeTable" using this storing system using 999 and 998:
How many upgrades the players unit type has (max 3): Save ((Player number x 1000) + Custom value of Unit Type) of 999 in TFT_UnitUpgradeTable.
If the players unit type already has the upgrade 1=true, 0=not: ((Save Player number x 1000) + Custom value of Unit Type) of 998 in TFT_UnitUpgradeTable.
Does the players unit type has less than 3 (999) and not learned the specific ability (998) it is supposed to add the ability to add the ability.
999 is saved as variable TFT_AbilityUpgradesTableIndex.
998 is saved as variable TFT_AbilitySelectionTableIndex.
I will try to showcase my triggers here so far:
This trigger fires when Upgrade Ability on the Unit type is selected. It creates and targets a dummy unit with 9 abilities altered to the unit types abilities for selection.
-
TFT Upgrade Unit
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Upgrade
-
-
Actions
-
Set VariableSet TempUnit = (Triggering unit)
-
Set VariableSet TempUnitType = (Unit-type of TempUnit)
-
Set VariableSet TempPlayer = (Owner of TempUnit)
-
Set VariableSet TempInteger = (Player number of TempPlayer)
-
Set VariableSet TFT_UpgradeUnitType[TempInteger] = TempUnit
-
Unit - Remove TFT_UpgradeUnitArray[TempInteger] from the game
-
Set VariableSet TFT_UpgradeUnitArray[TempInteger] = No unit
-
Set VariableSet TempPoint = (Position of TempUnit)
-
Unit - Create 1 Upgrade Unit for TempPlayer at TempPoint facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_TempPoint)
-
Set VariableSet TFT_UpgradeUnitArray[TempInteger] = (Last created unit)
-
Selection - Select TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add Q to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add W to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add E to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add A to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add S to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add D to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add Z to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add X to TFT_UpgradeUnitArray[TempInteger]
-
Unit - Add C to TFT_UpgradeUnitArray[TempInteger]
-
-------- --------
-
-------- ADD INFO TO ABILITIES --------
-
-------- --------
-
-------- --------
-
-------- --------
-
Custom script: set udg_TFT_IntUnitValue = udg_TempUnitType
-
Set VariableSet Roll_Integer = 1
-
Set VariableSet Roll_Start = 1
-
Set VariableSet Roll_Max = 9
-
For each (Integer Roll_Integer) from Roll_Start to Roll_Max, do (Actions)
-
Loop - Actions
-
Set VariableSet TFT_IntAbilitySlot = Roll_Integer
-
Set VariableSet TFT_IntFieldType = 1
-
Set VariableSet TFT_IntKey = ((TFT_IntAbilitySlot x TFT_IntFactor) + TFT_IntFieldType)
-
Set VariableSet TempString = (Load TFT_IntKey of TFT_IntUnitValue from TFT_UnitUpgradeInfoTable.)
-
Ability - Set Icon of TFT_UpgradeDummyAbilities[TFT_IntAbilitySlot] to TempString
-
Set VariableSet TFT_IntFieldType = 2
-
Set VariableSet TFT_IntKey = ((TFT_IntAbilitySlot x TFT_IntFactor) + TFT_IntFieldType)
-
Set VariableSet TempString = (Load TFT_IntKey of TFT_IntUnitValue from TFT_UnitUpgradeInfoTable.)
-
Ability - Set Tooltip of TFT_UpgradeDummyAbilities[TFT_IntAbilitySlot] to TempString for level 0
-
Set VariableSet TFT_IntFieldType = 3
-
Set VariableSet TFT_IntKey = ((TFT_IntAbilitySlot x TFT_IntFactor) + TFT_IntFieldType)
-
Set VariableSet TempString = (Load TFT_IntKey of TFT_IntUnitValue from TFT_UnitUpgradeInfoTable.)
-
Ability - Set Extended Tooltip of TFT_UpgradeDummyAbilities[TFT_IntAbilitySlot] to TempString for level 0
-
-
-
-
-
TFT Upgrade Ability Chosen
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to Upgrade Unit
-
Or - Any (Conditions) are true
-
Conditions
-
(Ability being cast) Equal to Q
-
(Ability being cast) Equal to W
-
(Ability being cast) Equal to E
-
(Ability being cast) Equal to A
-
(Ability being cast) Equal to S
-
(Ability being cast) Equal to D
-
(Ability being cast) Equal to Z
-
(Ability being cast) Equal to X
-
(Ability being cast) Equal to C
-
-
-
-
Actions
-
Set VariableSet TempAbility = (Ability being cast)
-
Set VariableSet TempUnit = (Triggering unit)
-
Set VariableSet TempPlayer = (Owner of TempUnit)
-
Set VariableSet TempInteger = (Player number of TempPlayer)
-
Set VariableSet TempInteger1 = (Custom value of TFT_UpgradeUnitType[TempInteger])
-
Set VariableSet TempInteger2 = ((TempInteger x TFT_UpgradePlayerFactor) + TempInteger1)
-
Set VariableSet TempInteger3 = (Load TempInteger2 of TFT_AbilityUpgradesTableIndex from TFT_UnitUpgradeTable.)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to Q
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 1
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to W
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 2
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to E
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 3
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to A
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 4
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to S
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 5
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to D
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 6
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to Z
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 7
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to X
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 8
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempAbility Equal to C
-
-
Then - Actions
-
Set VariableSet TempInteger4 = 9
-
-
Else - Actions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Set VariableSet TempInteger5 = (TempInteger2 + TempInteger4)
-
Set VariableSet TempInteger6 = (Load TempInteger5 of TFT_AbilitySelectionTableIndex from TFT_UnitUpgradeTable.)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Tooltip of TempAbility for level 0) Equal to Unknown
-
-
Then - Actions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempInteger6 Greater than or equal to 1
-
-
Then - Actions
-
Player Group - Add TempPlayer to TempPlayerGroup
-
Game - Display to TempPlayerGroup the text: You have chosen thi...
-
Player Group - Remove all players from TempPlayerGroup.
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempInteger3 Greater than or equal to TFT_UpgradesMax[TempInteger]
-
-
Then - Actions
-
Player Group - Add TempPlayer to TempPlayerGroup
-
Game - Display to TempPlayerGroup the text: (You already have selected the maximum number of abilities for this unit type: ( + ((String(TFT_UpgradesMax[TempInteger])) + )))
-
Player Group - Remove all players from TempPlayerGroup.
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(TempPlayer Current gold) Less than TFT_UpgradeCost[TempInteger]
-
-
Then - Actions
-
Player Group - Add TempPlayer to TempPlayerGroup
-
Game - Display to TempPlayerGroup the text: (Insufficient gold ( + ((String(TFT_UpgradeCost[TempInteger])) + ).))
-
Player Group - Remove all players from TempPlayerGroup.
-
-
Else - Actions
-
Player - Set TempPlayer.Current gold to ((TempPlayer Current gold) - TFT_UpgradeCost[TempInteger])
-
Set VariableSet TempString = (Load ((TempInteger4 x TFT_IntFactor) + 2) of TempInteger1 from TFT_UnitUpgradeInfoTable.)
-
Player Group - Add TempPlayer to TempPlayerGroup
-
Game - Display to TempPlayerGroup the text: (You have learned |cffffcc00 + (TempString + |r for this unit type.))
-
Player Group - Remove all players from TempPlayerGroup.
-
Hashtable - Save (TempInteger3 + 1) as TempInteger2 of TFT_AbilityUpgradesTableIndex in TFT_UnitUpgradeTable.
-
Hashtable - Save 1 as TempInteger5 of TFT_AbilitySelectionTableIndex in TFT_UnitUpgradeTable.
-
Set VariableSet TFT_UnitAddAbility = TempUnit
-
Trigger - Run TFT Apply Abilities <gen> (checking conditions)
-
-
-
-
-
-
-
-
-
-
-
TFT Apply Abilities
-
Events
-
Conditions
-
Actions
-
Set VariableSet TFT_EnteringPlayer = (Owner of TFT_UnitAddAbility)
-
Set VariableSet TFT_EnteringIntegerPlayer = (Player number of TFT_EnteringPlayer)
-
Set VariableSet TFT_EnteringUnitCustomValue = (Custom value of TFT_UnitAddAbility)
-
Set VariableSet TFT_EnteringUnitTypePlayerID = ((TFT_EnteringIntegerPlayer x TFT_UpgradePlayerFactor) + TFT_EnteringUnitCustomValue)
-
Set VariableSet TFT_EnteringUnitTypeKey = ((TFT_EnteringIntegerPlayer x TFT_UpgradePlayerFactor) + TFT_EnteringUnitTypePlayerID)
-
Set VariableSet Roll_Integer = 1
-
Set VariableSet Roll_Max = 1
-
Set VariableSet Roll_Max = 9
-
For each (Integer Roll_Integer) from Roll_Start to Roll_Max, do (Actions)
-
Loop - Actions
-
Set VariableSet TFT_EnteringUnitTypeAbilityID = (Load (TFT_EnteringUnitTypeKey + Roll_Integer) of TFT_AbilitySelectionTableIndex from TFT_UnitUpgradeTable.)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TFT_EnteringUnitTypeAbilityID Equal to 1
-
-
Then - Actions
-
-------- FOOTMAN --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of TFT_UnitAddAbility) Equal to Footman
-
-
Then - Actions
-
Set VariableSet TempAbility = TFT_AbilityTypesFootman[Roll_Integer]
-
-
Else - Actions
-
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of TempAbility for TFT_UnitAddAbility) Greater than or equal to 1
-
-
Then - Actions
-
Else - Actions
-
Unit - Add TempAbility to TFT_UnitAddAbility
-
-
-
-
-
-
I split them up to be able to run Apply Abilities trigger for all units when chosen and for future units when entering the map.
The ability variables for dummy unit and for unit types are preset here:
-
TFT Upgrade Ability Index
-
Events
-
Conditions
-
Actions
-
Hashtable - Create a hashtable
-
Set VariableSet TFT_UnitUpgradeTable = (Last created hashtable)
-
Hashtable - Create a hashtable
-
Set VariableSet TFT_UnitUpgradeInfoTable = (Last created hashtable)
-
-------- ABILITY INFO --------
-
Set VariableSet TFT_UpgradeDummyAbilities[1] = Q
-
Set VariableSet TFT_UpgradeDummyAbilities[2] = W
-
Set VariableSet TFT_UpgradeDummyAbilities[3] = E
-
Set VariableSet TFT_UpgradeDummyAbilities[4] = A
-
Set VariableSet TFT_UpgradeDummyAbilities[5] = S
-
Set VariableSet TFT_UpgradeDummyAbilities[6] = D
-
Set VariableSet TFT_UpgradeDummyAbilities[7] = Z
-
Set VariableSet TFT_UpgradeDummyAbilities[8] = X
-
Set VariableSet TFT_UpgradeDummyAbilities[9] = C
-
Trigger - Run TFT Upgrade Ability Index Human <gen> (checking conditions)
-
-------- Footman --------
-
Set VariableSet TFT_AbilityTypesFootman[1] = Defend (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[2] = Taunt (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[3] = Enchanted (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[4] = Retaliate (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[5] = Bulwark (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[6] = Oathbound (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[7] = Outpost (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[8] = Shield Bash (Footman)
-
Set VariableSet TFT_AbilityTypesFootman[9] = To Arms! (Footman)
-
-
This is for adding abilities when a unit enters the map:
-
TFT Entering Units
-
Events
-
Unit - A unit enters (Entire map)
-
-
Conditions
-
((Triggering unit) is A structure) Not equal to True
-
((Triggering unit) is A Hero) Not equal to True
-
((Owner of (Triggering unit)) is in TFT_PlayerGroup.) Equal to True
-
And - All (Conditions) are true
-
Conditions
-
(Unit-type of (Triggering unit)) Not equal to Upgrade Unit
-
(Unit-type of (Triggering unit)) Not equal to Dummy (AbilityDummy)
-
(Unit-type of (Triggering unit)) Not equal to Dummy (Recast)
-
(Unit-type of (Triggering unit)) Not equal to To the Death!
-
-
-
-
Actions
-
Set VariableSet TFT_EnteringUnit = (Triggering unit)
-
Set VariableSet StatUnit = TFT_EnteringUnit
-
Custom script: set udg_TFT_EnteringInteger1 = GetUnitTypeId(udg_TFT_EnteringUnit)
-
Unit - Set the custom value of TFT_EnteringUnit to TFT_EnteringInteger1
-
Trigger - Run Calculate Unit Base Stats <gen> (ignoring conditions)
-
Set VariableSet TFT_UnitAddAbility = TFT_EnteringUnit
-
Trigger - Run TFT Apply Abilities <gen> (checking conditions)
-
Trigger - Run Calculate Unit Apply Stat Upgrades <gen> (ignoring conditions)
-
Trigger - Run Calculate Unit Stat Retriever <gen> (ignoring conditions)
-
Unit - Add Upgrade to TFT_EnteringUnit
-
-
I am having trouble with this because I think I have made a more detailed system than intended and I am not used to be working both MUI and hashtables...
I hope someone may be able to help me. I have attached the map. Thanks in advance!