- Joined
- Aug 5, 2010
- Messages
- 147
I have a map where i want each wave to be able to have up to 3 modfiers, however across all the ways ive tried to prevent duplicates and other issues i have thus far been unsuccessful and my brain is pretty scrambled from attempting to fix it myself so ive come to ask for some much needed help.
Here is an example of my issue from a test map
As you can see multiple waves have duplicate modifiers, this is what i am/was trying to prevent.
Here is the trigger from the test map that i will attach, this trigger does not have any of the various ways ive tried dealing with the problem, ive cleaned the trigger up as best i can and added comments in an attempt to further clarify what i am attempting to do with each action.
Just to note the test map uses JASS scripting, the actual map uses LUA, if anyone would like to see the actual map i will attach at request.
Here is an example of my issue from a test map
Here is the trigger from the test map that i will attach, this trigger does not have any of the various ways ive tried dealing with the problem, ive cleaned the trigger up as best i can and added comments in an attempt to further clarify what i am attempting to do with each action.
-
ini
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
-------- Abbreviated strings for each modifier, in the actual map the strings are used on a multiboard to show the modifiers of the current wave and next wave. --------
-
Set VariableSet String_Array_Mods[0] = |cffc0c0c0[None
-
Set VariableSet String_Array_Mods[1] = |cffffff00[Com
-
Set VariableSet String_Array_Mods[2] = |cff00ff00[Eth
-
Set VariableSet String_Array_Mods[3] = |cff3232ff[Shi
-
Set VariableSet String_Array_Mods[4] = |cff808080[Arm
-
Set VariableSet String_Array_Mods[5] = |cffff0000[Fst
-
Set VariableSet String_Array_Mods[6] = |cff80ff80[Rgn
-
Set VariableSet String_Array_Mods[7] = |cff00ffff[Eva
-
Set VariableSet String_Array_Mods[8] = |cffd45e19[Spl
-
-------- Used again on the muiltiboard in the actual map to indicate the level a modifier will be. --------
-
Set VariableSet String_Array_ModLevel[1] = ]|r
-
Set VariableSet String_Array_ModLevel[2] = +]|r
-
Set VariableSet String_Array_ModLevel[3] = ++]|r
-
-------- Waves 1 to 10 wont spawn with modifiers so i start the loop at 11. --------
-
For each (Integer A) from 0 to 10, do (Actions)
-
Loop - Actions
-
Set VariableSet String_Array_Modifiers[(Integer A)] = |cffc0c0c0[None]
-
-
-
For each (Integer A) from 11 to 80, do (Actions)
-
Loop - Actions
-
-------- Mod 1 --------
-
Set VariableSet Integer_Array_ModChance1[(Integer A)] = (Random integer number between 1 and 1000)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer_Array_ModChance1[(Integer A)] Less than or equal to (Integer_ModifierChance + (Integer A))
-
-
Then - Actions
-
-------- ModifierChance is 150 in the actual map, in the test map its set to 500 to so the strings will fill up. I add Int A to ModifierChance so the chance increases over the course of the game. --------
-
Set VariableSet Integer_ModType = (Random integer number between 1 and Integer_TotalModNumber)
-
-------- Int_ModType is saved to ModType1 so i can use it to generate strings but also to use it in the trigger that gives each unit of a wave the actual modifier, that trigger is needed in this test map so i didnt include it. --------
-
Set VariableSet Integer_Array_ModType1[(Integer A)] = Integer_ModType
-
Set VariableSet Integer_Array_ModLevel1[(Integer A)] = (Random integer number between 1 and 3)
-
-------- I dont really need to have this string start with String_Array_Modifier here in the Mod 1 section, either way its an empty string. --------
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType1[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel1[(Integer A)]]))
-
-
Else - Actions
-
-------- This is for debugging purposes, makes it easier to see exactly where each string/int was generated from, in the actual map these would be disabled. --------
-
Set VariableSet Integer_Array_ModType1[(Integer A)] = 0
-
Set VariableSet Integer_Array_ModLevel1[(Integer A)] = 1
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType1[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel1[(Integer A)]]))
-
-
-
-------- This is where i struggle, in another version of this trigger i was able to prevent mod 2 from generating a duplicate modifier by using the duplicate to level up the Mod1 modifier if they were the same. --------
-
-------- However in that system mod 3 was supposed to be able to level up either mod 1 or 2, and i couldnt figure out how to resolve the miriad of issues that would occur in that system --------
-
-------- so ive settled on simple setting the level of a modifier to a random level, however the duplicate issue still remains unresolved.. --------
-
-------- Mod 2 --------
-
Set VariableSet Integer_Array_ModChance2[(Integer A)] = (Random integer number between 1 and 1000)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer_Array_ModChance2[(Integer A)] Less than or equal to (Integer_ModifierChance + (Integer A))
-
-
Then - Actions
-
Set VariableSet Integer_ModType = (Random integer number between 1 and Integer_TotalModNumber)
-
Set VariableSet Integer_Array_ModType2[(Integer A)] = Integer_ModType
-
Set VariableSet Integer_Array_ModLevel2[(Integer A)] = (Random integer number between 1 and 3)
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType2[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel2[(Integer A)]]))
-
-
Else - Actions
-
Set VariableSet Integer_Array_ModType2[(Integer A)] = 0
-
Set VariableSet Integer_Array_ModLevel2[(Integer A)] = 1
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType2[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel2[(Integer A)]]))
-
-
-
-------- Mod 3 --------
-
Set VariableSet Integer_Array_ModChance3[(Integer A)] = (Random integer number between 1 and 1000)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer_Array_ModChance3[(Integer A)] Less than or equal to (Integer_ModifierChance + (Integer A))
-
-
Then - Actions
-
Set VariableSet Integer_ModType = (Random integer number between 1 and Integer_TotalModNumber)
-
Set VariableSet Integer_Array_ModType3[(Integer A)] = Integer_ModType
-
Set VariableSet Integer_Array_ModLevel3[(Integer A)] = (Random integer number between 1 and 3)
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType3[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel3[(Integer A)]]))
-
-
Else - Actions
-
Set VariableSet Integer_Array_ModType3[(Integer A)] = 0
-
Set VariableSet Integer_Array_ModLevel3[(Integer A)] = 1
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (String_Array_Modifiers[(Integer A)] + (String_Array_Mods[Integer_Array_ModType3[(Integer A)]] + String_Array_ModLevel[Integer_Array_ModLevel3[(Integer A)]]))
-
-
-
-------- If no modifier are chosen then the string for intA will be set to [None] --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer_Array_ModChance1[(Integer A)] Greater than (Integer_ModifierChance + (Integer A))
-
Integer_Array_ModChance2[(Integer A)] Greater than (Integer_ModifierChance + (Integer A))
-
Integer_Array_ModChance3[(Integer A)] Greater than (Integer_ModifierChance + (Integer A))
-
-
Then - Actions
-
Set VariableSet String_Array_Modifiers[(Integer A)] = (<Empty String> + (String_Array_Mods[0] + String_Array_ModLevel[1]))
-
-
Else - Actions
-
-
-
-
-