Genisys wrote...
Ok, I've read up on what you gave me, all of this seems simple enough, how to use the 2DA and how to edit it, and thanks for the information on the function as well..
My next question would be, how can I utilize a 2DA within scripting that can be useful, can you give me an example?
Hello.
Are you asking "why would I want to use a custom 2DA I make?"
If yes, see 2DA files as "source of information".
"Any" information.
Generally, the use of a custom 2DA is felt when you have a large dataset to read from.
Suppose that you make your own craft system.
Maybe your rules are that some item types can only receive some itemproperties.
And then, some itemproperties are limited (in quality) dependant on the specific item they are placed upon.
For example: A bonus to Strength could be limited to Gloves and Body Armor.
And the bonus could be further limited to +6 on Gloves, but able to climb to +12 on Body Armor.
And maybe you can not go past +4 Strength if you are not Level 10 at least, and not past +8 Strength if you are not Level 12.
Just an example, and not very complex. But this kind of info is perfect for a 2DA.
If you had it all coded in your scripts, it would be different.
You would have to maintain a bunch of constants inside your scripts, telling what can go where and to which extent. Multiply this for a number of base item types and itemproperties... and you end up with a huge list of constants, going on for pages.
Which is hell to maintain. And is very prone to typo, in spite of all your care.
And regardless, at the minimal change in your constants, you would have to recompile all your scripts.
Sometimes a pure-scripts solution is not even practical, you see.
These problems do not exist with a 2DA resource.
Also, 2DA resources are completely disjoint from the script layer.
So long you preserve their "layout", you can provide several versions of a same 2DA (to implement different rules, for example). And you may switch between them, at runtime, by just changing the name of the 2DA to read from.
Your scripts would need no adaptation, and their performance would not be affected -- as a bonus.
-fox