To get unit information is easy enough, open a virtualfile "units\\ud->name", now how do i get weapon information? some mods have a weapons.tdf, some have all sorts of weird names, so its not straightforward as with units since i dont know where the information is held unless i look and type it in the code myself, which is very impractical.
How do i load a unit's weapon up in sunparser to get its stats?
Using the sunparser with virtual files
Moderators: hoijui, Moderators
Well..I don't know much about the technical part of it, but I know that the filenames of the .tdf files don't matter in the slightest - Spring just loads all the weapons in the weapons folder regardless of what the name of the file the actual stats are in. Hence why some mods have 20mm.tdf, US_M2Browning.tdf, or GER_MG42.tdf, while others just have weapons.tdf, and all of them are in that single .tdf file.
The .tdf files are all just in plaintext, if that helps any.
Sorry I can't be any more specific, I'm very much on the code-ignorant end of things.
The .tdf files are all just in plaintext, if that helps any.
Sorry I can't be any more specific, I'm very much on the code-ignorant end of things.
Yes, im well aware of that, but unfortunately def->reload returns zero and def->salvosize returns something like 13 billion(unless its a real burst weapon, then sometimes it works), for every weapon for every unit for every mod and it seems to have been broken recently since it used to work a few versions ago!Zaphod wrote:The unit's UnitDef has a list of WeaponDef's, which define the weapon (and contains all info about it). It would also be inefficient to let spring parse the files and then have the AI parse the same file again.
What syntax should i use then to load the weapons? I need to specify a filename, which works for units, now if all weapons are in one file then i need to know its name, and this doesnt work:
Code: Select all
ai->parser->LoadVirtualFile("weapons\");
ai->parser->GetDef(testint1, "-1", "LIGHTLASER\\DAMAGE\\default");
err, you'd need to have a way of getting a list of files in that folder.
Eitherway I think aprsing the weapons file directly is better because nobody has documented the unitweapondef structure and it's full of thgins like categories that hold int values repesenting thgins and we arent given a key/index/list of what representss what etc, unlike the Comand structure where everything is self explanatory and even has comments....
For example does the weapon only target certain categories, is it air only?
Eitherway I think aprsing the weapons file directly is better because nobody has documented the unitweapondef structure and it's full of thgins like categories that hold int values repesenting thgins and we arent given a key/index/list of what representss what etc, unlike the Comand structure where everything is self explanatory and even has comments....
For example does the weapon only target certain categories, is it air only?
Any updates on this? Any way to get weapon information reliably will help, the mod balancing groupAI is done and just waiting on that key component to bring joy and happiness to all modders and players alike!
If nothing else works, ill convince them all to stick all weapons in a weapons.tdf and then release it.
If nothing else works, ill convince them all to stick all weapons in a weapons.tdf and then release it.
erm diff's are easier for them to use apparently.
mailing list:
http://lolut.utbm.info/cgi-bin/mailman/ ... ring-linux
mailing list:
http://lolut.utbm.info/cgi-bin/mailman/ ... ring-linux