- 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:
Init. mineral rolling "slots":
Init. mineral ID keys:
The map choice and generation:
RNG for minerals in rocks:
When a rock is surveyed:
Sorry if seeing this makes your eyes hurt, so please bear with me because I'm only just dabbling in using hashtables.
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.