Results 1 to 10 of 10

Thread: Guide: The Complete Guide to Plugins

  1. #1
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,760
    Blog Entries
    3

    Default Guide: The Complete Guide to Plugins

    Modding Resource Header
    Title: Guide: The Complete to Plugins
    Posted by: Squid
    Modding area: Buildings, Descr_Stat
    Required programmes: Notepad (or other text editor)
    Summary: An in-depth explanation of plugins in RTW/BI/Alex


    Complete Guide to Plugins for RTW
    By: Squid & Gotthard

    This post is a reproduction of the article I originally posted at the org. The original article is located here and in case of discrepency, the original article should be taken as the definitive version.


    Quote Originally Posted by JeromeGrasdyke
    The plug-ins system is legacy from early in development. The code is still there to allow you to specify building plug-ins, but there is no display for them in the game anymore, which means that you cannot see wether any are built, build new ones through the UI, or look at any descriptions on the campaign map. Certainly the AI won't build them if you were to add some to the game... Best to just stick to buildings and upgrades, really
    Up until now, this quote from Jerome was taken as gospel, plugins are legacy code and do not work. I didn't quite buy this because there's a lot about plugins that he doesn't say cannot be done. He says you can add the code to specify them, he doesn't say they can't be built, just you can't build them through the UI. It seems no one wanted to look into what actually could be done with the plugin system. The answer is lots.

    I originally started figuring our what could be done with plugins while trying to figure out how I could tweak the core_building tree. This fell by the way side as other projects and priorities came up. Then Gotthard joined the RS team and he asked what appeared to be an innocent question about plugins as we were discussing what we were discovering by exploring the .exe files, and my previous work suddenly jumped out at me. Between the two of us the following is what we have so far discovered, and I'm pretty sure there will be more, how much who knows but we'll see.


    Plugins in EDB

    First if you are unfamiliar with the EDB (export_descr_buildings.txt), I suggest you read the Guide: The Completed Guide to EDB written by Dol Guldur.

    To attach a plugin to a building you need to add the correct code to the plugin sections of the building you want the plugin associated with.


    Code:
        plugins 
        {
        }
    Code similar to this is what you find at the end of every building tree. The following code is what you'd add the enable a 1 level bowyer plugin.

    Code:
        plugins bowyer
        {
            bowyer
            {
                    levels bowyer
                    {
                            bowyer requires factions { roman, }
                            {
                                    building_min practice_field
                                    construction  2 
                                    cost  2500 
                                    settlement_min village
                                    upgrades
                                    {
                                    }
                            }
                    }
            }
        }
    On the plugins line is the list of plugins associated with the building tree. After that each plugin is specified like a building, with two key differences, there's no capability section, and there's the new building_min line. The building_min line specifies what level of the corresponding building is required to be able to build that level of the plugin.

    Plugins in export_buildings.txt

    Similar to buildings, it appears you need the same text extries for each plugin and plugin level. Each plugin needs a _name entry and each level needs its three entries. An errorless CTD results if any of these are missing.

    Code:
    {bowyer_name}
    Bowyer
    
    {bowyer}    Bowyer
    
    {bowyer_desc}
    WARNING! This baseline description should never appear on screen!
    
    {bowyer_desc_short}
    WARNING! This baseline short description should never appear on screen!
    
    Plugins in descr_stat.txt

    The key to being able to use plugins is getting them into the game, to add a plugin to a building you'll use code like the following:

    Code:
        building
        {
            type missiles practice_field
            plugin bowyer bowyer
        }
    Plugins and Scripts:

    The create_building console command can be extended to place a plugin into a settlement using the following sytax:

    console_command create_building practice_field bowyer

    This will add a practice_field with a bowyer plugin to the settlement.

    Plugins and Conditions:

    GovernorPlugInExists works as expected
    GovernorPlugInFinished hasn't been tested for functionality yet (I'm not sure if building with a console command would trigger this condition or not)

    Known factors:
    • Upgrading a building with a plugin does not destroy the plugin
    • 9 plugins per building tree
    • 9 levels per plugin

    Uses:
    • Can be used to store/pass additional information about settlements/regions to other files such as traits/ancillaries (e.g. every region with iron gets an iron plugin, etc to pass information about resources/hidden resources).
    • Simplify tests to determine where on the map the character is (e.g. if you want to know if a character is in greece you create a greece plugin and add it to all settlements in greece in descr_stat)
    • Dramatically increases the trait customization that can be done (use to add traits based on control, after x turns of control remove the original cultural plugin and replace with a new one for the new faction)
    • Others I'm sure that will be though of

    Unknowns:
    • As yet unknown how to link building capabilities and/or construction to presence of a plugin, if this is discovered the number of uses drastically increases, even if building through the UI can't be enabled (e.g. extra virtually unlimited hidden_resources, used for reform type script events, etc)
    • Can a building have more than one plugin
    Last edited by Squid; October 15, 2011 at 09:08 PM.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  2. #2
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Guide: The Complete Guide to Plugins

    Not sure why no one's replied yet. This thread is really excellent!


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  3. #3
    Kylan271's Avatar Domesticus
    Join Date
    Jul 2007
    Location
    Vietnam
    Posts
    2,235

    Default Re: Guide: The Complete Guide to Plugins

    I am not conversant in computing or modding so much,but it seems detailed and appreciate the effort into helping the game. Good work,i will see how this can help make the game more enjoyable..^_*

  4. #4
    Kundich's Avatar Ordinarius
    Join Date
    May 2007
    Location
    Knoxville, TN
    Posts
    742

    Default Re: Guide: The Complete Guide to Plugins

    I haven't had any luck accessing GovernorPluginExists from a campaign script, so that looks like a no-go for tying it to the EDB via counters directly. Also, there does not seem to be any way to reference the plugin directly in the EDB.

    Perhaps by acquiring a trait based on a plugin presence could allow a counter to be set to true, which in turn allows a building to be built. We know that each individual element is possible. The real downside of this is that you need to specify one counter per settlement and set script elements to check each potential settlement's governor. It's not hard, just takes a lot of keystrokes. The other downside is that you probably want to remove the trait every time the governor ends his turn outside the settlement. Lots more keystrokes, but this engine can handle loads of traits and triggers.


    Thanks,
    ADM

  5. #5

    Default Re: Guide: The Complete Guide to Plugins

    Quote Originally Posted by SquidSK View Post
    Unknowns:
    • As yet unknown how to link building capabilities and/or construction to presence of a plugin, if this is discovered the number of uses drastically increases, even if building through the UI can't be enabled (e.g. extra virtually unlimited hidden_resources, used for reform type script events, etc)
    Is there maybe someone who has figured this already?
    This would be soo extremely useful..

    I have had some tests already (together with Anallein) with many different possibilities to require a plugin, based on how buildings are required.
    I for example tested "requires plugin_present_min_level" and such...
    But without any result...

    Maybe digging in the .exe reveals some stuff?

    Great find!

  6. #6
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,760
    Blog Entries
    3

    Default Re: Guide: The Complete Guide to Plugins

    Quote Originally Posted by PatricianS View Post
    Is there maybe someone who has figured this already?
    This would be soo extremely useful..

    I have had some tests already (together with Anallein) with many different possibilities to require a plugin, based on how buildings are required.
    I for example tested "requires plugin_present_min_level" and such...
    But without any result...

    Maybe digging in the .exe reveals some stuff?

    Great find!
    Although it hasn't been worked on in a bit (RS2 is taking precedence on my time right now), we examined the exe but were unable to come up with anything that would work.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  7. #7

    Default Re: Guide: The Complete Guide to Plugins



    It would have been such a nice tool...

    I understand RS2 is more important to you at the moment

  8. #8
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,760
    Blog Entries
    3

    Default Re: Guide: The Complete Guide to Plugins

    By the way, just because we haven't found it doesn't mean it doesn't exist, so if you find something let us know and I'll be happy to include it in the guide.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  9. #9

    Default Re: Guide: The Complete Guide to Plugins

    You'll be the first to know

  10. #10

    Default Re: Guide: The Complete Guide to Plugins

    Ok, I haven't found anything (tried lots of possibilities some time back together with Anallein), but none of them worked

    Did anyone else try/have more success?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •