[Trigger] Trigger Not Retrieving From Hashtables Correctly

Status
Not open for further replies.
Level 4
Joined
Nov 3, 2015
Messages
46
In this game, the modes and maps are selected and then the map is generated. The generation works fine, everything is placed within the region I want them to be placed in. One of the few destructibles that are placed down are "Rock Chunks", and the majority of the early game will be running around and "Surveying" these rocks for minerals. Currently, there are FIVE possible minerals and only THREE of them are assigned to each rock. The problem I'm having is that when a unit surveys a rock, all minerals are displayed (as auto-timed game text) as ZERO. I believe either I set up the data inside the hashtable wrong, or I'm not displaying it correctly.

Setting up the hashtable:
  • RockChunksHashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set RockChunksTable = (Last created hashtable)

Init. mineral rolling "slots":
  • InitRandomMineral
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomMineral = 0
      • Set RandomMineralArray[0] = 0
      • Set RandomMineralArray[1] = 0
      • Set RandomMineralArray[2] = 0

Init. mineral ID keys:
  • InitMineralIDKeys
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MineralKeyCopper = 0
      • Set MineralKeyGold = 1
      • Set MineralKeyIron = 2
      • Set MineralKeySilver = 3
      • Set MineralKeyTin = 4

The map choice and generation:
  • Map Choice Forest Test
    • Events
      • Dialog - A dialog button is clicked for MapDialog
    • Conditions
      • (Clicked dialog button) Equal to MapDialogButton[1]
    • Actions
      • Custom script: call DialogDestroy(udg_MapDialog)
      • Game - Display to (All players) the text: |c00FF00FF[SYSTEM]|...
      • For each (Integer A) from 1 to 500, do (Actions)
        • Loop - Actions
          • Destructible - Create a Rock Chunks at (Random point in 1PLAYSCAPE <gen>) facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6)
      • -------- MINERAL SELECTION --------
      • Destructible - Pick every destructible in 1PLAYSCAPE <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to Rock Chunks
            • Then - Actions
              • For each (Integer A) from 1 to 500, do (Actions)
                • Loop - Actions
                  • -------- MINERAL ROLLING --------
                  • Custom script: call ExecuteFunc("MineralRoll")
            • Else - Actions

RNG for minerals in rocks:
  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Set RandomMineralArray[(Integer B)] = RandomMineral
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomMineralArray[(Integer B)] Equal to 0
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomMineralArray[(Integer B)] Equal to 1
                • Then - Actions
                  • Set AmountCopper[(Integer A)] = (Random integer number between 10 and 25)
                  • Hashtable - Save AmountCopper[(Integer A)] as MineralKeyCopper of (Key (Picked destructible)) in RockChunksTable
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RandomMineralArray[(Integer B)] Equal to 2
                    • Then - Actions
                      • Set AmountGold[(Integer A)] = (Random integer number between 5 and 15)
                      • Hashtable - Save (Integer A) as MineralKeyGold of (Key (Picked destructible)) in RockChunksTable
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RandomMineralArray[(Integer B)] Equal to 3
                        • Then - Actions
                          • Set AmountIron[(Integer A)] = (Random integer number between 35 and 50)
                          • Hashtable - Save AmountIron[(Integer A)] as MineralKeyIron of (Key (Picked destructible)) in RockChunksTable
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • RandomMineralArray[(Integer B)] Equal to 4
                            • Then - Actions
                              • Set AmountSilver[(Integer A)] = (Random integer number between 10 and 20)
                              • Hashtable - Save AmountSilver[(Integer A)] as MineralKeySilver of (Key (Picked destructible)) in RockChunksTable
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • RandomMineralArray[(Integer B)] Equal to 5
                                • Then - Actions
                                  • Set AmountTin[(Integer A)] = (Random integer number between 15 and 75)
                                  • Hashtable - Save AmountTin[(Integer A)] as MineralKeyTin of (Key (Picked destructible)) in RockChunksTable
                                • Else - Actions

