- Joined
- Jun 24, 2024
- Messages
- 68
Hi again,
i am stuck on a problem for quite a while now and want to ask, where i am doing wrong / take a wrong turn.
Following trigger part creates an entry into a hashtable:
This is a working upgrade trigger, but it only works for Player 1
I do not know how to set up the If condition for the ability count check to fit player 2, it always goes into the else and throws the error:
"""
Am i mistaking the "(Integer A) of "2"" as a player number? What else could go wrong here?
Edit:
Here the full trigger of "Upgrade Ability player 2"
Yes, i make variables and triggers per player. I've tried countless times to unify it along with dialog boxes,
but those dialog boxes seem way to clunky for me to work with a unified/neutralized system.. Or i'm lacking exp.
Either way, maybe you find, what i missed to set up correctly here.
Thanks in advance
SMOrc
i am stuck on a problem for quite a while now and want to ask, where i am doing wrong / take a wrong turn.
Following trigger part creates an entry into a hashtable:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


temp_bol Equal to False
-
-

Then - Actions
-


Unit - Add temp_Abilities[(Integer B)] to (Hero manipulating item)
-


Hashtable - Save (Name of temp_Abilities[(Integer B)]) as (Integer B) of (Player number of (Owner of (Hero manipulating item))) in Hotkey_Htable.
-


Set VariableSet maxabilities_counter[(Player number of (Owner of (Hero manipulating item)))] = (maxabilities_counter[(Player number of (Owner of (Hero manipulating item)))] + 1)
-


Set VariableSet retraining_levelof_Ability[(Player number of (Owner of (Hero manipulating item)))] = 1
-


Set VariableSet retraining_Ability[(Player number of (Owner of (Hero manipulating item)))] = temp_Abilities[(Integer B)]
-


Set VariableSet retraining_item_type[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
-


Hashtable - Save temp_integr[(Integer B)] as (Integer B) of (Player number of (Owner of (Hero manipulating item))) in maxabilities.
-


Custom script: call AddAbility(GetTriggerPlayer(), bj_forLoopBIndex+1, udg_temp_Abilities[bj_forLoopBIndex])
-


Skip remaining actions
-
-

Else - Actions
-
This is a working upgrade trigger, but it only works for Player 1
-
Upgrade Ability
-

Events
-

Conditions
-

Actions
-


-------- Create Button --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




reward_chosenbutton_num Equal to 0
-
-



Then - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






maxabilities_counter[(Player number of Player 1 (Red))] Greater than 0
-
-





Then - Actions
-






Set VariableSet temp_num = 0
-






For each (Integer A) from 0 to 6, do (Actions)
-







Loop - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










(Level of Hotkey_Abilities[(Load (Integer A) of 1 from maxabilities.)] for NICKHeroArray[1]) Less than or equal to 9
-










(Level of Hotkey_Abilities[(Load (Integer A) of 1 from maxabilities.)] for NICKHeroArray[1]) Greater than 0
-
-









Then - Actions
-










Set VariableSet temp_Abilities_1[temp_num] = Hotkey_Abilities[(Load (Integer A) of 1 from maxabilities.)]
-










Set VariableSet temp_num = (temp_num + 1)
-
-









Else - Actions
-
-
-
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








temp_num Greater than 0
-
-







Then - Actions
-








Set VariableSet reward_list_randomnum[r_temp_num] = (Random integer number between 1 and 2)
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










reward_list_randomnum[r_temp_num] Equal to 1
-
-









Then - Actions
-










Set VariableSet chance = (Random integer number between 0 and (temp_num - 1))
-










Set VariableSet reward_list_randomnum[r_temp_num] = chance
-










Set VariableSet temp_Ability = temp_Abilities_1[chance]
-










Dialog - Create a dialog button for reward_dialog labelled (|cffffff00Upgrade + (Substring((Name of temp_Ability), 1, ((Length of (Name of temp_Ability)) - 2))))
-










Set VariableSet reward_dialog_button[r_temp_num] = (Last created dialog Button)
-
-









Else - Actions
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












reward_list_randomnum[r_temp_num] Equal to 2
-
-











Then - Actions
-












Dialog - Create a dialog button for reward_dialog labelled |cffffff00Upgrade A...
-












Set VariableSet reward_dialog_button[r_temp_num] = (Last created dialog Button)
-
-











Else - Actions
-
-
-
-
-







Else - Actions
-








Set VariableSet r_temp_num = (r_temp_num - 1)
-
-
-
-





Else - Actions
-






Set VariableSet r_temp_num = (r_temp_num - 1)
-
-
-
-



Else - Actions
-




-------- Click Button --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






reward_list_randomnum[reward_chosenbutton_num] Equal to 1
-
-





Then - Actions
-






Set VariableSet temp_Ability = Hotkey_Abilities[(Load reward_list_randomnum[reward_chosenbutton_num] of (Player number of Player 1 (Red)) from maxabilities.)]
-






Unit - Increase level of temp_Ability for NICKHeroArray[(Player number of Player 1 (Red))]
-
-





Else - Actions
-
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






reward_list_randomnum[reward_chosenbutton_num] Equal to 2
-
-





Then - Actions
-






For each (Integer A) from 0 to 6, do (Actions)
-







Loop - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










(Level of Hotkey_Abilities[(Load (Integer A) of 1 from maxabilities.)] for NICKHeroArray[1]) Less than or equal to 9
-










(Level of Hotkey_Abilities[(Load (Integer A) of 1 from maxabilities.)] for NICKHeroArray[1]) Greater than 0
-
-









Then - Actions
-










Set VariableSet temp_Ability = Hotkey_Abilities[(Load (Integer A) of (Player number of Player 1 (Red)) from maxabilities.)]
-










Unit - Increase level of temp_Ability for NICKHeroArray[(Player number of Player 1 (Red))]
-
-









Else - Actions
-
-
-
-
-





Else - Actions
-
-
-
-
-
I do not know how to set up the If condition for the ability count check to fit player 2, it always goes into the else and throws the error:
"""
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Less than or equal to 9
-


