I saw this earlier and then didn't have much of a helpful reply to give because for me the distinction between these two files seems fairly arbitrary. For best results, the way to manipulate these kinds of files is mostly to think of them as declared functions that call to each other. And you could optionally use functions to organize the code, or not, but the behavior of what it does is most likely going to end up the same in the end.
So, maybe it is because I have
too much skill with the jass programming language that these are written in, but essentially the distinction here between these files was fairly arbitrary and so it's unclear to me how I could help you with that. You can use functions to organize your code, or not. That is really up to you. The Warcraft III engine will construct units based on whether you call the underlying native functions (or common.ai helper functions) to command the AI subsystem to build a particular build order. Both of these scripts do that. If you need to make a working AI script file, then you need to do that.
I had great success in the past by taking the melee AIs (elf.ai, human.ai, orc.ai, undead.ai, etc) and replacing the Unit IDs that they use so that they created units of my custom faction instead.
I would really love it if someone can explain to me what is what
So, to this point I don't know if I really answered your question here. But I think this is fairly involved and most likely probably none of us really know because there was never a guide from Blizzard in 2002-2003 when they created this system, so it is mostly left up to the user to intuit what things mean based on what they are doing. Yet, often they have intuitive names. So maybe I have not helped here much, but the way that I learned to use these AI files was through the Warcraft III World Editor by opening up the AI Editor module. In that module, a GUI can walk you through the process of creating one of these AI files automatically, and save your work as a .WAI file (World Editor AI) which has all of the GUI module settings and properties. If you are just getting started, I suggest using that. There is even a feature to test your AI script on any default melee map of your choice. Of course, on Reforged the fringe features like this might not work, but if you are already modding Warcraft III then you probably know well enough to stay away from the newer World Editor for the obscure fringe features like editing custom campaigns and AIs that were not a part of the focus of the efforts of Reforged. Regardless of that nonsense, I know that when I was a kid the AI Editor module was working well and fine and its test feature let me test the AIs that I was developing with a higher than normal speed, so I could have 2 AIs duke it out in warpspeed and easy get a sense for who was better.
Or you can test the game more slowly and carefully watch how your AI behaves.
My advice is that once you do that for a while, and become familiar with the annoying AI editor bugs -- because there
were bugs with that GUI even back in the 2000s -- then you will start to see why it is easier to edit the .ai scripts directly instead once you are very accustomed to how these systems work. At that point, the quickest way to make an AI is probably to rip out of one of the ingame AIs like you did and just change all the Unit IDs to be what you need. Most of the stuff about when to attack an expansion versus when to go creeping, or whatever, is probably not going to be different for your use case. Although obviously you could customize it if you really needed to.