Does anyone know how to create and call records within a master record? I've seen it mentioned a few times, but I have not been able to get it to work.
EDIT:
Solved: 5-step tutorial for anyone that doesn't know:
1) Create a record, name it "Slave."
2) Create a variable inside the record Slave, named SlaveInt, of type integer, array size 5
3) Create a record, name it "Master."
4) Go to the Master Record, and create a variable within it, type record, name it "SlaveRec" Array size 8. Make sure you select the Slave Record when you set this variable type to record.
5) Create a global variable, type record, name it "MasterRec." Make it an array of size 10. Make sure you select Master Record when you set this variable type to record.
--------------
To reference this variable:
Now create a trigger, and make a new action: Set Variable:
Index 1 must be between 0 and 10. Index 2 must be between 0 and 8. Index 3 must be between 0 and 5.
There is a total of (11)(9)(5) pieces of information contained within the master record (495 different integer variables). So be careful when you do this, the size of the record can grow quickly.
EDIT 2:
You may encounter a compilation error when you save. I discovered from other threads that you must physically place the Slave Records above the Master Record for it to compile correctly, as the script is compiled sequentially from the top to bottom of your triggers.
It should appear like this in your trigger editor:
In your steps 4 and 5 ensure that then you set the variable to type record that you are also setting the actual specific records its supposed to link to.
When your referencing the record the variable of the record is not set to type record like records are done, instead to set the type to the name of the record instead which would now appears in the lists along with the other variable types. To claify slave should be a record, master should be a record, but slaverex should not be a record- just a varable with the types set to the name of the slave record.
Also, if you are going to do this I would recomend putting all your code in a mod, then adding the mod as a dependancy on your actual map.
Copy/paste and import/export of code with nested records is buggy and will tend to cause a lot of headaches. I have learned the hard way that it is better creating a mod and adding it as a dependancy. That way if you want to use the code on another map, or if you want to redo the terrain or data stuff from scratch you can just add it without spending an hour fixing up all the broken links.
You know, you could use the search function because it has been answered over a dozen times already.
Or you could look in the stickied thread at the top of this forum, the 101 one, the one you should read before you post.
And then, maybe, just, you will find that it was answered in that thread as well.
I did. Guess what? All of the explanations to the person's problem are either severely convoluted or full of crap answers like the one you just gave me. Also, the title of my thread is perfect for future users to search in the future, and I also gave them a very simple tutorial on how to do it. So, think of me as doing a favor for the community, so you honestly don't get this question ever again.
Also, the Common Sense 101 is what made me even realize that is possible to put records inside of records. His explanation on how to do so was terrible, and he didn't even mention how to call them in-game. It left a lot for new users to figure out. So I made a 5-step tutorial. You mad bro?
---------
Common Sense 101 excerpt:
You can put records inside records, but they must be above the master record which stores the variables of type record, for instance.
pl_Hero Data (Record)
pl_Statistics (Record)
pl_Options (Record)
Player Data (Record)
Player <Player Data[15]> (Variable of type Record)
Also, if you are going to do this I would recomend putting all your code in a mod, then adding the mod as a dependancy on your actual map.
Copy/paste and import/export of code with nested records is buggy and will tend to cause a lot of headaches. I have learned the hard way that it is better creating a mod and adding it as a dependancy. That way if you want to use the code on another map, or if you want to redo the terrain or data stuff from scratch you can just add it without spending an hour fixing up all the broken links.
By any chance, does making a mod and then using it, reduce the memory limitations of a map when you upload it to be published? I'm thinking specifically of custom imported content, like sounds/music/models/art.
Using mods allows you to bypass the memory limit for a single map. It does draw on your total memory usage, however. I do this for adding soundtracks and models into my maps.
Using mods allows you to bypass the memory limit for a single map. It does draw on your total memory usage, however. I do this for adding soundtracks and models into my maps.
Awesome. I have another question.
If a battlenet user has not downloaded the mod, will they be denied the ability to join the lobby? Or Bnet automatically download the mod for them before downloading the map?
Does anyone know how to create and call records within a master record? I've seen it mentioned a few times, but I have not been able to get it to work.
EDIT:
Solved: 5-step tutorial for anyone that doesn't know:
1) Create a record, name it "Slave."
2) Create a variable inside the record Slave, named SlaveInt, of type integer, array size 5
3) Create a record, name it "Master."
4) Go to the Master Record, and create a variable within it, type record, name it "SlaveRec" Array size 8. Make sure you select the Slave Record when you set this variable type to record.
5) Create a global variable, type record, name it "MasterRec." Make it an array of size 10. Make sure you select Master Record when you set this variable type to record.
--------------To reference this variable:
Now create a trigger, and make a new action: Set Variable:
MasterRec[index] . Slave Rec [ index 2] . SlaveInt [Index 3]
Index 1 must be between 0 and 10. Index 2 must be between 0 and 8. Index 3 must be between 0 and 5.
There is a total of (11)(9)(5) pieces of information contained within the master record (495 different integer variables). So be careful when you do this, the size of the record can grow quickly.
EDIT 2:
You may encounter a compilation error when you save. I discovered from other threads that you must physically place the Slave Records above the Master Record for it to compile correctly, as the script is compiled sequentially from the top to bottom of your triggers.
It should appear like this in your trigger editor:
Trigger 1
Trigger 2
Global Variable 1
SLAVE RECORD
MASTER RECORD
MasterRecvariable
Trigger 3
etc
In your steps 4 and 5 ensure that then you set the variable to type record that you are also setting the actual specific records its supposed to link to.
????
^clarified
Also, if you are going to do this I would recomend putting all your code in a mod, then adding the mod as a dependancy on your actual map.
Copy/paste and import/export of code with nested records is buggy and will tend to cause a lot of headaches. I have learned the hard way that it is better creating a mod and adding it as a dependancy. That way if you want to use the code on another map, or if you want to redo the terrain or data stuff from scratch you can just add it without spending an hour fixing up all the broken links.
You know, you could use the search function because it has been answered over a dozen times already.
Or you could look in the stickied thread at the top of this forum, the 101 one, the one you should read before you post.
And then, maybe, just, you will find that it was answered in that thread as well.
I did. Guess what? All of the explanations to the person's problem are either severely convoluted or full of crap answers like the one you just gave me. Also, the title of my thread is perfect for future users to search in the future, and I also gave them a very simple tutorial on how to do it. So, think of me as doing a favor for the community, so you honestly don't get this question ever again.
Also, the Common Sense 101 is what made me even realize that is possible to put records inside of records. His explanation on how to do so was terrible, and he didn't even mention how to call them in-game. It left a lot for new users to figure out. So I made a 5-step tutorial. You mad bro?
---------Common Sense 101 excerpt:
You can put records inside records, but they must be above the master record which stores the variables of type record, for instance.
pl_Hero Data (Record) pl_Statistics (Record) pl_Options (Record) Player Data (Record) Player <Player Data[15]> (Variable of type Record)
Inside the Player Data record I have at the top.
options <pl_Options> hero <pl_Hero Data> stats<pl_Statistics>
Remember, the "master" record must always be BELOW the ones you want to put inside it.
------------------------???
By any chance, does making a mod and then using it, reduce the memory limitations of a map when you upload it to be published? I'm thinking specifically of custom imported content, like sounds/music/models/art.
Using mods allows you to bypass the memory limit for a single map. It does draw on your total memory usage, however. I do this for adding soundtracks and models into my maps.
Awesome. I have another question.
If a battlenet user has not downloaded the mod, will they be denied the ability to join the lobby? Or Bnet automatically download the mod for them before downloading the map?
Battle.net will download all the required dependencies to play the map prior to joining a lobby.
^This, but your mod must be published. Local mods will not work.