Results 1 to 8 of 8

Thread: [.Lua] Add treasury or researched tech?

Hybrid View

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

    Default [.Lua] Add treasury or researched tech?

    Hello, I wondered if anyone could tell me how I could add treasury to a faction using a lua script, or add researched technologies.

    I know of the scripting.game_interface:treasury_mod("fac_name", 10000); thingy but I can't seem to get it to work. Please help!

    Thanks.

  2. #2
    Inevitability won
    Patrician Citizen

    Join Date
    Mar 2010
    Posts
    9,594

    Default Re: [.Lua] Add treasury or researched tech?

    Where are you using the function?

    What are you using as the faction name?

  3. #3

    Default Re: [.Lua] Add treasury or researched tech?

    I've put my custom .lua file in the lua_scripts directory, and I've used the names that's in the factions table. att_fact_gauti, att_fact_juti etc.

  4. #4
    Inevitability won
    Patrician Citizen

    Join Date
    Mar 2010
    Posts
    9,594

    Default Re: [.Lua] Add treasury or researched tech?

    Well you're using the function correctly, just not in the right place.

    I'd suggest that if it's just a small personal mod you edit the factions scripting of the main_attila campaign, put the function within either the "start_game_for_faction" function or the "faction_new_sp_game_startup" function, depending on if you want the function called once at the start of the campaign or on every time it loads.

    You can find these here:
    data.pack/campaigns/main_attila/factions/whateverfaction.lua

    However you'll have to use the function like this:
    cm:treasury_mod("fac_name", 10000);
    Due to the way these files work.

  5. #5

    Default Re: [.Lua] Add treasury or researched tech?

    I see, thanks man! Also, do you know if there is any way to limit a table to a specific faction?

    Example: I edit building_levels, but I only want the Jutes to be affected by the changes, or the player faction and not the AI.

    And I saw in your Lua Game Functions thread the function "unlock_technology". Do you know if this could be used to let a faction start with finished technologies? Because as the way is now, I have to edit it in the startpos.esf file, and add every single of the 40-60 technologies if I want them to be researched at new campaign.

    Thanks!

  6. #6
    Inevitability won
    Patrician Citizen

    Join Date
    Mar 2010
    Posts
    9,594

    Default Re: [.Lua] Add treasury or researched tech?

    Unfortunately both of what you want is impossible.

    You can't limit a table to a certain faction, you'd just have to make the changes specific to only that factions buildings, and if they don't have any buildings that aren't shared you'd have to make them.

    The unlock_technology function only allows you to unlock techs that are locked with the lock_technology function.

  7. #7
    Litharion's Avatar Artifex
    Join Date
    Sep 2013
    Location
    Germany
    Posts
    2,622

    Default Re: [.Lua] Add treasury or researched tech?

    Quote Originally Posted by .Mitch. View Post

    The unlock_technology function only allows you to unlock techs that are locked with the lock_technology function.
    finally a function to unlock techs....

  8. #8

    Default Re: [.Lua] Add treasury or researched tech?

    Ah, okay. Thanks for the help, Mitch. Really appreciate it!

Posting Permissions

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