Hi,
I am trying to save values in a Hashtable and then load the values for repeatable use. I want to save a value (TempInteger3 and TempInteger6) in the hashtable keys (respectively Tempinteger2 and Tempinteger5). So at first tempint3 and 6 will be 0 and let the actions run as intended. If Q ability is chosen 1 time, tempinteger6 = 1 so it cannot be taken again. If a total of 3 abilities are chosen the condition for tempinteger3 is no longer met. But the values saved in the hashtable do not increase, they stay 0. This makes the trigger repeatable and endless. Why is int6 not saved as 1 and int3 saved as int3+1? I don't understand. I hope you can help me - am I using hashtables wrong? It's my first time using them.
The reason behind this I need each player to be able to choose up to 3 different abilities for each different unit type (and not multiple ones of the same ability type). So Player 1 Footman may pick Defend, Ability 2 and Ability 3 and then that's it. Player 2 Footman may pick 3 different abilities.
Values for reference if needed:
TFT_UpgradePlayerFactor = 1000
TFT_AbilityUpgradesTableIndex = 999
TFT_AbilitySelectionTableIndex = 998
Trigger:
I am trying to save values in a Hashtable and then load the values for repeatable use. I want to save a value (TempInteger3 and TempInteger6) in the hashtable keys (respectively Tempinteger2 and Tempinteger5). So at first tempint3 and 6 will be 0 and let the actions run as intended. If Q ability is chosen 1 time, tempinteger6 = 1 so it cannot be taken again. If a total of 3 abilities are chosen the condition for tempinteger3 is no longer met. But the values saved in the hashtable do not increase, they stay 0. This makes the trigger repeatable and endless. Why is int6 not saved as 1 and int3 saved as int3+1? I don't understand. I hope you can help me - am I using hashtables wrong? It's my first time using them.
The reason behind this I need each player to be able to choose up to 3 different abilities for each different unit type (and not multiple ones of the same ability type). So Player 1 Footman may pick Defend, Ability 2 and Ability 3 and then that's it. Player 2 Footman may pick 3 different abilities.
Values for reference if needed:
TFT_UpgradePlayerFactor = 1000
TFT_AbilityUpgradesTableIndex = 999
TFT_AbilitySelectionTableIndex = 998
Trigger:
-
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
-
-
-
-
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
-
-
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
-
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
-
Hashtable - Save 1 as TempInteger5 of TFT_AbilitySelectionTableIndex in TFT_UnitUpgradeTable.
-
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
-
Hashtable - Save (TempInteger3 + 1) as TempInteger2 of TFT_AbilityUpgradesTableIndex in TFT_UnitUpgradeTable.
-
Set VariableSet TFT_UpgradeDummyAbility = TempAbility
-
Trigger - Run TFT Apply Upgrade Check <gen> (checking conditions)
-
Trigger - Run TFT Add Ability to All of Unit Type <gen> (checking conditions)
-
-
-
-
-
-
Last edited: