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

DLL - Various Mod Components

Discussion in 'Civ5 - Mod Components' started by whoward69, Nov 4, 2012.

  1. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Wots a "CE table"?
     
  2. lastingman

    lastingman Chieftain

    Joined:
    Apr 16, 2020
    Messages:
    2
    Cheat engine. I've been playing with some mods and I really liked the ones in the Pick n Mix mods but I do use a cheat engine table from time to time since my games tend to crash from time to time, especially since I have a boatload of wonder mods installed. I can't even open my city menu anymore without crashing the game.


    Anyway, on a non-DLL modded game, the table works fine, but when I put in the DLL mod component, the scripts don't work anymore. I'm just a casual gamer BTW. I did see someone post something about cheat engine in a previous page so I thought I can ask it here. First time here in the forums so sorry if I made a mistake in asking.

    I am using the 1.0.3.279 version of the table.
     
  3. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    649
    To increase the city working distance (if that is what you mean) is already possible with whowards dll, you can even assign it to required techs and so on. see his "City Working Distance" mod from picknmix website.

    And to cheat, you can also enable the Ingame Editor mod instead, this works fine with dll.

    @whoward69 I fixed 2 multiplayer bugs:
    1) Goodyhut_picker == desync: In CvPlayer.cpp DoGoody function we have to use "GET_PLAYER(pUnit->getOwner()).isHuman()" instead of "GC.getGame().getActivePlayer() == GetID()", no clue why the original game code of dll caused no desync, but made this change and now the desync is gone.
    2) commenting out the define of "MOD_AI_MP_DIPLOMACY" solved the problem/bug with trading between human players. The last time I checked (v88) this mod caused desync anyway, so you could remove it. Or you could compare your implementation to the one from CP, there the active AI in mutliplayer works. But you are right with your "STFU" mod, the AI sucks, so even if the AI_MP_DIPLOMACY would work, I would not use it :D
    3) .. but I was not able to solve the reason why builder stop their task (eg to build a farm) after the feature was removed... I think only UnitMission can be responsible for that, right? I disabled your worker changes and even copied part of the CP code into, but the problem persists, while it is neither present in vanilla nor in CP...

    And, could you explain how your "Unified Yield" tables work? I would like to make trade routes gain culture or Food (international) and tried
    Code:
    <Trait_TradeRouteYieldChange>
           <Row>
               <TraitType>TRAIT_MOD_FOODPRODCUL_INTERNATIONAL</TraitType>
                <DomainType>DOMAIN_LAND</DomainType>
               <YieldType>YIELD_CULTURE</YieldType>
               <Yield>5</Yield>
           </Row>
       </Trait_TradeRouteYieldChange>
    
    but gain no culture from trade routes... Is there a custommodoption to enable? The API seems to be enabled by default.
    Searching for it in dll code in CvTradeClasses.cpp in GetTradeConnectionValueTimes100 function it seems there is no code for Culture (and all other non vanilla trade yields).
    That is sad =( I had hope that these unified yield tables were fully functional =/
     
    Lt_Karan likes this.
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    I suspect this is some revered engineered hack of the exe, and it can't cope with dynamically replacing the game core DLL. Not something I'm interested in, so no chance I'll be investigating further.
     
    Lt_Karan likes this.
  5. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    649
    The event "BarbariansSpawnedUnit" is not as useful as it should be unfortunately. It would be better if it would give the acutal unit that spawned, because in most cases (everytime the unit does not spawn within the camp) the plot it gives, is wrong, means the barb unit is not in the plot (anymore?) when it is called.
    The plot it gives is only one next to the camp, but for whatever reason barb units often (always?) spawn 2 tiles away from the barb camp. Was not able to find out why, but this is how it works in vanilla. So it would help alot if this event would also give the plot of the camp and the pUnit.

    And if we talk about barbarian events, why is the event "BarbariansCampCanSpawnUnit" designed that way, that you can only prevent barbs from spawning, but not make them spawn eg. every turn?
     
  6. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    The future of DLL - VMC

    I've had a long think over the weekend about the future direction of DLL - VMC. The mod was never a collaborative project; although I would occasional add items inspired by other people's ideas, it was always my final interpretation of their idea and solely my code.

    I can see no benefit to me in changing this approach, especially as I'm playing very little CivV and coding even less.

    Others are still free to clone the code base and use it as they want (within the terms of my fair usage policy), but I won't be incorporating any such changes into the main code base, unless I can see a direct advantage for me to it (so no multi-player fixes for example). Additionally I won't be justifying/altering existing functionality and/or behaviours - they were coded that way at the time for a good reason, even if I can no longer remember why. If you don't like the way something works, clone the code base and make it do what you want.

    I also don't have the time to explain how the code base works and/or provide additional clarity to my DLL Tutorials. At the time I wrote the tutorials a certain familiarity with C++ was assumed, and this is still the case. There are also many posts about coding the DLL and how my mods work - Google is your friend.

    Leg godt.
     
  7. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    649
    okay, no problem, it is your project, thats why I asked and it is totally fine :) Thank you very much for your work and the tutorials :)

    edit:
    one final question:
    How do I create my own dll ID? I saw your comment about that in CustomMods.dll and in case I release my new dll (combinded with a new version of my modpack), I want to make sure I abide by all rules.
     
    Last edited: Apr 21, 2020
  8. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Google is your friend
     
  9. hambilus

    hambilus Chieftain

    Joined:
    Oct 19, 2014
    Messages:
    3
    Is it possible to get an older version with c4df and csd still in it? I don't need or want support just want to be able to play without all the overhead of vox-populi. I tried downloading the oldest version available on your site and it doesn't appear to contain the code.
     
  10. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Previous versions of my DLL can be downloaded from my web site … the challenge will be finding versions of CSD and C4DF that work reliably (I think you'll need CSD v22 or earlier and C4DF v9.x - but can't remember which specific .x)
     
  11. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    711
    Location:
    Wherever the winds take me
    I have a quick(?) question regarding one of the Pick 'N' Mix mods dependent upon this DLL. Specifically, the Global - City Bombard Range mod.

    I was wondering how difficult it might be to change the requirement for bombardment ability to be a building (more specifically, defensive buildings) instead of a technology. My reasoning is multitude:

    - Cities that have been captured and defenses eradicated should not have bombardment capability simply because the conqueror owns a technology (albeit most cities are in revolt upon capture for a series of turns which makes this attribute less important)

    - A player owning several cities shouldn't just instantly be able to begin pummeling their attackers into oblivion simply because their scientists had a eureka moment over a single turn

    - Defensive buildings provide a sensible method to establish bombardment capability; technology may establish that for a unit but not for a city, per se. Even a unit has to spend money and a turn to upgrade before it gains new capability so it is logical to assume some established minimum for a city as well

    OK, maybe it's not a multitude of reasons, but at least three compelling reasons anyhow. :lol:

    Anywho, I'm looking at the code and from what I can initially tell it is relatively straightforward: The GlobalCityBombardRange.sql file creates two new columns to the Technologies table (BombardRange, BombardIndirect) and defines integers based upon the technology (Agriculture, Mathematics, Gunpowder, Dynamite) then inserts a max city attack range (and indirect bombard capability, if true) into the game defines. What I don't get (because I am not a programmer, I'm an artist) is how the underlying lua code evaluates and determines the correct variable beyond the line where it queries BombardRange and BombardIndirect from the database. I'm guessing that the variables are interconnected with each other between Bombardment.lua, GlobalCityBombardRange.lua, and your DLL and I admittedly can't decipher it (I can't even remember where I leave my car keys most of the time, so we're not talking about a very high bar here). That being said, ultimately I don't want to change any of the underlying code mechanics behind the mod at all if possible, I simply want to change the defining variable to that of a building present in the city instead of a technology owned by the player - and let the lua continue to do its magic.

    Sooooooo, is this easily doable without lengthy rework of the code (such as a modified .sql file and a couple of tweaks in the lua)? Or am I biting off more than I can chew here and should just scamper off and be happy with the marvelous mod that you have already created? :D
     
  12. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Intermediate difficulty

    Not possible, as the tech code calculates per team and not per city. Also, the caching used will need to change from per team to per city.

    But ...

    Merry Christmas :)
     

    Attached Files:

    Nomad or What likes this.
  13. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    711
    Location:
    Wherever the winds take me
    WOW. :bowdown::dance::thanx::woohoo:

    I was certainly not expecting that response. THANK YOU and Merry Christmas!!! This is a great gift and I have little to offer in return, unless you still have artwork that you need? As I recall, you have mentioned that you suck at art nearly - but not as badly - as I suck at code.

    I'm inspecting the differences between the two mods and humbly realize that there is no way that I could have ever figured it out. It seems that the changes required to switch from per team to per city are quite significant. I might have been able to possibly figure out how to modify the .sql, but the lua? Fuhgeddaboudit! Although it has inspired me to use this to reverse engineer your Trait - River Connection mod to be a building instead of a Civ trait and I'm going to give that one the ol' college try.

    Thanks again!
     
  14. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Start a thread if you run into issues, although IIRC that should be easier
     
  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Assuming you're going to use a new riverside building (eg landing stage) in each city to make these connections, you'd be best starting from "Global - Air Routes", change the building requirements from airport to your new building AND use the river connection trait code to test if there's a river connection between the two landing stages
     
    Nomad or What likes this.
  16. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    711
    Location:
    Wherever the winds take me
    I hadn't even considered "Global - Air Routes" as an option, which would be much easier than what I was planning. Since you've already built the code with that mod, there's no need for me to build it from scratch. Brilliant! And this is why I'm not a programmer.... :lol:
     
  17. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    711
    Location:
    Wherever the winds take me
    BTW, the city bombard range mod works beautifully!

    I noticed that the default range is 1 and that setting it to 0 is not allowed, so I guess will have to find a way to make newly built cities without fortifications pathetically weak. A Tradition policy uses GarrisonedCityRangeStrikeModifier of 50 when units are present, but I want a negative value for un-garrisoned cities. So unless there is a global that can redefine the default city bombard strength I think I'll just use a dummy building to weaken defense and hit points and replace it when the first fortification is built. I'll probably need to tweak the FLAVOR_CITY_DEFENSE for all civs so they make building fortifications a priority as well.
     
  18. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Give me a couple of days and I'll look at the code again as to why it can't be set to 0. I need to push the ships in hill cities changes anyway
     
  19. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    711
    Location:
    Wherever the winds take me
    No hurries, no worries - I'm keenly interested in the ships in hill changes too, and I can certainly make do with this mod as-is if I have to. I know some things are hard-coded into CiV and can't be changed and if this is one of those nuances, I can accept work around it. You have so many awesome mods already that they completely transform the game experience and many of them align well with my TC fantasy mod. Thanks for everything!
     
  20. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    I've fixed the code, I now just need to find my notes on how to update my website and GitHub!
     
    Nomad or What likes this.

Share This Page