Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: Guide: The Complete Guide to Plugins

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Guide: The Complete Guide to Plugins

    Has anyone found a way to use these to control unit recruitment as this would mean an aor could easily be created.
    Proud member of the Patria Libera team.

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

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

    Default Re: Guide: The Complete Guide to Plugins

    Use hidden resources for unit AOR. There's no known way to link plugins to anything in EDB.
    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

  3. #3
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    Quote Originally Posted by Squid View Post
    Use hidden resources for unit AOR. There's no known way to link plugins to anything in EDB.
    Unless scripting is used as the glue perhaps? Use GovernorPluginExists in script to set a bunch of counters (e.g. turn 0) and use those counters in EDB.

    But it would only work for settlements with governors in them If I'm following this correctly.

  4. #4
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Guide: The Complete Guide to Plugins

    Quote Originally Posted by Withwnar View Post
    Unless scripting is used as the glue perhaps? Use GovernorPluginExists in script to set a bunch of counters (e.g. turn 0) and use those counters in EDB.

    But it would only work for settlements with governors in them If I'm following this correctly.
    Event counters can't be applied on a per settlement basis, they're at least factionwide.

  5. #5
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    Yes, I see what you mean. Oh well. Thanks.

    I am a little confused by this comment:

    Quote Originally Posted by SigniferOne View Post
    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)
    Does this mean destroy the entire building tree (across the faction) that contains this plugin and replace with buildings from a different tree that contains the new plugin?

    Or is there some way to destroy/remove individual plugins?
    Last edited by Withwnar; May 27, 2011 at 12:54 PM. Reason: merge

  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    (delete)
    Last edited by Withwnar; May 27, 2011 at 12:55 PM.

  7. #7

    Default Re: Guide: The Complete Guide to Plugins

    I would be extremely beneficial if someone would explain this tutorial a little better with some direct applications in the EDB and in the EDCT. Then we could see an association between what is written as a plugin in the export_descr_buildings to set up the plugin, and then see the way that it is recognized and triggered in the export_descr_character_traits. That would be a much superior tutorial since it would explain the process.

    It looks like we can have special triggers to give traits to units based on them being somewhere, but I don't fathom how that is different then say going to Rome in the EDCT. Maybe it's as described if a character goes anywhere within a kingdom, a trigger could fire, has been to England versus has been to London.

    If that's so, then it might be possible to give all named characters from an entire kingdom special traits using this, but I think that's already possible. I'm just not seeing the potential at all, but I can tell it must be huge based on the posts here. I think shedding a little more light would greatly facilitate using it.

  8. #8
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    I haven't used them yet so I'll skip the EDB part in case I do it wrong. But I can answer the last part: using them for traits. Perhaps someone else can expand on this for a full example.

    Say we have an "english" plugin attached to wall buildings. In descr_strat we could give this plugin to the three England settlements: London, Nottingham and York.

    In EDCT we could have a trigger such as:
    Code:
    Trigger plugin_trigger_1
      WhenToTest CharacterTurnEnd
      
      Condition GovernorPlugInExists = english
    
      Affects Insane 1 Chance 40
    So if he's a governor of an English settlement then there's a chance of going insane.

    Without plugins the only way to do this otherwise would be to have one trigger for each of the three settlements:
    Code:
    ;------------------------------------------
    Trigger plugin_trigger_1
      WhenToTest CharacterTurnEnd
      
      Condition GovernorTaxLevel >= tax_low
        and SettlementName London
    
      Affects Insane 1 Chance 40
      
    ;------------------------------------------
    Trigger plugin_trigger_2
      WhenToTest CharacterTurnEnd
      
      Condition GovernorTaxLevel >= tax_low
        and SettlementName Nottingham
    
      Affects Insane 1 Chance 40
      
    ;------------------------------------------
    Trigger plugin_trigger_3
      WhenToTest CharacterTurnEnd
      
      Condition GovernorTaxLevel >= tax_low
        and SettlementName York
    
      Affects Insane 1 Chance 40
    (GovernorTaxLevel is there just to ensure that this character is a governor, as there is no IsGovernor condition.)

    It's a trivial example but it already helps things by reducing the number of triggers (3 to 1) and conditions (2 to 1). Plus, plugins can be built dynamically via script. So as the English empire expands script could build the plugin in some specific newly-conquered settlements and that single trigger will automatically work for them.

    But apparently GovernorPlugInExists is the only means of getting the information 'out'. So plugins can only be used for giving traits/ancillaries to governors, not other generals or other character types. And using a plugin as script monitor condition will only work if the settlement has a governor.

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

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

    Default Re: Guide: The Complete Guide to Plugins

    The other thing it can be used for is using resources and hidden_resources outside of EDB without plugins there is no way to know resource information in EDCT/EDA/scripts/etc.
    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

  10. #10
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Guide: The Complete Guide to Plugins

    can you be more specific?? by giving an example?? thanks!!
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

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

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

    Default Re: Guide: The Complete Guide to Plugins

    Read the first post where it quotes my RTW tutorial it tells you how to do it.
    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

  12. #12

    Default Re: Guide: The Complete Guide to Plugins

    This is great, if I understand correctly.

    I would like to create a technology system based on creating a building randomly assigned to a settlement in campaign script using:
    Code:
    console_command construct_building *building* *plugin*
    If these plugin buildings give an ancillary to a governor, could this ancillary then be used to enable a new building in the EDB, perhaps using an event counter with FactionwideAncillaryExists?

    If so then could a spy or another agent be given an ancillary from a plugin?

    ..or is there a simpler method to use the plugin this way without creating an event counter in the script?
    Last edited by sputnik; August 14, 2011 at 07:03 PM.

    Luck is the residue of design ~ Milton

  13. #13
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    I believe so but the counter is global, not specific to that settlement or faction, meaning that any settlement will now have the ability to build the new building. In which case you might be better off just bypassing the plugin and anc parts altogether and just randomly set the counter directly.

    Unless you particularly want to have the anc of course. But ancs have a limit of 8 per character so there's the risk that the governor will never get this new one. You could use a trait instead.

    Agents: no, only a governor can be used for this because the only plugin events are GovernorXXX ones.

  14. #14

    Default Re: Guide: The Complete Guide to Plugins

    believe so but the counter is global, not specific to that settlement or faction, meaning that any settlement will now have the ability to build the new building. In which case you might be better off just bypassing the plugin and anc parts altogether and just randomly set the counter directly.
    Damn I suppose it would be better just to set the counter directly.

    My idea was also to have characters spreading technology using ancillaries or traits, I wanted to know if these could be linked somehow to the EDB.

    Is there any simple way that a character with a specific trait or ancillary - lets say 'advanced metalworking knowledge' - can enable a building in a non-specific settlement where the character ends their turn.

    Luck is the residue of design ~ Milton

  15. #15
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    Dabbling with plugins I have a few findings...

    building_min seems to have no effect. It must be a level within the same tree as the plugin but using a level that is higher than what is currently in the settlement does not prevent the plugin from being built. This applies to both descr_strat (DS) and campaign_script (CS).

    Similarly for settlement_min. The plugin may be built regardless of the settlement's current size and the settlement_min value.

    When I do it with CS the plugin is being built automatically when I don't specify one. DS works as expected (no plugin present unless a "plugin" line is added).

    For example, I added a flagpole plugin to the city_hall tree...

    Code:
    plugins flagpole
    {
      flagpole
      {
          levels flagpole
          {
              flagpole requires factions { england, }
              {
                  building_min town_hall
                  construction 2 
                  cost 2500 
                  settlement_min village
                  upgrades
                  {
                  }
              }
          }
      }
    }
    Then in CS...
    Code:
    monitor_event FactionTurnStart TrueCondition
      console_command create_building London town_hall 
    terminate_monitor
    end_monitor
    
    monitor_event CharacterTurnStart GovernorPlugInExists = flagpole
      historic_event first_windmill
    end_monitor
    The historic event (HE) is just for simplicity; I tried it with trait triggers too.

    At the start of turn 2 I got the HE even though I have not told it to build the flagpole plugin. And the HE does not appear if I don't build the hall, so it's not a problem with the "show HE" logic.

    By rights I should only get the HE if the script was saying this:

    Code:
    monitor_event FactionTurnStart TrueCondition
      console_command create_building London town_hall flagpole
    terminate_monitor
    end_monitor
    I was wondering if it is built automatically if the plugin's building_min and settlement_min conditions are being met. But when I changed them to something higher than what the settlement has it behaved the same way.

    I haven't tried it with having more than one plugin in the tree (which one would get built?).

    Also the OP says to use construct_building which I took to be a typo. It isn't recognised by the parser (log error). So I'm wondering if there is indeed a separate command (to create_building) for which plugins do work as intended.

  16. #16
    wudang_clown's Avatar Fire Is Inspirational
    Join Date
    Jan 2009
    Location
    Poland
    Posts
    7,357

    Default Re: Guide: The Complete Guide to Plugins

    Quote Originally Posted by Withwnar View Post
    Also the OP says to use construct_building which I took to be a typo. It isn't recognised by the parser (log error). So I'm wondering if there is indeed a separate command (to create_building) for which plugins do work as intended.
    When you look for create_building in kingdoms.exe, you'll find this:

    create_building <settlement_name> <building_level_id> : creates a building of the specified type in a settlement; for building level id's see export_descr_building.txt

    In Docudemons create_building is console command, so it will work only as console_command create_building.

    Under the patronage of m_1512

  17. #17
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    Thanks, I realise that: I am using "console_command create_building" in my example.

    I am wondering if create_building does in fact take a "plugin" argument, as the OP says:
    The create_building console command can be extended to place a plugin into a settlement using the following sytax:

    console_command construct_building practice_field bowyer
    Again, assuming that "construct_" was a typo and should have been "create_". I just realised that this doesn't mention a settlement name either.

    Also, the fact that the docudemons don't mention the plugin argument suggests that there is no plugin argument. This could simply be an oversight by the demons' author. But if the .EXE doesn't mention it internally either (is that what you meant?) then it looks like it isn't there.

    EDIT: oh, wait. The original plugin tutorial was for RTW. Was construct_building a valid RTW command? Hmm, in that case maybe this plugin argument only exists in RTW, not M2TW's create_building.

    EDIT: ah yes, the original original tutorial (org) has been corrected to "create_building".

    Additionally, it's discussion thread mentions that plugins cannot be destroyed by script. I was tinkering with this myself: using destroy_building will destroy the building tree and its plugins but there is no way to just destroy the plugin (as far as I know).

    I have added a few more plugins to see what happens...

    The city_hall tree has three plugins, one of which (office) is an upgrade of another (flagpole). The other one (latrine) is in its own plugin 'tree'.
    Code:
    plugins hall_plugins hall_plugins2
    {
      hall_plugins
      {
          levels flagpole office
          {
              flagpole requires factions { england, }
              {
                  building_min town_hall
                  construction 2 
                  cost 2500 
                  settlement_min village
                  upgrades
                  {
                   office
                  }
              }
              office requires factions { england, }
              {
                  building_min town_hall
                  construction 2 
                  cost 2500 
                  settlement_min village
                  upgrades
                  {
                  }
              }
          }
      }
      hall_plugins2
      {
          levels latrine
          {
              latrine requires factions { england, }
              {
                  building_min town_hall
                  construction 2 
                  cost 2500 
                  settlement_min village
                  upgrades
                  {
                  }
              }
          }
      }
    }
    Monitors to show different historic events:
    Code:
    monitor_event CharacterTurnStart GovernorPlugInExists = flagpole
      historic_event first_windmill
    end_monitor
    
    monitor_event CharacterTurnStart GovernorPlugInExists = office
      historic_event earthquake_in_aleppo
    end_monitor
    
    monitor_event CharacterTurnStart GovernorPlugInExists = latrine
      historic_event science_alchemy_book
    end_monitor
    If I do this...
    Code:
    console_command create_building London town_hall
    ... then the flagpole and latrine HEs are seen. Putting any of the three plugins after the "town_hall" in this command made no difference.

    i.e. It would seem that create_building always auto-builds the first level of all plugins in the building's tree. There is no way to prevent it and no way to build higher levels (upgrades) with script.

    But I was able to build just the office with DS using:
    Code:
    building
    {
      type city_hall town_hall
      plugin hall_plugins office
    }
    Here are the export_buildings entries in case anyone wants to try this themselves:
    Spoiler Alert, click show to read: 
    Code:
    {flagpole_name}Flag Pole
    {flagpole}Flag Pole
    {flagpole_desc}WARNING! This baseline description should never appear on screen!
    {flagpole_desc_short}WARNING! This baseline short description should never appear on screen!
    {office_name}Front Office
    {office}Front Office
    {office_desc}WARNING! This baseline description should never appear on screen!
    {office_desc_short}WARNING! This baseline short description should never appear on screen!
    {latrine_name}Latrine
    {latrine}Front Latrine
    {latrine_desc}WARNING! This baseline description should never appear on screen!
    {latrine_desc_short}WARNING! This baseline short description should never appear on screen!
    Last edited by Withwnar; October 14, 2011 at 04:23 AM.

  18. #18

    Default Re: Guide: The Complete Guide to Plugins

    So, if my understanding of the is thread is correct, I could use plugins do something like:

    1) make a plugin in EDB for core buildings , e.g. "camels"
    2) put that plugin in each region with with trade resource camels in DS
    3) make a trait "hates the smell of camels" in EDCT or an ancillary "camel breeder" in EDA
    4) trigger these using the condition GovernorPluginExists so that a general in a settlement in regions with camels could acquire them

    Is this correct?

  19. #19
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Guide: The Complete Guide to Plugins

    Yep.

  20. #20
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,568

    Default Re: Guide: The Complete Guide to Plugins

    Find original thread at .org and posted in EDB Guide thread on TWC before met this one.

    So now we know that event_counters could be settlement specific, not only factionwide.

    Another idea - read here that plugin's first level automatically built with main building construction. What if we set condition for plugin building possibility? So this could give us possibility to choose if plugin will be constructed or not.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Page 2 of 2 FirstFirst 12

Posting Permissions

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