WHoward's Pick 'N' Mix Mods

Discussion in 'Civ5 - Mod Components' started by whoward69, Jul 7, 2011.

  1. DarthStarkiller

    DarthStarkiller King

    Joined:
    Jun 2, 2015
    Messages:
    915
    Location:
    Santos, Brazil
    I am sorry? Shouldn't it be using the icon below instead of the Great Engineer's? It's clearly not what's show in the screenshot you provided.

    (Please note you can only get it to look like this if you spawn the unit before Industrial era, in the right era it looks just like your image).
    Tested with your DLL, issue persists. Also, just noticed I said Great Merchant instead of Great Engineer - damn people with brown suits and hats, y'all look the same to me! Sorry about that, still, the error is there.
     
  2. joeandraw

    joeandraw Chieftain

    Joined:
    Apr 20, 2016
    Messages:
    10
    hey,i use DLL - Various Mod Components - 34 Civs for YNAEMP,it replace community patch and i cant get it work with most of JFD mod,is there any compability mod?
     
  3. dilophosaur

    dilophosaur Prince

    Joined:
    Dec 9, 2013
    Messages:
    511
    No. Some JFD's civs require CP to work, but not VMC :)
     
  4. joeandraw

    joeandraw Chieftain

    Joined:
    Apr 20, 2016
    Messages:
    10
    is it different with CP? why VMC replace CP?
     
  5. dilophosaur

    dilophosaur Prince

    Joined:
    Dec 9, 2013
    Messages:
    511
    Yes, it is different. Maybe because of the .dll :p
     
  6. joeandraw

    joeandraw Chieftain

    Joined:
    Apr 20, 2016
    Messages:
    10
    thats too bad,but okay tho ,thanks
     
  7. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    If I use "AI-Smart V3" mod, I don't need the "AI Smart Mod", right?
    Or is a combination good, because the one changes other things than the other? (e.g 'AI_SMART_GRAND_STRATEGY' found in SQL from AI smart)
     
  8. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,590
    Location:
    Near Portsmouth, UK
  9. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
  10. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    Ah... now I see what you ment.. you completly removed the previous AI-Smart Mod from DLL ?!
    You should add a note at your picknmix website, that this mod only works until version 84.

    Was it really necessary to remove it?
    Because a friend of mine recently complaint about AI is lousy at Emperor but unbeatable at Immortal in my modpack. Since the only AI changing thing is the AI-Smart mod the plan now was to let him try AI-SmartV3, and if this is not better, use AI-Smart with only military tactic changes active....
    But that plan is not possible without the choosable parts of Smart-AI mod =/
     
  11. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    About your XP for Scouting mod:

    At the moment this mod changes the database value for every step a recon makes, even if the ScoutXP did not change... right? I think that should be improved that way, that it is only saved, if the value changed.
     
  12. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,590
    Location:
    Near Portsmouth, UK
    Feel free to rewrite it if you have a better approach and/or the time to do it.
     
  13. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    I already did, is not that difficult (maybe there is also a better way)... but it is really important, because every move with a recon unit lags for half a second wich is not good.

    I also thought about removing database and lowering the constant values to minimize loading losses, so no database is needed...


    But I guess the following is something you could add (changes bold, new spaces seems to be messed up...):
    Spoiler :
    Code:
    --
    -- Scouting XP cache helpers
    --
    
    local modDB = Modding.OpenSaveData() -- using database causes a small lag everytime a recon discovers a tile first... we use databse only to not loose scoutingXP when loading a savegame...
    local cachedScoutingXp = {}
    [B]local updateneeded = 0[/B]
    
    function GetKey(iPlayer, iUnit)
    	return string.format("SCOUTING_XP_%i_%i", iPlayer, iUnit)
    end
    
    function GetScoutingXp(iPlayer, iUnit)
    	if (cachedScoutingXp[iPlayer] == nil) then
    		cachedScoutingXp[iPlayer] = {}
    	end
    	
    	if (cachedScoutingXp[iPlayer][iUnit] == nil) then
    		cachedScoutingXp[iPlayer][iUnit] = (modDB.GetValue(GetKey(iPlayer, iUnit)) or 0)
    	end
    	
    	return cachedScoutingXp[iPlayer][iUnit]
    end
    
    function SetScoutingXp(iPlayer, iUnit, iXp, bCommit)
    	cachedScoutingXp[iPlayer][iUnit] = iXp
    	
    	if (bCommit [B]and updateneeded==1[/B]) then
    		-- Calls to modDB are expensive,
    		-- so we save them all up to the movement onto the tile
    		-- as opposed to when every tile is revealed
    		modDB.SetValue(GetKey(iPlayer, iUnit), iXp)
                    [B]updateneeded = 0[/B]
    	end
    end
    
    function ChangeScoutingXp(iPlayer, iUnit, iXp)
            [B]updateneeded = 1[/B]
    	SetScoutingXp(iPlayer, iUnit, GetScoutingXp(iPlayer, iUnit) + iXp, false)
    end
    
    function UpdateScoutingXp(iPlayer, iUnit)
    	local iScoutingXp = GetScoutingXp(iPlayer, iUnit)
    	
    	if (iScoutingXp >= iScoutingXpAccumulated) then
    		local pUnit = Players[iPlayer]:GetUnitByID(iUnit)
    		local iRealXp = math.floor(iScoutingXp / iScoutingXpDivisor)
    		
    		pUnit:ChangeExperience(math.max(0, math.min(iRealXp, iScoutingXpLimit - pUnit:GetExperience())))
    		
    		if (pUnit:GetExperience() >= iScoutingXpLimit) then
    			pUnit:SetHasPromotion(iXpForScoutingPromotion, false)
    			iScoutingXp = 0
    		else
    			iScoutingXp = iScoutingXp - (iRealXp * iScoutingXpDivisor)
    		end
                    [B]updateneeded = 1[/B]
    	end
        SetScoutingXp(iPlayer, iUnit, iScoutingXp, true)
    end
    
    function OnUnitSetXY(iPlayer, iUnit, iX, iY)
    	if (iPlayer >= 0 and iPlayer <= iMaxMajor) then
    		if (Players[iPlayer]:GetUnitByID(iUnit):IsHasPromotion(iXpForScoutingPromotion)) then
    			UpdateScoutingXp(iPlayer, iUnit)
    		end
    	end
    end
    GameEvents.UnitSetXY.Add(OnUnitSetXY)
    
    function OnUnitPrekill(iPlayer, iUnit, _, _, _, bDelay, _)
    	if (not bDelay and GetScoutingXp(iPlayer, iUnit) ~= 0) then
                    [B]updateneeded = 1[/B]
    		SetScoutingXp(iPlayer, iUnit, 0, true)
    	end
    end
    GameEvents.UnitPrekill.Add(OnUnitPrekill)
    
    
    --
    -- Tile reveal event handlers
    --
    
    function OnTileRevealed(iPlotX, iPlotY, iTeam, iFromTeam, bFirst, iPlayer, iUnit)
        if (bFirst and iPlayer >= 0 and iPlayer <= iMaxMajor) then
            if (Players[iPlayer]:GetUnitByID(iUnit):IsHasPromotion(iXpForScoutingPromotion)) then
    			local pPlot = Map.GetPlot(iPlotX, iPlotY)
    			
    			-- Only land or lakes, but not NWs (as they are handled below)
    			if (((not pPlot:IsWater()) or pPlot:IsLake()) and (not pPlot:IsNaturalWonder())) then
    				ChangeScoutingXp(iPlayer, iUnit, iScoutingXpForTile)
    			end
    		end
    	end
    end
    GameEvents.TileRevealed.Add(OnTileRevealed)
    
    function OnNaturalWonderDiscovered(iTeam, iFeature, iX, iY, bFirst, iPlayer, iUnit)
    	if (bFirst and iPlayer >= 0 and iPlayer <= iMaxMajor) then
    		if (Players[iPlayer]:GetUnitByID(iUnit):IsHasPromotion(iXpForScoutingPromotion)) then
    			ChangeScoutingXp(iPlayer, iUnit, iScoutingXpForNW)
    		end
    	end
    end
    GameEvents.NaturalWonderDiscovered.Add(OnNaturalWonderDiscovered)
     
  14. tomoscar

    tomoscar Chieftain

    Joined:
    Feb 11, 2008
    Messages:
    5
    Thanks for these mods. A comment to the tunnel mod: If a unit ends in a tunnel, it is hurt similar to a helicopter that ends on a mountain. This causes caravans who uses a tunnel to get killed. Since yo have no control of a caravan's movement, it would be nice if ending in a tunnel was safe.
     
  15. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Retired Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,869
    Location:
    Leeds (UK)
    Moderator Action: Above post moved to this thread due to it being more suitable here.
     
  16. kekec

    kekec Chieftain

    Joined:
    Nov 24, 2015
    Messages:
    2
    whoward, I hope you still look at this thread:

    First of all - thanks for all the sweet mods!
    Second: I've encountered a problem when using your DLL, I hope you can help me fix it.
    I'm using a mod that has unique promotions and I've noticed that when your DLL is enabled the <HPHealedIfDestroyEnemy> promotion doesn't work. Even the in-game PROMOTION_PARTIAL_HEAL_IF_DESTROY_ENEMY stops working and only when your DLL is enabled. I've tried looking into your lua and sql files and I haven't seen anything that would disable it.

    Perhaps you have an idea why this would be happening?

    Thanks in advance.
     
  17. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    Hi whoward,
    in case you come back some time, here is a bugreport for two of your picknmixmods:
    Global - 3 Units Per City (v 1) + Units - Population + Enemy captures razing city = Crash

    I don't know exactly when a population unit is spawned (before or after AIs turn), but the endresult of the turn is (if you disable stacking), that a population unit owned by me is spawned next to the just captured AI city. The city belongs to the AI, so I don't fully understand, why the population now belongs to me.
    One way to fix it (more a workaround) would be to change in UnitsPopulation.lua the line to init the population unit from:
    local pUnit = pPlayer:InitUnit(iPopulationType, iX, iY)
    to:
    local pUnit = pPlayer:InitUnit(iPopulationType, iX+x, iY+y)
    so any coordinates that are NOT the just captured city.

    A more professional way would be of course to fix the dll for stacking mod.
    I can imagine that the stacking mod is crashing, cause the game is trying to place a population unit owned by me, on an enemy city.
    At least fix it that way, that this won't lead to a crash.
    And maybe fix population mod, so the population that spawned do belong to the AI and not to me, if he just capture the city.

    edit:
    Beside the crash from stacking mod (which needs fix just in case something similar happens because of other reasons), I think it is the SetPopulation Event which is used in the population mod. It is fired when the city gets captured. But in this cause it should not spawn a population.

    edit2:
    The workaround I use now, is to check if on the cityplot are units from another player we are in war with. If yes, do not spawn population, cause it is likey that the city was captured.
     
    Last edited: Apr 22, 2017
  18. beetle

    beetle Deity GOTM Staff

    Joined:
    Mar 19, 2004
    Messages:
    6,314
    Location:
    Frederick, MD
    EDIT: Never mind! I had loaded but not actually enable the mode. When it is active, there is a nice big “< Start Position >” in the middle top of the screen — it is hard to miss! Very nice!

    How does one use “Rotate Start Positions”? I seem to have it loaded correctly, but it looks like the usual start and I am not finding any options other than to move my starting Settler and Warrior. The menus look the same, and I do not see any UI buttons other than the usual ones. OTOH, I do not know know what I am looking for, and Civ5 is rather infamous for having clickable targets that do not look like active UI components. Is there a keystroke. I am on Mac, if that makes a difference.

    Also, if I pass on a choice, will it cycle back around?
    Yes!

    Sorry to ask a question that I am sure has asked before. I did trying using the forum search function, but I guess I was not clever enough. Thanks!
     
    Last edited: Jan 15, 2018
  19. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
  20. Kobjante

    Kobjante Chieftain

    Joined:
    Mar 28, 2016
    Messages:
    37
    Hii! I love the herdsman unit! I really would like to see a unit that could "steal" plantations resources from one place to another. Something like a planter. Besides, can you update the prospector to BNW version? I can't find mineral or strategic resources with the prospector? Many thanks for reading me.
     

Share This Page