1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Quick Modding Questions Thread

Discussion in 'Mod Creation Help' started by Leyrann, Oct 28, 2018.

  1. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,690
    Gender:
    Male
    Location:
    Warsaw
    Question about Goody Hut rewards.
    Where are the amounts of rewards defined? Specifically: amount of gold, amount of faith, number of units granted (builder, etc.), how much a unit is healed, amount of experience.
     
  2. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
  3. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,690
    Gender:
    Male
    Location:
    Warsaw
  4. Red Key

    Red Key Modder

    Joined:
    Sep 24, 2011
    Messages:
    412
    Gender:
    Male
    Location:
    USA
    In LUA, how can I tell if a city was conquered, loyalty-flipped, or traded? (I think that covers all ways city ownership can change) I want to update my Key Loyalties mod for Dramatic Ages which appears to make loyalty-flipping much more common. For cities where the current owner is not the original owner, I want the ongoing max loyalty penalty to be different depending on how the city was acquired.
     
  5. Autissimo

    Autissimo Chieftain

    Joined:
    Sep 18, 2020
    Messages:
    7
    Maybe a stupid question, but I looked all around and couldn't find the answer to this:
    How do I actually include a sound file in a mod?
    Everyone says to not include the .wem in modbuddy, but where does it go then? Do I, after building the mod, manually stuff it in the /Platforms/[OS]/Audio?

    Also, should I even use modbuddy? Most resources here seem to work without it... Sorry, I am really new to civ 6 modding, and this whole thing isn't exactly easy for me to wrap my slow brain around .-.

    Edit:

    Whoops didn't see LeeS' modding guide, since I only scoured through the "modding tutorial" part of the forum, and not the top-level pinned posts.

    Well, turns out there is at least some documentation on what to do after all. Time to read through 400 pages I guess.
     
    Last edited: Sep 19, 2020
  6. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
    Code:
    local eLastTransferType = City:GetLastTransferType();
    if (eLastTransferType == CityTransferTypes.BY_GIFT) then
    	--do something here
    end
    You have to have to have the city object first, and it is not known whether the GetLastTransferType method is only valid in User Interface scripts.

    Firaxis only uses "CityTransferTypes.BY_GIFT" in their lua files so it is not clear what the designations for the other transfer types will be. But "CityTransferTypes.BY_GIFT" should actually just be a variable holding an integer value, so it should be possible to write a script that looks at transfers of cities and records into the lua log the GetLastTransferType data whenever a city changes ownership. From there you should be able to work out what the actual integer values are for a gift, loyalty-flip, conquest, etc.

    Your real problem will be in transferring this information from a User Interface script to a Gameplay Script if the GetLastTransferType method is only valid in User Interface. This can be cured by using the ExposedMembers system. A search through the forum for "ExposedMembers" ought to lead you to the info you will need if GetLastTransferType is only valid in User Interface.

    Alternatively, there are hook events for:
    Code:
     GameEvents.CityConquered(newPlayerID, oldPlayerID, newCityID, iCityX, iCityY)
    Events.CityTransfered(playerID, cityID)
    Events.CulturalIdentityCityConverted(playerID, cityID, iFromPlayer)
    Events.CulturalIdentityConversionOutcomeChanged(playerID, 	cityID, eOutcome)
    You can make your script run whenever one of these events triggers in the game and record the necessary information for later use.
     
    Red Key likes this.
  7. raen

    raen Coat of Arms

    Joined:
    May 12, 2003
    Messages:
    2,289
    Location:
    Portugal
    If you only want to edit music you dont need modbuddy. But using it, you simply create platforms/<OS>/audio folders in your modbuddy project, add your files, and you are good to go.
     
    Autissimo likes this.
  8. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
  9. Autissimo

    Autissimo Chieftain

    Joined:
    Sep 18, 2020
    Messages:
    7
    Oh wow, .-. I tried to look at sukritact's mods to find out how it worked, and I just couldn't figure it out.

    Thank you very much for the answer, finally works now.
     
    raen likes this.
  10. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,351
    Location:
    France
    you can try
    Code:
    for k, v in pairs(CityTransferTypes) do print (k, v) end
     
    Red Key likes this.
  11. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
  12. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
    This code
    Code:
    for k,v in pairs(CityTransferTypes) do
    	print("CityTransferTypes : k = " .. k .. ", v = " .. v)
    end
    Gives this result in the lua log
    Code:
    CityTransferTypes : k = BY_GIFT, v = -1821839791
    CityTransferTypes : k = BY_LIBERATION, v = 361156668
    CityTransferTypes : k = BY_CULTURAL_IDENTITY, v = -738490196
    CityTransferTypes : k = BY_COMBAT, v = -1173539618
    So the four available city transfer types are as:
    Code:
    CityTransferTypes.BY_GIFT
    CityTransferTypes.BY_LIBERATION
    CityTransferTypes.BY_CULTURAL_IDENTITY
    CityTransferTypes.BY_COMBAT
    My unfounded assumption would be that "CityTransferTypes.BY_GIFT" would encompass any sort of diplomatic deal wherein a city ownership is transfered.
     
    Red Key likes this.
  13. Alexandre Torres

    Alexandre Torres Chieftain

    Joined:
    Sep 7, 2020
    Messages:
    3
    Gender:
    Male
    Location:
    Brazil
    HI.
    Is it possible in the LUA script to add culture to the city? I want to accelerate the city growth by adding culture. I can add plots with "WorldBuilder.CityManager():SetPlotOwner" BUT it will not increase the plot culture cost (at least, it was the result of my test). I'm creating city mover mod that actually copies the information from source city to destination city. Currently, culture seems to be difficult to change by lua script. Coundn't find city.GetCulture().ChangeCulture or something like that.

    related methods:
    City:GetCulture():GetNextPlotCultureCost()
    City:GetCulture():GetCurrentCulture()
     
  14. Zechnophobe

    Zechnophobe Strategy Lich

    Joined:
    Sep 1, 2006
    Messages:
    1,867
    Location:
    Goleta, California
    A few quick questions, mostly just feeling out feasibility of a few things while I start to learn how to mod:

    1. I want to make a trade route generate power
    2. My mod had a problem while creating a new game. Which logs should I be looking at?
    3. I want to implement a civ 5 esque system where I have a new custom resource, and that limits how many of a certain class of unit that can be built. Is the best way to just some kind of upkeep cost?
    4. Expand city radius to > 3 hexes? Or less than 3?
    5. Make units with a limited lifespan (aka number of turns before death).

    Are these things doable? Require a lot of scripting? Easy? Please and thank you for any help.
     
  15. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,351
    Location:
    France
    2 -> Modding, Database and Lua logs. cross-check the timestamp in database and modding when there is an error reported to identify the file.
    4 -> impossible with the current tools AFAIK
    5 -> can be done with a bit of Lua scripting
     
  16. the_jp

    the_jp Chieftain

    Joined:
    Aug 12, 2006
    Messages:
    19
    Any thoughts on what I may be doing wrong here when trying to use updates on the Moments table (via an UpdateDatabase action):

    Code:
    <GameData>
        <Moments>
    
            <Update>
                <Where MomentType="MOMENT_BARBARIAN_CAMP_DESTROYED" />
                <Set Name="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_JP" Description="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_DESCRIPTION_JP" InstanceDescription="MOMENT_BARBARIAN_CAMP_DESTROYED_INSTANCE_DESCRIPTION_JP"/>
            </Update>
    
            <Update>
                <Where MomentType="MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY" />
                <Set Name="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_JP" Description="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_DESCRIPTION_JP" InstanceDescription="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_INSTANCE_DESCRIPTION_JP" />
            </Update>
    
        </Moments>
    </GameData>
    
    ...and then adding the associated LocalizedText (via an UpdateText action):

    Code:
    <GameData>
        <LocalizedText>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_JP" Language="en_US">
                <Text>Test 1</Text>
            </Row>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_DESCRIPTION_JP" Language="en_US">
                <Text>Test 2</Text>
            </Row>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_INSTANCE_DESCRIPTION_JP" Language="en_US">
                <Text>Test 3</Text>
            </Row>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_JP" Language="en_US">
                <Text>Test 4</Text>
            </Row>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_DESCRIPTION_JP" Language="en_US">
                <Text>Test 5</Text>
            </Row>
    
            <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_NEAR_YOUR_CITY_INSTANCE_DESCRIPTION_JP" Language="en_US">
                <Text>Test 6</Text>
            </Row>
    
        </LocalizedText>
    </GameData>
    
     
  17. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,939
    Location:
    Illinois, USA
    1st:

    Code:
    InstanceDescription="MOMENT_BARBARIAN_CAMP_DESTROYED_INSTANCE_DESCRIPTION_JP"
    vs
    Code:
    <Row Tag="LOC_MOMENT_BARBARIAN_CAMP_DESTROYED_INSTANCE_DESCRIPTION_JP"
    2nd:

    What is your LoadOrder setting for the UpdateDatabase Action ?
     
  18. the_jp

    the_jp Chieftain

    Joined:
    Aug 12, 2006
    Messages:
    19
    Perfect, Lee. I don't know how I missed the first one, and this was the first time I've used LoadOrder, but I looked up a few of your posts about it, set it, and now everything is good. Thanks!
     
  19. Autissimo

    Autissimo Chieftain

    Joined:
    Sep 18, 2020
    Messages:
    7
    Ok, after trying to figure out how to make a leader use voice clips by looking at Sukritact's mods to see what hierarchy I would have to make in wwise, but I just can't do it.
    Is there any written source on how to do this?
     
  20. Sytharin

    Sytharin Chieftain

    Joined:
    Mar 28, 2020
    Messages:
    3
    Has anyone been able to discover more information on the Secret Societies invitations? Specifically, how each member reduces the invitation rate? I have located the Discovery chances in the SecretSocieties table, but setting those to 100 did not have an impact. Will attempt setting them to higher than 100

    Update: Setting them to 999 seems to have the intended effect, no one has since had issues claiming them in multiplayer
     
    Last edited: Oct 4, 2020

Share This Page