Buy menu groups for vehicles

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the Transport-Fever Community

  • With Transport Fever 2 a new feature has been added to the Buy menu: It is now possible to group the entries. This is especially useful for shape variants, repaints and multiple units with different length configurations. The following article is a detailed introduction to the necessary adjustments of the models.

    Groups for the buy menu are passively defined in Transport Fever 2, i.e. a group is not explicitly defined with the contents contained in a separate file. Instead, the vehicles are optionally specified to be included in a group (and in which group). Only then will a purchase menu entry be displayed as a group.


    [h1]Code adaptation in *.mdl files[/h1]
    The group is entered in the transportVehicle code block. The keyword to be used is groupFileName. The path to any mdl, which is to serve as a group entry in the purchase list, must be specified relative to the models folder. An example looks like this:


    Code: *.mdl
    1. transportVehicle = {
    2. carrier = "RAIL",
    3. compartmentsList = {
    4. -- ...
    5. },
    6. loadSpeed = 1,
    7. multipleUnitOnly = false,
    8. reversible = false,
    9. groupFileName = "vehicle/train/menu_1020.mdl",
    10. },


    In the game such a grouping is indicated by the reference to n variants in the upper right corner of the group entry. In the right column you will then find another list with the variants contained in these groups in the lower area. The technical data shows the values of the currently selected variant in the group.




    [h1]Code adaptation in *.lua files of multiple units[/h1]
    The group is entered in the return code block. The keyword to use is also groupFileName. Behind it is the path:

    • relative to the models folder if a model is to serve as a group.
    • relative to the config/multiple_unit folder if another train is to serve as a group.

    An example looks like this:


    Code: *.lua
    1. function data()
    2. return {
    3. vehicles = {
    4. -- ...
    5. },
    6. groupFileName = "vehicle/train/menu_cityjet.mdl",
    7. name = _("oebb_4744_name"),
    8. desc = _("oebb_4746_desc")
    9. }
    10. end


    In the case of multiple-unit trains, the representation looks exactly the same as for individual vehicles. Here, too, such a grouping is indicated by the reference to n variants in the upper right corner of the group entry. In the right column you will then find another list with the variants contained in these groups in the lower area. The technical data shows the values of the currently selected variant in the group.



    [h1]Individual group pictures and names[/h1]
    Especially for vehicles with many colour variations one would like to show in the group entry what one can expect in the group. Therefore it is necessary to create an individual menu model as a placeholder, which is never displayed in the game itself as a variant to buy. This model gets the name of the desired group and the preview image is saved as ui image in the ui\models_small folder. In the code it is important that the multipleUnitOnly entry is set to true. As long as no multiple unit contains the model, this means that the entry itself is never offered for sale, but only appears if a subordinate train or model is available. It is important that the groupFileName is not set for this model:

    Code: menu_*.mdl
    1. transportVehicle = {
    2. carrier = "RAIL",
    3. compartmentsList = {
    4. -- ...
    5. },
    6. loadSpeed = 1,
    7. multipleUnitOnly = true,
    8. reversible = false,
    9. -- groupFileName not set!
    10. },

    The examples described in the previous sections each use an individualised menu item according to this scheme.
    To support a common style, here is a suggestion for the grouping sprite:

    • Take up to 4 of the available variants
    • Place them 30 pixels apart of each other with the right one being at the front
    • Make an approximately 2 pixel wide gap between the variants to improve the contrast
    • For multiple units, use 50 - 100 % of the second coach, too
    • In the normal size of the purchase menu, the images can be a maximum of 327 pixels wide. Then the menu is stretched accordingly. Starting from 700 pixels the right edge is cut off




    [h1]Different availability, other modes of transport and engine types[/h1]
    For vehicles with a long development time, it is not necessary for the group model to cover the availability range of all variants. If only one variant is available at a time, it is displayed individually in the purchase list. As soon as two or more variants are available, the group entry with the variant list is displayed.


    Grouping is not only possible for rail vehicles. It can also be used for other vehicle types (aircraft, ships, road (rail) vehicles).


    For rail vehicles, there is also the special case that different variants of a group have defined diesel and other electrical equipment as drive types, for example. If in the purchase menu the tab is set to "ALL", all are displayed under the group. If diesel vehicles have been explicitly selected, only the corresponding subset of the vehicles is displayed.

Share