Page 5 of 5 FirstFirst 12345
Results 81 to 100 of 105

Thread: The S2 Script-o-Rama

Hybrid View

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

    Default Re: The S2 Script-o-Rama

    Another quick answer (again, more detail later tonight).

    First, the function is CampaignUI.RegionsOwnedByFactionOrByProtectorates (it was updated after Empire), not CampaignUI.RegionsOwnedByFaction as documented in the OP here. But I'm guessing you didn't look at the documentation here because:
    Second, the argument is a faction key, not context. Even if you were using context, you'd need to get context.string from a Faction event context.
    My Tools, Tutorials and Resources

    Was running out of space, so see the full list here!

    Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
    The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell

  2. #2
    Thorn's Avatar Artifex
    Join Date
    Jan 2005
    Location
    Here
    Posts
    2,194

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by T.C. View Post
    Another quick answer (again, more detail later tonight).

    First, the function is CampaignUI.RegionsOwnedByFactionOrByProtectorates (it was updated after Empire), not CampaignUI.RegionsOwnedByFaction as documented in the OP here. But I'm guessing you didn't look at the documentation here because:
    Second, the argument is a faction key, not context. Even if you were using context, you'd need to get context.string from a Faction event context.
    I tried with OrByProtectorates and with faction name, but never both of them, because I thought the problem was elsewhere and because taking into account protecorates will cause some undesired effects in my calculations..

    Thanks for the quick answer I will try those changes asap

    Edit, It works perfect with context.string
    Last edited by Thorn; July 12, 2011 at 03:58 PM.

  3. #3

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by Thorn View Post
    I tried with OrByProtectorates and with faction name, but never both of them, because I thought the problem was elsewhere and because taking into account protecorates will cause some undesired effects in my calculations..

    Thanks for the quick answer I will try those changes asap
    There's a section on logging in the OP here, it can be very useful in nailing down errors. Eg get it to write "I'm at line x" every now and then, when it hits a bug the logging will stop with the rest of the code, and from there you can narrow your search.
    My Tools, Tutorials and Resources

    Was running out of space, so see the full list here!

    Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
    The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell

  4. #4
    Thorn's Avatar Artifex
    Join Date
    Jan 2005
    Location
    Here
    Posts
    2,194

    Default Re: The S2 Script-o-Rama

    Sorry for being a pain in the ass, but I'm trying to improve game experience increasing siege dificulty for human players.

    I would like to avoid garrison scripts to save CPU time with huge functions to take into account several options. In exchange I would like to use techs or resources, so here is my question: Is there a way to add a tech or resource to a faction or province via script?

    Thanks a lot for your unvaluable help.

  5. #5

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by Thorn View Post
    Sorry for being a pain in the ass, but I'm trying to improve game experience increasing siege dificulty for human players.

    I would like to avoid garrison scripts to save CPU time with huge functions to take into account several options. In exchange I would like to use techs or resources, so here is my question: Is there a way to add a tech or resource to a faction or province via script?

    Thanks a lot for your unvaluable help.
    Simply put, no.
    In my betas of EiC v2.0 I'm running externally fed scripts amounting to over 6000 lines of code - with no noticeable lag Admittedly, in places I've had to spend time working on optimisation but in general Lua is a very fast language.
    My Tools, Tutorials and Resources

    Was running out of space, so see the full list here!

    Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
    The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell

  6. #6
    Thorn's Avatar Artifex
    Join Date
    Jan 2005
    Location
    Here
    Posts
    2,194

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by T.C. View Post
    Simply put, no.
    In my betas of EiC v2.0 I'm running externally fed scripts amounting to over 6000 lines of code - with no noticeable lag Admittedly, in places I've had to spend time working on optimisation but in general Lua is a very fast language.
    It's a pity, that could have saved a lot of time.., now we have to take into account each province name, coordinates, attacker, defender and some other variables to spawn an army.. I think I will keep working on other things until I get enough time to spend on that.

    Thanks!
    Last edited by Thorn; July 25, 2011 at 04:26 PM.

  7. #7

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by Thorn View Post
    It's a pity, that could saved a lot of time.., now we have to take into account each province name, coordinates, attacker, defender and some other variables to spawn an army.. I think I will keep working on other things until I get enough time to spend on that.

    Thanks!
    Give me a little more info on what you want, I could probably cut you a few corners
    My Tools, Tutorials and Resources

    Was running out of space, so see the full list here!

    Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
    The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell

  8. #8
    Thorn's Avatar Artifex
    Join Date
    Jan 2005
    Location
    Here
    Posts
    2,194

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by T.C. View Post
    Give me a little more info on what you want, I could probably cut you a few corners
    I need to think more about it, but It will be something like I did with Medieval II

    Spawn several garrison units depending on city development, faction wealth and maybe game turn to make it harder at mid-late game. Those garrisons could be aslo faction dependant so Takeda get more cavalry, Chosocabe more archers, etc etc

    I would like to take into account previous sieges to simulate depopulation after several tries, so it will be necesary some turns before having full garrison again

  9. #9

    Default Re: The S2 Script-o-Rama

    Is there an add_restricted_unit_record equivalent for technologies?

  10. #10

    Default Re: The S2 Script-o-Rama

    I know this is a huge necropost, but I'm wondering if you can change the name of a faction via scripting.

  11. #11

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by Palaiogos View Post
    I know this is a huge necropost, but I'm wondering if you can change the name of a faction via scripting.
    You don't need scripting for that. You can change faction names in factions.loc, located in local_en.pack/text/db. You need to change the string for factions_screen_name_<faction>.
    Wanna play as minor clans from expanded Japan by unamie5? Now you can: http://steamcommunity.com/sharedfile.../?id=428505886

    Shogun 2 in a new light - Historical Shogun 2 Mod

  12. #12

    Default Re: The S2 Script-o-Rama

    As I know, Palaiogos want change faction name in campaign time after completing preciselly conditions. I'm also wondering whether it is possible

    One Ring to rule them all, One Ring to find them,

    One Ring to bring them all, and in the darkness bind them,
    Last Alliance: TW
    Last Alliance: TW on MODDB
    Last Alliance: TW Patreon

  13. #13

    Default Re: The S2 Script-o-Rama

    Well I think you should be able to. Aren't there scripts already that change factions name when one becomes shogun, or the shogunate/imperial vanguard in fots?
    Wanna play as minor clans from expanded Japan by unamie5? Now you can: http://steamcommunity.com/sharedfile.../?id=428505886

    Shogun 2 in a new light - Historical Shogun 2 Mod

  14. #14

    Default Re: The S2 Script-o-Rama

    Quote Originally Posted by Collateral_dmg View Post
    Well I think you should be able to. Aren't there scripts already that change factions name when one becomes shogun, or the shogunate/imperial vanguard in fots?

    Wherever it is, I can't find it in campaigns -> jap_boshin -> scripting.lua. Right now, I'm going to try to make a custom mission, although I can't find a way to make the reward a change of name. I have so many scripting questions... I wish there were more mods in Shogun 2 which change scripts.

  15. #15

    Default Re: The S2 Script-o-Rama

    Hi
    I need help, would be possible to change one building to another (or just destroy this building) by script? I have problem, that in my mod factions use garrison from another military group. It's not vissible in building description, but is visible on flag (and of course, game respawn this units in battle):
    Spoiler Alert, click show to read: 


    So would it be possible to make a script that would work like this:
    If faction la_numenor_kingdom conquer region then change building HAR_Castle_2 to DUN_Castle_2
    and
    If faction la_numenor_kingdom conquer region then destroy building chain HAR_Garrison
    And apply this for all factions and all buildings with garrison?
    Last edited by Sara Temer; April 23, 2020 at 06:21 AM.

    One Ring to rule them all, One Ring to find them,

    One Ring to bring them all, and in the darkness bind them,
    Last Alliance: TW
    Last Alliance: TW on MODDB
    Last Alliance: TW Patreon

  16. #16

    Default Re: The S2 Script-o-Rama

    Looks like creating logs with using a variable that contains the "CampaignUI" function in the TCS_Log_Update() arguments ctd's the game (Fots). Any idea why?

Page 5 of 5 FirstFirst 12345

Posting Permissions

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