(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Greater than 0
-
-

Then - Actions
-


Set VariableSet temp_Abilities_2[r_temp_num_2] = Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)]
-


Set VariableSet temp_num_2 = (temp_num_2 + 1)
-
-

Else - Actions
-


Game - Display to (All players) the text: ERROR creating Butt...
-
-
Am i mistaking the "(Integer A) of "2"" as a player number? What else could go wrong here?
Edit:
Here the full trigger of "Upgrade Ability player 2"
Yes, i make variables and triggers per player. I've tried countless times to unify it along with dialog boxes,
but those dialog boxes seem way to clunky for me to work with a unified/neutralized system.. Or i'm lacking exp.
Either way, maybe you find, what i missed to set up correctly here.
-
Upgrade Ability 2
-

Events
-

Conditions
-

Actions
-


-------- Create Button --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




reward_chosenbutton_num_2 Equal to 0
-
-



Then - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






maxabilities_counter[(Player number of Player 2 (Blue))] Greater than 0
-
-





Then - Actions
-






Set VariableSet temp_num_2 = 0
-






For each (Integer A) from 0 to 6, do (Actions)
-







Loop - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Less than or equal to 9
-










(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Greater than 0
-
-









Then - Actions
-










Set VariableSet temp_Abilities_2[r_temp_num_2] = Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)]
-










Set VariableSet temp_num_2 = (temp_num_2 + 1)
-
-









Else - Actions
-










Game - Display to (All players) the text: ERROR creating Butt...
-
-
-
-
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








temp_num_2 Greater than 0
-
-







Then - Actions
-








Set VariableSet reward_list_randomnum_2[r_temp_num_2] = (Random integer number between 1 and 2)
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










reward_list_randomnum_2[r_temp_num_2] Equal to 1
-
-









Then - Actions
-










Set VariableSet chance_2 = (Random integer number between 0 and (temp_num_2 - 1))
-










Set VariableSet reward_list_randomnum_2[r_temp_num_2] = chance_2
-










Set VariableSet temp_Ability_2 = temp_Abilities_2[chance_2]
-










Dialog - Create a dialog button for reward_dialog_2 labelled (|cffffff00Upgrade + (Substring((Name of temp_Ability_2), 2, ((Length of (Name of temp_Ability_2)) - 2))))
-










Set VariableSet reward_dialog_button_2[r_temp_num_2] = (Last created dialog Button)
-
-









Else - Actions
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












reward_list_randomnum_2[temp_int_2] Equal to 2
-
-











Then - Actions
-












Dialog - Create a dialog button for reward_dialog_2 labelled |cffffff00Upgrade A...
-












Set VariableSet reward_dialog_button_2[r_temp_num_2] = (Last created dialog Button)
-
-











Else - Actions
-












Game - Display to (All players) the text: ERROR creating Butt...
-
-
-
-
-
-







Else - Actions
-








Set VariableSet r_temp_num_2 = (r_temp_num_2 - 1)
-
-
-
-





Else - Actions
-






Set VariableSet r_temp_num_2 = (r_temp_num_2 - 1)
-
-
-
-



Else - Actions
-




-------- Click Button --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






reward_list_randomnum_2[reward_chosenbutton_num_2] Equal to 1
-
-





Then - Actions
-






Set VariableSet temp_Ability_2 = Hotkey_Abilities[(Load reward_list_randomnum_2[reward_chosenbutton_num_2] of (Player number of Player 2 (Blue)) from maxabilities.)]
-






Unit - Increase level of temp_Ability_2 for NICKHeroArray[(Player number of Player 2 (Blue))]
-
-





Else - Actions
-






Game - Display to (All players) the text: ERROR on Button Pre...
-
-
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






reward_list_randomnum_2[reward_chosenbutton_num_2] Equal to 2
-
-





Then - Actions
-






For each (Integer A) from 0 to 6, do (Actions)
-







Loop - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Less than or equal to 9
-










(Level of Hotkey_Abilities[(Load (Integer A) of 2 from maxabilities.)] for NICKHeroArray[2]) Greater than 0
-
-









Then - Actions
-










Set VariableSet temp_Ability_2 = Hotkey_Abilities[(Load (Integer A) of (Player number of Player 2 (Blue)) from maxabilities.)]
-










Unit - Increase level of temp_Ability_2 for NICKHeroArray[(Player number of Player 2 (Blue))]
-
-









Else - Actions
-










Game - Display to (All players) the text: ERROR on Button Pre...
-
-
-
-
-
-





Else - Actions
-






Game - Display to (All players) the text: ERROR in Button Pre...
-
-
-
-
-
-
Thanks in advance
SMOrc
Last edited: