Further changes to the scenario file

From FA Forever Wiki
Revision as of 10:57, 31 March 2015 by Speed2 (talk | contribs) (Created page with "If your map is unplayable, it is likely that something has been messed up in the scenario.lua file. I have made the following code to make it a bit easier to understand what e...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If your map is unplayable, it is likely that something has been messed up in the scenario.lua file. I have made the following code to make it a bit easier to understand what exactly is being done by the computer. Please note that this scenario file may look different than what you see in your editor. Several lines of code are in another place than in the code generated by the map editor. Should your code, for some reason, not work (and can't you figure out why) then this piece of code is a good template to find the error or to replace the old code in the scenario.lua file alltogether. The lua is fairly flexible in reading the elements (for example, note the difference between ['standard'] and standard in this code and the piece directly above). The code has the following structure: version = 3

   ScenarioInfo = {
           size={ 256, 256 },
                           customprops={ },
                           teams={ { armies={"ARMY_1","ARMY_2",}, name="FFA"}}

The following rules apply. If something is broken to the point that you can't play your map (usually you will see spawn points in the left-top corner, or not at all):

  • An element starts with its type (e.g. ScenarioInfo={ is an element) and it ends with the } bracket all the way at the end. When an element has subelements, they can be seen in between the brackets, { and }. Paths and names that are referred to, are in quotation marks (" or "). Subsequent elements and subelements are listed by the commas (,)
  • The location of elements and subelements in an element does not matter. For example, the teams subelement has two subelements, armies and name. In this piece of code, name comes after armies, but the code above has armies before name. Even "ARMY_1" can be swapped with "ARMY_2", but the comma in between them must remain there.
  • The placement of commas and brackets does matter. It allows the program to correctly read the different elements as they are listed. For example, the Configurations={ element has its ending bracket five lines lower. The comma that follows it directly, tells that there are more elements following (In this case, the no rush information). Be aware that one missing comma will make the map unplayable. If you happen to find that (when you try to test the game), the spawn points are all in the upper left corner in the preview (or nowhere to be seen), then search for improperly placed or missing commas and brackets first! It's unclear what a comma too much will do, as previous code (containing only the Configurations section) has some commas indicating that there are more subelements to follow, but there are none. In this set of code, all those commas are gone. Both should work, but if something doesn't work and there are superfluous commas, it's best to remove them.
  • When uploading the map to the vault of the Forged Alliance Forever , the map_version will become important. When the scenario is first generated by the map editor, this line of code will not exist yet. Similarly, your map will probably be the folder /maps/yourmapname/ and its contents. The change of the folder name to /maps/yourmapname.v0001/ should be done to ensure proper updating in the FAF map vault. When you have done the upload and find some things that are out of place, or missing, you can now simply make the changes, then change v0001 to v0002 everywhere in this scenario and in the folder name. Finally, change map_version=1 to map_version=2 and you can upload the same map under the same name again. Now the FAF vault will overwrite the old version with the new one. This system has been implemented to automatically clean up the map vault whenever someone wants a new and improved version of the map. So don't forget to ensure this is added in your scenario file.

If you find, after a lot of trying, that the editor-generated code is still not making the map playable, then you can copy the full code in this section and use it to replace the old code completely. Then, the following parts should be changed to ensure that everything works:

  1. Every yourmapname should be changed to what your map name is.
  2. The number of armies must be consistent to the number of players that will play on your map. So if you have six armies in total, you should add "Army_3","Army_4","Army_5","Army_6", and for a total of 8 armies, it should of course continue to "Army_8",
  3. Do the same for the no rush information. Every army number x must have a norushoffsetX_ARMY_x=0', and a norushoffsetY_ARMY_x=0', (If you want a different offset, that is of course perfectly fine).
  4. The size={256,256} element must have the correct numbers for its x and y dimension. If you have a map that is 256 by 256 units (5km by 5km), then you can leave this alone. Otherwise, change the numbers to what they should be (512 for 10km, 1024 for 20km, 2048 for 40km and 4096 for 80km). Be careful that you don't mix up the x and y size if you have map that isn't a perfect square.
  5. Should you not yet have renamed your map for the correct map version, do so. Please note that this still has map_version = 1, so if you are already beyond that version, this should change in accordance.