When a rock is surveyed:
  • MineralSurvey
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Survey Rocks
    • Actions
      • Set PlayerTemp = (Player number of (Owner of (Casting unit)))
      • Player Group - Add (Player(PlayerTemp)) to PlayerTempGroup
      • Game - Display to PlayerTempGroup the text: (Copper = + (String((Key (Load AmountCopper[(Key (Target destructible of ability being cast))] of MineralKeyCopper in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Gold = + (String((Key (Load AmountGold[(Key (Target destructible of ability being cast))] of MineralKeyGold in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Iron = + (String((Key (Load AmountIron[(Key (Target destructible of ability being cast))] of MineralKeyIron in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Silver = + (String((Key (Load AmountSilver[(Key (Target destructible of ability being cast))] of MineralKeySilver in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Tin = + (String((Key (Load AmountTin[(Key (Target destructible of ability being cast))] of MineralKeyTin in RockChunksTable)))))
      • Player Group - Remove (Player(PlayerTemp)) from PlayerTempGroup

Sorry if seeing this makes your eyes hurt, so please bear with me because I'm only just dabbling in using hashtables.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You didn't give the right name to ExecuteFunc(). It needs the full trigger name of the actions you want to run, in this case: call ExecuteFunc("Trig_MineralRoll_Actions"). With the wrong name you'll cause either a thread crash or a map crash, and either way nothing will run. Now, (Picked Destructible) probably doesn't work when the function is run through ExecuteFunc; most event responses don't. If it doesn't then you're saving everything under Key(Picked Destr.) = Key(null) = 0 which prevents it from being recalled later.

If it's not that you probably have too many things running on the "map initialization" event, which can cause a thread crash. If the thread crashes before the RockChunksHashtable trigger runs then the hashtable won't be set up and all values will return 0. You can check this by trying to load and display a value you just saved in the hashtable right after saving it.

Other thoughts:
  • Random Point in... leaks a point, so that's 500 leaked points in your Integer A loop.
  • Why are you creating 500 rocks, then picking all rocks in the region only to do stuff only to the rock chunks you find? Intuitively it's so you don't hit the OP limit doing the mineral allocation, but
    1. You're not gonna hit the op limit with a 500 (int A) * 3 (int B) * 5 (if statement trees) loop
    2. You're already using ExecuteFunc() to spawn a new thread for each destructible anyway!
  • For each (Integer A) from 1 to 500, do (Actions)
    • Loop - Actions
      • Set TempPoint = Random point in 1PLAYSCAPE <gen>
      • Destructible - Create a Rock Chunks at TempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set MINERAL_KEY = (Key(Last created destructible)) //precompute this because GUI won't let you do Key(SOME_VARIABLE)... :| why blizzard
      • Custom script: call ExecuteFunc("Trig_MineralRoll_Actions")
  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Set RandomMineralArray[(Integer B)] = RandomMineral
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomMineralArray[(Integer B)] Equal to 0
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomMineralArray[(Integer B)] Equal to 1
                • Then - Actions
                  • Set AmountCopper[(Integer A)] = (Random integer number between 10 and 25)
                  • Hashtable - Save AmountCopper[(Integer A)] as MineralKeyCopper of MINERAL_KEY in RockChunksTable
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RandomMineralArray[(Integer B)] Equal to 2
                    • Then - Actions
                      • Set AmountGold[(Integer A)] = (Random integer number between 5 and 15)
                      • Hashtable - Save (Integer A) as MineralKeyGold of MINERAL_KEY in RockChunksTable
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RandomMineralArray[(Integer B)] Equal to 3
                        • Then - Actions
                          • Set AmountIron[(Integer A)] = (Random integer number between 35 and 50)
                          • Hashtable - Save AmountIron[(Integer A)] as MineralKeyIron of MINERAL_KEY in RockChunksTable
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • RandomMineralArray[(Integer B)] Equal to 4
                            • Then - Actions
                              • Set AmountSilver[(Integer A)] = (Random integer number between 10 and 20)
                              • Hashtable - Save AmountSilver[(Integer A)] as MineralKeySilver of MINERAL_KEY in RockChunksTable
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • RandomMineralArray[(Integer B)] Equal to 5
                                • Then - Actions
                                  • Set AmountTin[(Integer A)] = (Random integer number between 15 and 75)
                                  • Hashtable - Save AmountTin[(Integer A)] as MineralKeyTin of MINERAL_KEY in RockChunksTable
                                • Else - Actions
 
  • Try changing the event to "A Unit Starts the Effect" instead of "A unit finishs casting", example read more Respond to "A unit Finishes casting an ability"
  • RandomMineral should probably go from 0-4, not 0-5
  • RandomMineral uses Integer from Loop 1-3, whereas you probably need 0-2
By the way, is there a reason to use ExecuteFunc instead of Running the trigger directly?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Try changing the event to "A Unit Starts the Effect" instead of "A unit finishs casting", example read more Respond to "A unit Finishes casting an ability"
My understanding from this KILLCIDE post is that:
(Target unit of ability being cast) with the "Unit Finishes casting" event returns null.
...so perhaps the targeted destructible version of that event response doesn't work on finishes casting either.
By the way, is there a reason to use ExecuteFunc instead of Running the trigger directly?
Op limit, but in this case I don't think they will hit it.
 
Level 4
Joined
Nov 3, 2015
Messages
46
You didn't give the right name to ExecuteFunc(). It needs the full trigger name of the actions you want to run, in this case: call ExecuteFunc("Trig_MineralRoll_Actions"). With the wrong name you'll cause either a thread crash or a map crash, and either way nothing will run. Now, (Picked Destructible) probably doesn't work when the function is run through ExecuteFunc; most event responses don't. If it doesn't then you're saving everything under Key(Picked Destr.) = Key(null) = 0 which prevents it from being recalled later.

If it's not that you probably have too many things running on the "map initialization" event, which can cause a thread crash. If the thread crashes before the RockChunksHashtable trigger runs then the hashtable won't be set up and all values will return 0. You can check this by trying to load and display a value you just saved in the hashtable right after saving it.

Other thoughts:
  • Random Point in... leaks a point, so that's 500 leaked points in your Integer A loop.
  • Why are you creating 500 rocks, then picking all rocks in the region only to do stuff only to the rock chunks you find? Intuitively it's so you don't hit the OP limit doing the mineral allocation, but
    1. You're not gonna hit the op limit with a 500 (int A) * 3 (int B) * 5 (if statement trees) loop
    2. You're already using ExecuteFunc() to spawn a new thread for each destructible anyway!
  • For each (Integer A) from 1 to 500, do (Actions)
    • Loop - Actions
      • Set TempPoint = Random point in 1PLAYSCAPE <gen>
      • Destructible - Create a Rock Chunks at TempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set MINERAL_KEY = (Key(Last created destructible)) //precompute this because GUI won't let you do Key(SOME_VARIABLE)... :| why blizzard
      • Custom script: call ExecuteFunc("Trig_MineralRoll_Actions")
  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Set RandomMineralArray[(Integer B)] = RandomMineral
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomMineralArray[(Integer B)] Equal to 0
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomMineralArray[(Integer B)] Equal to 1
                • Then - Actions
                  • Set AmountCopper[(Integer A)] = (Random integer number between 10 and 25)
                  • Hashtable - Save AmountCopper[(Integer A)] as MineralKeyCopper of MINERAL_KEY in RockChunksTable
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RandomMineralArray[(Integer B)] Equal to 2
                    • Then - Actions
                      • Set AmountGold[(Integer A)] = (Random integer number between 5 and 15)
                      • Hashtable - Save (Integer A) as MineralKeyGold of MINERAL_KEY in RockChunksTable
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RandomMineralArray[(Integer B)] Equal to 3
                        • Then - Actions
                          • Set AmountIron[(Integer A)] = (Random integer number between 35 and 50)
                          • Hashtable - Save AmountIron[(Integer A)] as MineralKeyIron of MINERAL_KEY in RockChunksTable
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • RandomMineralArray[(Integer B)] Equal to 4
                            • Then - Actions
                              • Set AmountSilver[(Integer A)] = (Random integer number between 10 and 20)
                              • Hashtable - Save AmountSilver[(Integer A)] as MineralKeySilver of MINERAL_KEY in RockChunksTable
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • RandomMineralArray[(Integer B)] Equal to 5
                                • Then - Actions
                                  • Set AmountTin[(Integer A)] = (Random integer number between 15 and 75)
                                  • Hashtable - Save AmountTin[(Integer A)] as MineralKeyTin of MINERAL_KEY in RockChunksTable
                                • Else - Actions

I've applied all of your changes! This is also some useful information, so thank you.

  • Try changing the event to "A Unit Starts the Effect" instead of "A unit finishs casting", example read more Respond to "A unit Finishes casting an ability"
  • RandomMineral should probably go from 0-4, not 0-5
  • RandomMineral uses Integer from Loop 1-3, whereas you probably need 0-2
By the way, is there a reason to use ExecuteFunc instead of Running the trigger directly?

1. All minerals still return 0.
2. Why go 0-4 when there are six possiblities: Dud, Copper, Gold, Iron, Silver, Tin
3. Done, thank you! I forgot to do that

-------
Anyway, nothing is still working as planned. I've added waits and messages between most of the rolling actions to keep track of what's happening and...

- The mineral rolling is done all at once (the 0-5 roll) except for two rolls
- The only mineral being applied is iron (the #3 mineral) except for two applied minerals
- The last two rolls were 2 and 5, but gold (the #2 mineral) is applied both times

:confused:
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Anyway, nothing is still working as planned. I've added waits and messages between most of the rolling actions to keep track of what's happening and...

- The mineral rolling is done all at once (the 0-5 roll) except for two rolls
- The only mineral being applied is iron (the #3 mineral) except for two applied minerals
- The last two rolls were 2 and 5, but gold (the #2 mineral) is applied both times
This is not helpful if you don't post the updated trigger.
If it's not that you probably have too many things running on the "map initialization" event, which can cause a thread crash. If the thread crashes before the RockChunksHashtable trigger runs then the hashtable won't be set up and all values will return 0.
I didn't give an explanation before but you need to use an "elapsed game time" event. Did you do this?
You can check this by trying to load and display a value you just saved in the hashtable right after saving it.
Did you try this?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Looking over it more I don't understand why you're assigning things in arrays with [(Integer A)] as an index before saving them in the hashtable. Why not just save directly? There's also no need to nest your if-statements, you can put them all in parallel.

  • For each (Integer B) from 0 to 2 do (Actions)
    • Loop - Actions
      • Set RandomMineral = Random integer between 0 and 5
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 0
        • Then - Actions
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 1
        • Then - Actions
          • Hashtable - Save (Random integer between 10 and 25) as MineralKeyCopper of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 2
        • Then - Actions
          • Hashtable - Save (Random integer between 5 and 15) as MineralKeyGold of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 3
        • Then - Actions
          • Hashtable - Save (Random integer between 30 and 50) as MineralKeyIron of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 4
        • Then - Actions
          • Hashtable - Save (Random integer between 10 and 20) as MineralKeySilver of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 5
        • Then - Actions
          • Hashtable - Save (Random integer between 15 and 75) as MineralKeyTin of MINERAL_KEY in RockChunksTable
        • Else - Actions
For that matter you could use some arrays to simplify this process even more. Here you just load (0, MINERAL_KEY) for # duds (always 0), (1, MINERAL_KEY) for #golds, (2, MINERAL_KEY) for # coppers, etc and you actually don't even need to run this via executefunc.
  • -------- in a setup trigger: --------
  • -------- duds --------
  • Set MineralMin[0] = 0
  • Set MineralMax[0] = 0
  • -------- copper --------
  • Set MineralMin[1] = 10
  • Set MineralMax[1] = 25
  • -------- gold --------
  • Set MineralMin[2] = 5
  • Set MineralMax[2] = 15
  • -------- iron --------
  • Set MineralMin[3] = 30
  • Set MineralMax[3] = 50
  • -------- silver --------
  • Set MineralMin[4] = 10
  • Set MineralMax[4] = 20
  • -------- tin --------
  • Set MineralMin[5] = 15
  • Set MineralMax[5] = 75
  • -------- --------
  • -------- in your mineral setup trigger: --------
  • For each (Integer B) from 0 to 2 do (Actions)
    • Set RandomMineral = Random integer between 0 and 5
    • Hashtable - Save (Random integer between MineralMin[RandomMineral] and MineralMax[RandomMineral]) as RandomMineral of MINERAL_KEY in RockChunksTable
 
Level 4
Joined
Nov 3, 2015
Messages
46
This is not helpful if you don't post the updated trigger.

I didn't give an explanation before but you need to use an "elapsed game time" event. Did you do this?

Did you try this?
Sorry; I did use the elapsed game time event (0.02 seconds), that's what I usually use, but I've never had a problem with map init. because I don't make very large maps; I did not try that, but I'll use that method next time I have an issue.

Looking over it more I don't understand why you're assigning things in arrays with [(Integer A)] as an index before saving them in the hashtable. Why not just save directly? There's also no need to nest your if-statements, you can put them all in parallel.

  • For each (Integer B) from 0 to 2 do (Actions)
    • Loop - Actions
      • Set RandomMineral = Random integer between 0 and 5
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 0
        • Then - Actions
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 1
        • Then - Actions
          • Hashtable - Save (Random integer between 10 and 25) as MineralKeyCopper of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 2
        • Then - Actions
          • Hashtable - Save (Random integer between 5 and 15) as MineralKeyGold of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 3
        • Then - Actions
          • Hashtable - Save (Random integer between 30 and 50) as MineralKeyIron of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 4
        • Then - Actions
          • Hashtable - Save (Random integer between 10 and 20) as MineralKeySilver of MINERAL_KEY in RockChunksTable
        • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • RandomMineral equal to 5
        • Then - Actions
          • Hashtable - Save (Random integer between 15 and 75) as MineralKeyTin of MINERAL_KEY in RockChunksTable
        • Else - Actions
For that matter you could use some arrays to simplify this process even more. Here you just load (0, MINERAL_KEY) for # duds (always 0), (1, MINERAL_KEY) for #golds, (2, MINERAL_KEY) for # coppers, etc and you actually don't even need to run this via executefunc.
  • -------- in a setup trigger: --------
  • -------- duds --------
  • Set MineralMin[0] = 0
  • Set MineralMax[0] = 0
  • -------- copper --------
  • Set MineralMin[1] = 10
  • Set MineralMax[1] = 25
  • -------- gold --------
  • Set MineralMin[2] = 5
  • Set MineralMax[2] = 15
  • -------- iron --------
  • Set MineralMin[3] = 30
  • Set MineralMax[3] = 50
  • -------- silver --------
  • Set MineralMin[4] = 10
  • Set MineralMax[4] = 20
  • -------- tin --------
  • Set MineralMin[5] = 15
  • Set MineralMax[5] = 75
  • -------- --------
  • -------- in your mineral setup trigger: --------
  • For each (Integer B) from 0 to 2 do (Actions)
    • Set RandomMineral = Random integer between 0 and 5
    • Hashtable - Save (Random integer between MineralMin[RandomMineral] and MineralMax[RandomMineral]) as RandomMineral of MINERAL_KEY in RockChunksTable

Wow! This looks way more efficient, thanks! Will post the updated trigger after I make these changes.
 
Level 4
Joined
Nov 3, 2015
Messages
46
Updated Triggers:

  • InitMineralMinMax
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • -------- DUDS --------
      • Set MineralMin[0] = 0
      • Set MineralMax[0] = 0
      • -------- COPPER --------
      • Set MineralMin[1] = 10
      • Set MineralMax[1] = 25
      • -------- GOLD --------
      • Set MineralMin[2] = 5
      • Set MineralMax[2] = 15
      • -------- IRON --------
      • Set MineralMin[3] = 30
      • Set MineralMax[3] = 50
      • -------- SILVER --------
      • Set MineralMin[4] = 10
      • Set MineralMax[4] = 20
      • -------- TIN --------
      • Set MineralMin[5] = 15
      • Set MineralMax[5] = 75

  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 0 to 2, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Wait 5.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 1
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[1] and MineralMax[1]) as MineralKeyCopper of MINERAL_KEY in RockChunksTable
          • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> CopperAmount = + (Load AmountCopper[(Integer A)] of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 2
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[2] and MineralMax[2]) as MineralKeyGold of MINERAL_KEY in RockChunksTable
          • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> GoldAmount = + (Load AmountGold[(Integer A)] of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 3
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[3] and MineralMax[3]) as MineralKeyIron of MINERAL_KEY in RockChunksTable
          • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> IronAmount = + (Load AmountIron[(Integer A)] of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 4
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[4] and MineralMax[4]) as MineralKeySilver of MINERAL_KEY in RockChunksTable
          • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> SilverAmount = + (Load AmountSilver[(Integer A)] of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 5
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[5] and MineralMax[5]) as MineralKeyTin of MINERAL_KEY in RockChunksTable
          • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> TinAmount = + (Load AmountTin[(Integer A)] of MINERAL_KEY from RockChunksTable))))
        • Else - Actions

  • MineralSurvey
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Survey Rocks
      • (Destructible-type of (Target destructible of ability being cast)) Equal to Rock Chunks
    • Actions
      • Set PlayerTemp = (Player number of (Owner of (Casting unit)))
      • Player Group - Add (Player(PlayerTemp)) to PlayerTempGroup
      • Game - Display to PlayerTempGroup the text: (Copper = + (String((Key (Load AmountCopper[(Key (Target destructible of ability being cast))] of MineralKeyCopper in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Gold = + (String((Key (Load AmountGold[(Key (Target destructible of ability being cast))] of MineralKeyGold in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Iron = + (String((Key (Load AmountIron[(Key (Target destructible of ability being cast))] of MineralKeyIron in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Silver = + (String((Key (Load AmountSilver[(Key (Target destructible of ability being cast))] of MineralKeySilver in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Tin = + (String((Key (Load AmountTin[(Key (Target destructible of ability being cast))] of MineralKeyTin in RockChunksTable)))))
      • Player Group - Remove (Player(PlayerTemp)) from PlayerTempGroup

I'm not sure if I'm displaying right, because only one rock chunks ID (1049910) is being displayed for all rock chunks and nothing of the amount of minerals within.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
If you’re not putting too much stuff on the Map Init event it will be fine but it’s just very common to cause an OP-lint thread crash from the init thread getting too big.

I don’t see anything in those triggers that is causing MineralRoll to run...? What is the purpose of the Wait 5.00? If you’re still rolling all 500 rocks together then that whole process will take 500*3*5=4500 seconds. 7.5 minutes.

Your load actions need to use MineralKeyCopper, MineralKeyGold, etc. instead of whatever that array bologna you are using instead. You need to load the same key you save to.
 
Level 4
Joined
Nov 3, 2015
Messages
46
If you’re not putting too much stuff on the Map Init event it will be fine but it’s just very common to cause an OP-lint thread crash from the init thread getting too big.

I don’t see anything in those triggers that is causing MineralRoll to run...? What is the purpose of the Wait 5.00? If you’re still rolling all 500 rocks together then that whole process will take 500*3*5=4500 seconds. 7.5 minutes.

Your load actions need to use MineralKeyCopper, MineralKeyGold, etc. instead of whatever that array bologna you are using instead. You need to load the same key you save to.

- Ah, okay. Well, no need to map init anything anyway I guess if elapsed time works the same with less issues.
- The map selection that calls MineralRoll is still there and still the same, what do you mean?
  • Map Choice Forest Test
    • Events
      • Dialog - A dialog button is clicked for MapDialog
    • Conditions
      • (Clicked dialog button) Equal to MapDialogButton[1]
    • Actions
      • Custom script: call DialogDestroy(udg_MapDialog)
      • Game - Display to (All players) the text: |c00FF00FF[SYSTEM]|...
      • For each (Integer A) from 1 to 500, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Random point in 1PLAYSCAPE <gen>)
          • Destructible - Create a Rock Chunks at TempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set MINERAL_KEY = (Key (Last created destructible))
          • Custom script: call ExecuteFunc("Trig_MineralRoll_Actions")
- Woops! Didn't pay attention when loading them, changed to MineralKeys.
  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 0 to 2, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 1
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[1] and MineralMax[1]) as MineralKeyCopper of MINERAL_KEY in RockChunksTable
            • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> CopperAmount = + (Load MineralKeyCopper of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 2
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[2] and MineralMax[2]) as MineralKeyGold of MINERAL_KEY in RockChunksTable
            • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> GoldAmount = + (Load MineralKeyGold of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 3
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[3] and MineralMax[3]) as MineralKeyIron of MINERAL_KEY in RockChunksTable
            • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> IronAmount = + (Load MineralKeyIron of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 4
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[4] and MineralMax[4]) as MineralKeySilver of MINERAL_KEY in RockChunksTable
            • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> SilverAmount = + (Load MineralKeySilver of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomMineral Equal to 5
        • Then - Actions
          • Hashtable - Save (Random integer number between MineralMin[5] and MineralMax[5]) as MineralKeyTin of MINERAL_KEY in RockChunksTable
            • Game - Display to (All players) the text: (Rock_Chunk # + ((String((Key (Last created destructible)))) + ( >> TinAmount = + (Load MineralKeyTin of MINERAL_KEY from RockChunksTable))))
        • Else - Actions
Also, I really appreciate the help you're giving me! I still have much to learn.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I just didn't see the trigger that ran MineralRoll so I thought you had forgotten to actually run the trigger. Instead of ExecuteFunc now that it's a very small function you can probably call it with Trigger - Run MineralRoll (ignoring conditions) instead of the ExecuteFunc. Just a thought if you feel like changing it back.

One more problem problem is the Skip Remaining Actions. It translates to "return" in JASS and immediately ends the function it is in. In this case the entire MineralRoll execution for a single rock chunk stops completely if any of the minerals it rolls for that chunk are 0 (dud). You can delete that if-block entirely. Now that you have the MinralMin and MineralMax arrays set up, you don't need the whole if-tree, you can reduce it to two lines like I showed above. The keys for a hashtable are just integers, so you can use RandomMineral (which is 0-5) as a key directly, then load (1, MINERAL_KEY) for copper, etc. instead of loading (MineralKeyCopper, MINERAL_KEY). Perhaps it's confusing that I suggested the name MINERAL_KEY when it really should be ROCK_CHUNK_KEY. You don't even need an if-block this way:

  • For each (Integer B) from 0 to 2 do (Actions)
    • Set RandomMineral = Random integer between 0 and 5
    • Hashtable - Save (Random integer between MineralMin[RandomMineral] and MineralMax[RandomMineral]) as RandomMineral of MINERAL_KEY in RockChunksTable
 
Level 4
Joined
Nov 3, 2015
Messages
46
  • Map Choice Forest Test
    • Events
      • Dialog - A dialog button is clicked for MapDialog
    • Conditions
      • (Clicked dialog button) Equal to MapDialogButton[1]
    • Actions
      • Custom script: call DialogDestroy(udg_MapDialog)
      • Game - Display to (All players) the text: |c00FF00FF[SYSTEM]|...
      • For each (Integer A) from 1 to 500, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Random point in 1PLAYSCAPE <gen>)
          • Destructible - Create a Rock Chunks at TempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set MINERAL_KEY = (Key (Last created destructible))
          • Trigger - Run MineralRoll <gen> (ignoring conditions)
  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 0 to 2, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Hashtable - Save (Random integer number between MineralMin[RandomMineral] and MineralMax[RandomMineral]) as RandomMineral of MINERAL_KEY in RockChunksTable
I changed the custom command to "Trigger - Run MineralRoll <gen> (ignoring conditions)" and MineralRoll is now only using those two lines as you said.

I need to change up MineralSurvey and I'll tell you the results when I run the map and use the Survey Rocks ability.
 
Level 4
Joined
Nov 3, 2015
Messages
46
I changed all of the AmountMineral[] arrays to MineralKeyMineral, but I'm still only getting zeroes from every rock I cast Survey Rocks on.

  • MineralSurvey
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Survey Rocks
      • (Destructible-type of (Target destructible of ability being cast)) Equal to Rock Chunks
    • Actions
      • Set PlayerTemp = (Player number of (Owner of (Casting unit)))
      • Player Group - Add (Player(PlayerTemp)) to PlayerTempGroup
      • Game - Display to PlayerTempGroup the text: (Copper = + (String((Key (Load MineralKeyCopper of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Gold = + (String((Key (Load MineralKeyGold of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Iron = + (String((Key (Load MineralKeyIron of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Silver = + (String((Key (Load MineralKeySilver of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Tin = + (String((Key (Load MineralKeyTin of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Player Group - Remove (Player(PlayerTemp)) from PlayerTempGroup
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don't see any trigger where MineralKeyCopper, Gold, Silver, Iron, Tin are being set so they're all probably = 0 and you're loading information on duds for each of them. You can either just load with your first key as 1,2,3,4 or 5 depending on which mineral you want... or you can assign MineralKeyCopper = 1 (and similarly with different numbers for the others) and then load using those longer variables. I find it easier just to use the number since then you can easily loop through it.
 
Level 4
Joined
Nov 3, 2015
Messages
46
For the MineralSurvey, each Game (Auto-Timed) message is as follows:
Game - Text Message (Auto-Timed) >> Concatenate Strings >> Convert Integer to String >> Hashtable - Get Handle ID >> Load Destructible Handle
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Okay you have about four versions of 6 different triggers posted in this thread and none of them are 'all' updated to the current set of triggers. Can you please post everything relevant to this mineral system at the current time? It's very, very hard to debug something when you can only look at 20% of it at once. Or just upload the map.
 
Level 4
Joined
Nov 3, 2015
Messages
46
In order from top to bottom:

  • RockChunksHashtable
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set RockChunksTable = (Last created hashtable)

  • InitMineralMinMax
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • -------- DUDS --------
      • Set MineralMin[0] = 0
      • Set MineralMax[0] = 0
      • -------- COPPER --------
      • Set MineralMin[1] = 10
      • Set MineralMax[1] = 25
      • -------- GOLD --------
      • Set MineralMin[2] = 5
      • Set MineralMax[2] = 15
      • -------- IRON --------
      • Set MineralMin[3] = 30
      • Set MineralMax[3] = 50
      • -------- SILVER --------
      • Set MineralMin[4] = 10
      • Set MineralMax[4] = 20
      • -------- TIN --------
      • Set MineralMin[5] = 15
      • Set MineralMax[5] = 75

  • InitRandomMineral
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • Set RandomMineral = 0

  • InitMineralIDKeys
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • Set MineralKeyCopper = 0
      • Set MineralKeyGold = 1
      • Set MineralKeyIron = 2
      • Set MineralKeySilver = 3
      • Set MineralKeyTin = 4

  • MineralRoll
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 0 to 2, do (Actions)
        • Loop - Actions
          • Set RandomMineral = (Random integer number between 0 and 5)
          • Hashtable - Save (Random integer number between MineralMin[RandomMineral] and MineralMax[RandomMineral]) as RandomMineral of MINERAL_KEY in RockChunksTable

  • MineralSurvey
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Survey Rocks
      • (Destructible-type of (Target destructible of ability being cast)) Equal to Rock Chunks
    • Actions
      • Set PlayerTemp = (Player number of (Owner of (Casting unit)))
      • Player Group - Add (Player(PlayerTemp)) to PlayerTempGroup
      • Game - Display to PlayerTempGroup the text: (Copper = + (String((Key (Load MineralKeyCopper of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Gold = + (String((Key (Load MineralKeyGold of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Iron = + (String((Key (Load MineralKeyIron of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Silver = + (String((Key (Load MineralKeySilver of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Game - Display to PlayerTempGroup the text: (Tin = + (String((Key (Load MineralKeyTin of (Key (Target destructible of ability being cast)) in RockChunksTable)))))
      • Player Group - Remove (Player(PlayerTemp)) from PlayerTempGroup

  • Map Choice Forest Test
    • Events
      • Dialog - A dialog button is clicked for MapDialog
    • Conditions
      • (Clicked dialog button) Equal to MapDialogButton[1]
    • Actions
      • Custom script: call DialogDestroy(udg_MapDialog)
      • Game - Display to (All players) the text: |c00FF00FF[SYSTEM]|...
      • For each (Integer A) from 1 to 500, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Random point in 1PLAYSCAPE <gen>)
          • Destructible - Create a Rock Chunks at TempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.40) and variation (Random integer number between 1 and 6)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set MINERAL_KEY = (Key (Last created destructible))
          • Trigger - Run MineralRoll <gen> (ignoring conditions)

These are all the up-to-date and relevant triggers. If you want me to upload the map, I'll do so.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Sorry if my tone was harsh before, I was frustrated that we couldn't figure out what was happening. It turns out the data is being set properly in the hashtable, you're just not reading the hashtable properly. Exactly the way Tasyen noticed on the previous page, there is an erroneous Key() in your string printout and what you're actually printing is a stringhash of the mineral amount as a string. You need to remove the leftmost Key() in there. I would do it like this to avoid the GUI window-hopping-bonanza that happens when you get too deep into concatenated strings:

  • Set MINERAL_KEY = (Key(Target destructible of ability being cast)) //as I said before this variable probably should actually be called CHUNK_KEY
  • Player Group - Add (Triggering Player) to PlayerTempGroup //Triggering Player works the same as "Owner of (Triggering Unit)" in many unit events, though not all of them. Triggering Unit >>>> Casting unit
  • Game - Display to PlayerTempGroup the text: (Copper = + String(Load MineralKeyCopper of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Gold = + String(Load MineralKeyGold of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Iron = + String(Load MineralKeyIron of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Silver = + String(Load MineralKeySilver of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Tin = + String(Load MineralKeyTin of MINERAL_KEY in RockChunksTable))
  • Player Group - Remove (Triggering Player) from PlayerTempGroup
You can combine all of your 0.02 elapsed time triggers into one trigger; there's no real reason to keep them separate unless you like the organization that way. You don't need to initialize variables like you did with RandomMineral, I was saying for the other MineralKeyCopper and the like you needed to 'initailize' them to be 1,2,3,4,5 so that when you use them later they actually have values instead of all being 0. RandomMineral is always assigned right before it's used so you don't have to worry about it.
 
Level 4
Joined
Nov 3, 2015
Messages
46
Sorry if my tone was harsh before, I was frustrated that we couldn't figure out what was happening. It turns out the data is being set properly in the hashtable, you're just not reading the hashtable properly. Exactly the way Tasyen noticed on the previous page, there is an erroneous Key() in your string printout and what you're actually printing is a stringhash of the mineral amount as a string. You need to remove the leftmost Key() in there. I would do it like this to avoid the GUI window-hopping-bonanza that happens when you get too deep into concatenated strings:

  • Set MINERAL_KEY = (Key(Target destructible of ability being cast)) //as I said before this variable probably should actually be called CHUNK_KEY
  • Player Group - Add (Triggering Player) to PlayerTempGroup //Triggering Player works the same as "Owner of (Triggering Unit)" in many unit events, though not all of them. Triggering Unit >>>> Casting unit
  • Game - Display to PlayerTempGroup the text: (Copper = + String(Load MineralKeyCopper of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Gold = + String(Load MineralKeyGold of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Iron = + String(Load MineralKeyIron of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Silver = + String(Load MineralKeySilver of MINERAL_KEY in RockChunksTable))
  • Game - Display to PlayerTempGroup the text: (Tin = + String(Load MineralKeyTin of MINERAL_KEY in RockChunksTable))
  • Player Group - Remove (Triggering Player) from PlayerTempGroup
You can combine all of your 0.02 elapsed time triggers into one trigger; there's no real reason to keep them separate unless you like the organization that way. You don't need to initialize variables like you did with RandomMineral, I was saying for the other MineralKeyCopper and the like you needed to 'initailize' them to be 1,2,3,4,5 so that when you use them later they actually have values instead of all being 0. RandomMineral is always assigned right before it's used so you don't have to worry about it.

Woo! It's finally working! Thank you @Pyrogasm, @Tasyen, and @IcemanBo for your help.

When I used "Survey Rocks" and it worked... I nearly hopped out of my seat lol. Now I just need to figure out why silver is rolling above 20; more problems to fix, yay.
 
Status
Not open for further replies.
Top