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

Few More Buildings for VP

Discussion in 'Mods Repository' started by Asterix Rage, Nov 22, 2019.

  1. Soupy Delicious

    Soupy Delicious Warlord

    Joined:
    Jul 31, 2017
    Messages:
    106
    Gender:
    Male
    Haha. Well, your honesty is as appreciated as the tasty artworks

    My whole life is a lie!
     
    Kim Dong Un likes this.
  2. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    @gwennog I heard your Ski Resort is not compatible with Trade Opportunities. Here is what you have to add to it to be:
    upload_2020-12-9_22-21-9.png
    Can you verify it? It should look like this:
    Spoiler Help texts for luxuries: :


    This is also note is for anyone who is adding nw luxury resource in VP modmod.
     
    Last edited: Dec 9, 2020
    Asterix Rage likes this.
  3. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    No problem, I will see this this weekend.
    Sorry for the gene.
     
  4. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France

    Ski Resort corrected but I'm not sure of the result

    Spoiler View 1 :
    upload_2020-12-10_22-15-32.png


    Texts seems OK but resources are unavailable while the civ has it.

    Spoiler View 2 :
    upload_2020-12-10_22-18-5.png


    shown by monopoly view

    Spoiler View 3 :
    upload_2020-12-10_22-20-35.png
     
  5. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    Ski Resort V1.2

    Problem with Trade Opportunities corrected, I hope so.
     

    Attached Files:

  6. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    Can you check if the same "unavailable" problem is with the Tern Egg from More Wonders or some resources from Even More Resources? I have no computer now, so I cannot check that by myself :( Download latest TOfVP version.
     
  7. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    • Write "Monopoly Bonus". It's important for the code.
    • And if there's no bonus, write simple: none. It saves the screen area if there are more luxuries on the list. Less text is better. You can see it on my previous post with Spoiler.
    1. Maybe mod load order affects this? Check if mods adding resources are loaded before TO.
    2. How the Shrimp resource works? Is it placed on map?
    3. If you have some spare time and want to check what's going on then you can do one more thing for me. "Unavailable" status is set when this code (in /UI/DiploTradesStatus.lua file):
    Code:
    if IsAvailableLuxury(eResource) and IsVisibleUsefulResource(eResource, pActivePlayer) then
    returns false, so either resource is not on the overall list of available resource or is not treated as visible (player must have it or be near it). You can print out (one line earlier put
    Code:
    print(eResource, IsAvailableLuxury(eResource), IsVisibleUsefulResource(eResource, pActivePlayer))
    ) to see which one of those two returns false and see it in lua.log. But first check Tern Egg and Even More Resources if possible.
    • eResource in log is id of resource. Must be checked in SQLite. Check for both resources (Shrimp, Muled Wine).
    • if second parameter is false then check why it is false in the same way;
    Code:
    if IsPlayerHasResource(pPlayer, eResource) or IsPlayerNearResource(pPlayer, eResource) then
    

    If something is wrong I will think of solution.
    Crap, I want my comp back :(
     
    Last edited: Dec 10, 2020
  8. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    Dear Adan,

    I will test all your ask this WE but just a first observation, when I reload in a game, all it's OK after.

    Spoiler Before reload :
    upload_2020-12-12_10-39-1.png


    Spoiler After Reload :
    upload_2020-12-12_10-39-47.png
     
    adan_eslavo likes this.
  9. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    Shrimp are place on map by lua

    Spoiler Code :
    Code:
    function C15_Senshi_SeaResources(playerID, plotX, plotY)
        local player = Players[playerID]
        if (not player:IsAlive()) then return end
        if (not HasTrait(player, traitCajunID)) then return end
        local plot = Map.GetPlot(plotX, plotY)
        local city = plot:GetPlotCity()
       
        local tPlots = {}
       
        for adjacentPlot in PlotAreaSweepIterator(plot, 3, SECTOR_NORTH, DIRECTION_CLOCKWISE, DIRECTION_OUTWARDS, CENTRE_EXCLUDE) do
            if (adjacentPlot:GetOwner() == -1 or adjacentPlot:GetOwner() == player:GetID()) then
                if ((adjacentPlot:IsCoastalLand() and adjacentPlot:GetFeatureType() == GameInfoTypes.FEATURE_MARSH) or (adjacentPlot:GetTerrainType() == GameInfoTypes["TERRAIN_COAST"] and adjacentPlot:GetFeatureType() == -1) or adjacentPlot:GetFeatureType() == GameInfoTypes["FEATURE_LAKE_VICTORIA"]) and adjacentPlot:GetResourceType() == -1 then
                    table.insert(tPlots, adjacentPlot)
                end
            end
        end
       
        if #tPlots > 0 then
            local tRandom = {1,2,2,2,2,2,3,3}
    
            local iRandom = tRandom[JFD_GetRandom(1, #tRandom)]
            if iRandom > #tPlots then iRandom = #tPlots end
    
            for iNum = 1, iRandom do
                local iPlot = JFD_GetRandom(1, #tPlots)
                local plot = tPlots[iPlot]
                plot:SetResourceType(resourceShrimpID, 1)
                table.remove(tPlots, iPlot)
    
                if player:IsHuman() then
                    local sResource = Locale.ConvertTextKey("TXT_KEY_RESOURCE_SHRIMP")
                    local sCity = city:GetName()
    
                    local sTooltip = Locale.ConvertTextKey("TXT_KEY_MISC_YOU_DISCOVERED_RESOURCE", sResource, sCity)
                    local sTitle = Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_SUMMARY_FOUND_RESOURCE", sResource)
                    player:AddNotification(NotificationTypes.NOTIFICATION_DISCOVERED_LUXURY_RESOURCE, sTooltip, sTitle, plot:GetX(), plot:GetY(), resourceShrimpID, -1)
                end
               
            end
        end  
    
    end
    
    GameEvents.PlayerCityFounded.Add(C15_Senshi_SeaResources)


    When Shrimp appear, print test returns : Nil True
    Resource is not on the overall list of available resource :undecide:

    It's OK, available and visible

    Resources placed at the start of the game or by a building are OK.
    But since a reload makes a resource added by lua available, is that it's correctly introduced in the SQL base (I checked, it's the case) but either something is missing in my code, or it there is a bug. Do you have an idea?
     
    adan_eslavo likes this.
  10. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    It creates the list on game launch and unfortunately code cannot check lua stuff. So after restart table is recreated when resource is already placed on map (not only virtually in lua) so it becomes correctly processed. I will look into this.

    What about Muled Wine?
     
  11. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    Can be a way to enter the resource into the table when civilization loads, at start.
    I want to try 4UC and saw that the Inca have a luxury resource (Coca) added by lua, should that be the same problem?

    I modified the text as requested but I haven't tested, it is the same functionality as Tern Egg so it should work.
    On the other hand it starts after TO, I will ask to @Asterix Rage if we can assign a number to the pack like (10) -
     
    adan_eslavo likes this.
  12. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    Ski Resort V1.3

    Problem with Trade Opportunities corrected
     

    Attached Files:

    adan_eslavo likes this.
  13. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,446
    What do you mean?

    EDIT: Yes..(10a)
    But I wondering if (10a) is load before (2) ? tested?
     
  14. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    Code checkes resources on map, added via building (2 sql functions), added via CS and from Civs like Indonesia.

    This can be no relation to load order.
    Indonesia is a value in the resource table for pepper etc. in the civ column if I recall correctly. If you add this value and it will work, then I will add some info in TO OP.

    I suppose Coca is recognized by building but im not sure.
     
    Last edited: Dec 12, 2020
  15. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,446
    So, what do you decide? (10), (9e) or nothing?
     
  16. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,446
    Also, I believe <Name>Ski Resort for VP</Name> should match with the folder name.

    EDIT. That's what I did with (9a)EAW to have it loaded before modmods
     
  17. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,262
    Gender:
    Male
    Location:
    Łódź, Poland
    I think load order is not dependent on alphabet unfortunately.
     
  18. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,446
    I'm sure of nothing but some test tell me yes... some others tell me no !
     
  19. gwennog

    gwennog Warlord

    Joined:
    May 31, 2015
    Messages:
    267
    Gender:
    Male
    Location:
    France
    After multiple attempts, I almost sure that the alphabet changes the positioning.
    Whether it is the .modinfo name or the mod name in the .modinfo, the ranking effect looks the same.

    Two tests :

    Change just the .modinfo name

    Spoiler change .modinfo name :
    upload_2020-12-12_21-29-57.png


    and lua1.log

    Change just the mod name in the .modinfo

    Spoiler Change just the mod name in the .modinfo :
    upload_2020-12-12_21-34-8.png


    and the lua2.log

    Either way, 10 is not a good idea :nono:
     

    Attached Files:

    • Lua1.7z
      File size:
      5.1 KB
      Views:
      4
    • Lua2.7z
      File size:
      5.1 KB
      Views:
      4
  20. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,446
    Bloody loading order mod. The subject is debated since always without any clear and definitive answer :crazyeye:
     

Share This Page