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

Animals and Hunting

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Mar 7, 2014.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    This thread is all about the Animals in the game as well as Hunting. I will attempt to explain the current Hunting system..


    If you are wanting to capture a Cargo Yield set the Capture Yield in CIV4UnitInfos.xml for the Animal or Unit...

    Code:
    <UnitInfo>
            <Type>UNIT_DEER</Type>
            <Class>UNITCLASS_DEER</Class>
    	<UniqueNames/>
    	<Special>NONE</Special>
    	[COLOR="Red"]<Capture>UNITCLASS_GRAIN</Capture>[/COLOR]
    Note, if the Capture Unit must be Discovered through research first, it will not be capture-able.

    Now, if a Unit with Cargo capacity attacks the Unit and defeats it, there will be a random amount of that yield given. The current value of "20" is stored in GlobalDefinesAlt.xml under CAPTURED_LUXURY_FOOD_RANDOM_AMOUNT if the Profession is Huntsman or CAPTURED_CARGO_RANDOM_AMOUNT if not.

    That is the basic system at the moment.

    However I am working on changes and I will jot them down here...

    Professions will have a "CapturesCargoType" tag. Here is where you put the type of cargo yield the Profession Captures. This Yield should match the Capture Yield of the Hunted Unit, as the Deer mentioned above. In the code if these two Yields do not match there will be no Hunt. This way you can have different Hunters for Different types of Yield. There will also be a number assigned to "CapturesCargoType" and this number will represent the random amount of Cargo captured.

    Civics will also have a new XML tag that can modify the Amount captured.

    This new system will allow for more customization with Hunting.
     
  2. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    Magnificent feature!!:goodjob:

    Now our Nomads could hunt until having the necesary fur to build their first teepee buildings!!
     
  3. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    Mmm nice:goodjob: time to hunt some Mutant Spiders and extract their Nucleic Acids.. :p:scan: if only I can get the interface problem figgered out. :crazyeye:

    What if <Capture> is a Unit like UNITCLASS_TREASURE in vanilla, can you still set things up to capture a unit too? If so, you could also use your system to make a special Profession like Slaverwho could turn defeated civilian units into UNITCLASS_SLAVE, or have Boarding Parties or Barbary Corsairs at sea who could turn a defeated ship into a ship unitclass controlled by the victor. :king:
     
  4. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    What problem is that?

    Ok, I edited my work to do exactly as you requested(not quite exactly). The new xml tags in Professions looks like this..
    Code:
    <CaptureCargoTypes>
          <CaptureCargoType>
              <UnitClassType>UNITCLASS_GRAIN</UnitClassType>
              <iChange>20</iChange>
          </CaptureCargoType>
    </CaptureCargoTypes>
    iChange is actually the random Yield amount gained per hunt. The dll will look for matching UnitClassTypes between the Profession and the Unit before it will capture the Yield. I am going to leave Scout units off this list for M:C, so there will only be one Hunting Profession.

    Edit: Actually, this doesn't do the Slaver per say. Hmm, the Capture tag in UnitInfos.xml is what sets up the Unit for capturing. Except if you add that to every applicable Unit then any Military Unit could capture the unit. We would need to set up a Slaver profession specifically for this, that can perhaps, capture any unit that can "found" a settlement as these are all your Human units, or the Unit has a special boolean called bCapturedBySlaver.

    Edit: I pushed the latest changes to the Civic branch
     
  5. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    Another “What if”.;)

    Also in vanilla when a Privateer attacks a Galleon you can choose which four cargo loads are going to be disposed of.
    So could it not take much coding and be fun if a generic huntsman unit were able to choose to keep either Fur, Grain or Food (or others) when killing an animal?

    Nevertheless, the way Kailric has offered is now is realistic, because hunters can specialize for food or fur; and some animals are worth its meat (boars) or its fur (bears).
     
  6. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    Nice :king::cool::goodjob:
    Actually I don't think you'd need to create a special boolean like bCapturedBySlaver. For the human citizen units you want to be enslavable, you could give them <Capture>UNITCLASS_SLAVE . Then a Profession like Slaver could have UNITCLASS_SLAVE as a capturable unit. You could even let certain units like Nobles not be enslaved but have a chance to be captured in another form, like UNITCLASS_NOBLE_HOSTAGE which you could hold for ransom.:king: (BTW I think it should be possible to create Ransom events using the Events xml system, where while you're at war with someone you can sell some captured hostages back to them for cash.)

    If <UnitClassType> is a regular Unitclass rather than a Cargo Yield unitclass, then <iChange> could be the percent chance that the victor captures that unitclass instead of the number of yields captured. Maybe certain brutal civics like Slavery could give you a boost to output from Slaves, while other civics or techs like Emancipation could convert your Slaves into Peasants.

    If you wanted a ship like Caravel to be capturable by Corsairs, you could give the Caravel <Capture>UNITCLASS_CARAVEL and also have Caravel be a capturable unitclass for Corsairs. It would help if Professions can have more than one thing they can capture (players would probably be annoyed if they need separate types of hunters for every yield or Corsairs/Pirates could only capture one type of ship.)

    It's still that same problem I've been having in trying to merge the recent M:C master branch updates into the 2071 branch - I've copied all the M:C Python into 2071 so everything's the same; but no matter what I've tried its giving Python callbacks and then not displaying any of the interface buttons during the main map screen. :confused: The callback seems to be related to an incorrect list index for interface elements, I'm thinking it may have something to do with trying to access interface buttons for the wrong number of tradescreen buttons or wrong number of other interface buttons. I'm now pulling the recent M:C update & will try rebuilding the DLL and using 2071 with the current update, let me know if you or Nightingale have any ideas about what could solve it.
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Hmm, yeah, at the moment you can set a Animal Unit to give "Furs" or "Food", or whatever but not more than one at a time, and Hunters can be set to collect all of them, but he can only collect one at a time. Like you say; Boars, Deer for meat; Wolf, Bears, for furs.

    There could be a new Trapper (outside) profession that specializes in collecting Furs only from "Animal" Units and the Hunter Collects meat. Or, Hunters could be set up to collect both.

    For a Slaver Unit, the Profession could be activated under the Slavery Civic. Basically it gives the Unit a chance to enslave another on defeat. We could actually use the "gift" code to give the unit to the other player to keep all its current Unit Type, such as Master Carpenter, level, promotions, etc. It's profession is then changed to "Slave" and cannot be changed. Under other Civics you could then Emancipate, or purchase the freedom of the slave with gold, just like in my Privateer mod.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    We were posting at the same time...

    To do this we would need to set it up, in the dll, so that only Slavers can capture units as any military unit can capture units at the moment. Then this could be done in the XML, and only units set to capture UNICLASS_SLAVE, would be able to do so.


    Yep, the tags in Professions is an array of UnitClasses as you say.

    Well, I hate debugging python. You could do like I do and just disable parts of the code until things begin to function correctly in order to pin point where the errors are.
    Did the errors start with the new tradescreen changes? I haven't been keeping up with the 2071 thread so I am behind there.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I am planning to add a new attribute for animal units called iMaxGlobalPercent. There is code that keeps Animals near their favored terrain so that you don't have polar bears in the jungle. The problem with this is that randomly maps can end up having a ton of Polar Bears in the Pole areas, which decreases the Animal population in other areas. So unless you send a hunting party to kill off all them bears the Animal population will become unbalanced.

    So, with this new attribute you can set the Max percent of that Unit that can appear so that there will only ever be few Polar Bears at the poles:goodjob:

    EDIT: Actually, I will use "iMaxUnitCountPercent" and set it up so that Civ can use this when creating units.
     
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Someone recently made a comment about Hunting and how animals become sparse later in the game(I searched for it again but couldn't find it). I have wanted to address this issue also as Hunting is quite fun actually, kind of a mini game. I plan to add Hunting specific Promotions also, like Bonuses Vs Bears and gain extra meat as well.

    Anyway, I liked the idea of the "Game Preserve" or King's Forest improvement. So, my idea would be that this improvement spawns Animals at random times, and basically you can xml mod it to spawn any UnitClass, for things such as a new GoodyHut type for Bandit Hideouts, Barbarian Camps, Guerrilla Camps, etc.

    So, if you have any more ideas on this let me know.
     
  11. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    I like the idea about unit-spawning Improvements but be careful about having too many of those to avoid unit swarms. Is it possible to add a tag to ImprovementInfos that restricts that Improvement type from being placed adjacent to an improvmenet of the same type? This would be good to have for this and other improvements, ie so you can't game the system by tiling down huge numbers of them in a trapped-off area and constantly farm it for tons of animals.

    On the topic of animals, how about making a unitinfos tag <YieldsFromKill> that lists what Yields and amounts you can get from defeating that unit; so you can customize this to have some rare/exotic animals give special yields as a reward instead of always converting everything into a set amount of Luxury Food. It would be cool if when you find an exotic animal when exploring you can be able to claim some rare/exotic yields from it; certain other animals could give more Hides or more Food etc, this could even influence your decisions about where to go Hunting if you have a particular animal or yield type you want to seek out. :king: I had thought that something like this had been already implemented but I can't find anything like that in unitinfos xml.:confused: It's probably easiest to deposit the yields from defeating something to the nearest player-controlled city, but since there is a UnitClass for every yieldtype it might also be possible to drop some of these onto the tile and have a Pedler or other unit pick them up.
     
  12. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Some good points. We could set a limit per Area, modified by Area size, of the number of units that can spawn within a certain amount of turns, no matter how many Improvements there are. For instance if you have several improvements in an area only one with be allowed to spawn a unit in 10 turns.

    Areas are defined by connected land tiles, like continents and islands are "areas".

    The captured goods from Animals is defined in the capturedunitclass in unitinfos.xml. We could turn this into an array so you can have multiple captures.

    Perhaps promotions can define what and how much is captured as well.
     
  13. Daw

    Daw Chieftain

    Joined:
    Sep 30, 2013
    Messages:
    1,782
    Hi there. Got to this thread now. I must confess I am somewhat disappointed with the huntsman. I got one from researching the Hunting first, so that one seemed to be an expert. Then I switched to the Worldbuilder to find a nearest beast to hunt, and discovered there were none on my island. So i placed one next to my hunter, hunted it and got 1 food, which is 0.5 of meal.

    This made me wonder, like, what's the point?

    Since the pedia description is the one of Vanilla Scout, I don't know if the unit does anything else.

    For instance (as a suggestion) I'd be happy to see it being something like RaR fishing boat, only on land, using animal bonuses to hunt. That is, additionally to the fun it really is now, it also might (should) be something practical as well.

    But if it only makes 1 food for 1 hunted beast, then the best use of it is probably to 'clear specialty and go learn something useful from natives'.
     
  14. Daw

    Daw Chieftain

    Joined:
    Sep 30, 2013
    Messages:
    1,782
    That is exactly what I made my copy of RaR do (because I wanted it to perform as much it was in the Col I in that regard), and I am generally quite happy with it. Although there are some minor deviations from the expected behavior connected as I suspect to unit strength.

    My Veteran Soldier Unit (<iCombat>2) striding unarmed as Colonist profession (unable to attack) is more likely to resist to the bitter end rather than be captured (which is also possible), while a Free Colonist (unit) Colonist (profession) will always surrender (<iCombat>0). Professions that can attack (e.g. Musketman) will always fight to the death, although the Unit (e.g. Free Colonist) has <bNoCapture>0.

    Personally, I like it this way.

    However yet, I never managed to make a land military unit (<bCapturesShips>1) capture a ship (<bNoCapture>0) anchored in a Native settlement :( Probably I am strictly not supposed to.
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Being stuck on an island is not all that great for hunting this way so you would have to find the mainland.

    Huntsman Professions are the only ones that can Capture Animal Food. It is a random amount generally way more than 1 though. If you have Manorialism the amount is doubled. We do have plans to make it as you say where you have a Hunting Missions and can Hunt areas. We plan to have a King's Forest improvement as well that you can hunt for Bonuses and will spawn more Animals.
     
  16. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    1 food is really unlucky. You could have gained 15 or something.

    I agree that the hunter is a poor unit at the moment. Animals used to be a real threat as they appeared in huge numbers and attacked humans. I remember one bug report about a buck taking over a city, which made the game crash :lol:
    The swarming animals issue have been fixed, but now there are too few to make hunting make sense. Part of the reason is that the AI also hunt animals. This mean all those minor civ warriors (indian braves) walk around everywhere and attack when an animal appears.

    Also there are improvements, which can attack animals and if they win, the luxury food ends up in the nearest city. I'm not sure I have ever seen it in regular gameplay because the wandering animals have become too rare.

    There is a serious balance issue here and we need to figure out what to do about it.
     
  17. Daw

    Daw Chieftain

    Joined:
    Sep 30, 2013
    Messages:
    1,782
    Sounds promising :goodjob:

    Yeah, but that kind of luck it really Russian style :lol:

    Very nice of them. And do they benefit from doing so or just have fun keeping player down?

    The description of Hunt areas and King's Forest Kailric has just provided really warms my heart. It would be nice to have an improvement with N tiles radius to scan for beasts every X turns, and generate one if none found. The beast will then remain within that radius for the Royal Hunt. :king:

    There can be limitations on the improvements though for balancing purposes. Say, they can't be built if a any settlement (including natives' ones) or even a plot with any other improvement is within the radius (the land must be virgin for the beast to come). And/or the number you can have can't be more than the number of your Cities.
     
  18. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Hunting as mentioned is one of those areas still underdevelopment but is in the game for feedback and suggestions just as you have done. I plan to add a new Diplomacy option for "Poaching". You have to get "hunting rights" in order to hunt on other Civ's lands or have negative effects to diplomacy. Natives and Minor Civs may decided to just keep on hunting anyway, which should tick you off. Natives attack dangerous Units such as Bandits and also Animals. I have plans to add Luxury Food to the Natives village for sale but at the moment the food is lost. Keep the ideas coming though.

    All in due time. Perhaps Daw could pull down his modding hat and learn to do some of these things. He seems like an intelligent fellow ;)
     
  19. Daw

    Daw Chieftain

    Joined:
    Sep 30, 2013
    Messages:
    1,782
    Thanks for the compliment :beer:

    I'm ready to learn whatever you are ready to teach.
     
  20. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    There are tons of tutorials on all things over at the Civ4 forums. Most of them would work or be very similar to Colonization.

    To make all the changes mentioned hear would take modding the DLL, which requires some C++ knowledge and XML editing and adding a new Improvement. Each of these steps can be learned separate.

    First you can learn to add new things to the Mod, such as Units, Buildings, and Improvements. You can find a tutorials here http://forums.civfanatics.com/forumdisplay.php?f=177 for all these things. Practice this, and don't worry about new Art just yet, just use the art the is already in the game.

    When you are comfortable adding new things, then try to add new Art for say a Game Preserve Improvement. When you have done that then its time to make your Game Preserve act the way you want. This is where it takes C++ knowledge. All these steps are necessary but if you complete one or two of them another person can more easily step in and do another part. So, if you added the new Improvements and Art I could write some code to add new functions to Improvements.

    Kael has written some excellent tutorials on modding. The one below is what really helped me get going with C++ stuff and adding new functions to the game.
    http://forums.civfanatics.com/showthread.php?t=166935
     

Share This Page