Results 1 to 7 of 7

Thread: Modding in era-specific units. A possible approach.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member Member afrit's Avatar
    Join Date
    Jun 2004
    Location
    USA
    Posts
    321

    Default Modding in era-specific units. A possible approach.

    To my knowledge, there is no possible way right now to limit production of certain units to a certain time frame. But I thought of a solution while trying to figure out the save game file format.

    Here's how it would work:

    1. Make a new line of buildings (say steel_maker) with several levels
    2. Provide the lower level to all settlements in descr_strat.txt
    3. Make it impossible for any faction to upgrade
    4. Make new-era units dependent on higher level of building .
    5. This is the tricky part. When the new era year arrives, have the user save the game, then in the saved game file edit all the buildings to the higher steel_maker level. Reload the game and the new units will be available.

    #5 will require the writing of a simple program with BASIC or C++. Let the program run in the background (i.e as a daemon) and let it check the autosave file in the saves folder every 10 seconds or so.

    If the autosave file changes (which it does when when the player hits end turn), the daemon will read the file and check the year in the file. If the new era arrived, the daemon will alert the player (e.g play a sound) that an event has happened. The player is asked to save the current game (by now it's player's turn again and the AI has finished its part). And then the daemon will go through the saved game and upgrade all the steel_makers to the necessary level.

    When the player resumes the game (by re-loading), the new units should become available.


    The 2 key parts are figuring out how to edit the year and the level of buildings. I know the year is editable because romeSAGE does that. And I figured out how to edit the buildings. The building level is 5 bytes after the building name in the save game file. I tested this by saving a game soon after starting, and then updating all barracks level by one. And sure enough, when I reloaded, I could build higher units .

    Now, before I try to write such an application, is there a reason that the above would not work?

    feedback appreciated.
    The plural of anectode is not data - Anonymous Scientist

    I don't believe in superstition. It brings bad luck. - Umberto Eco

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Modding in era-specific units. A possible approach.

    Wouldn't it be possible to just create the buildings by script in each settlement?
    I don't like the prospect of any background programs running on my machine when I just want to play a mod...

  3. #3
    Member Member Dromikaites's Avatar
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    151

    Default Re: Modding in era-specific units. A possible approach.

    Quote Originally Posted by alpaca
    Wouldn't it be possible to just create the buildings by script in each settlement?
    I don't like the prospect of any background programs running on my machine when I just want to play a mod...
    Yes, it's more elegant to have a special building created by script when the year comes. This way, using the building_present condition we can inhibit the production of certain units and allow the production of others. For the player it would look like a "Marian reform".

  4. #4
    Member Member afrit's Avatar
    Join Date
    Jun 2004
    Location
    USA
    Posts
    321

    Default Re: Modding in era-specific units. A possible approach.

    Is it still true that a script running in the background can only be launched with a new campaign, and will stop executing once a game is saved/reloaded?

    I thought that was the reason scripts could not be used for that particular purpose. (era specific units).
    The plural of anectode is not data - Anonymous Scientist

    I don't believe in superstition. It brings bad luck. - Umberto Eco

  5. #5

    Default Re: Modding in era-specific units. A possible approach.

    Quote Originally Posted by afrit
    Is it still true that a script running in the background can only be launched with a new campaign, and will stop executing once a game is saved/reloaded?
    A script can only be _automatically_ launched with a new campaign. When a game is reloaded it can be manually restarted.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  6. #6
    Senior Member Senior Member Duke John's Avatar
    Join Date
    May 2003
    Location
    Netherlands
    Posts
    2,917

    Lightbulb Re: Modding in era-specific units. A possible approach.

    Didn't BI introduce automatic script loading? According to the documents from Jerome:
    Code:
    Identifier:         GameReloaded
    Event:              A strat map game has been reloaded
    Exports:            none
    Class:              ET_GAME_RELOADED
    Author:             Guy
    Or is this not usable/working?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO