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

Commanders v. 0.1

Discussion in 'Civ4 - Mod Components' started by killmeplease, Jan 31, 2010.

  1. stolenrays

    stolenrays Chieftain

    Joined:
    Aug 2, 2009
    Messages:
    2,061
    The assert comes up whenever I click on a promotion when unit promoting. These promotions don't have the onsalught tag in promotioninfos.xml. Wouldn't checking for a null value fix this assert, besides just deleting the assert?

    Code:
    	if (getOnslaughtCount != NULL)
    	{
    		FAssert(getOnslaughtCount() >= 0);
    	}
     
  2. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    i cant recall how the Commanders code is organized, so cant help, sorry :blush:
     
  3. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    hmm i thought i successfully merged this mod into mine (w BBAI) but now my assault mech gets unlimited attacks, regardless if the commander shares the same tile.

    for example, a stack of 10 barbarian warriors gets eliminated in one move by the assault mech. it seems that the attack on the first warrior doesnt subtract a move from the mech.

    EDIT: ok this behavior happens with any unit with blitz. but not against harder opponents. ill check with a vanilla mod. BTW, im not getting the above error. the mod seems to be working fine.
     
  4. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    there is the Initiative IV promotion having this effect.
    A unit continues to attack unless it gets damaged (or an enemy stack is completely eliminated)
     
  5. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    strange thing, the commander didn't have that promotion yet, and even if the commander was far away it would happen.

    Also I tried to merge the defender withdrawl on top of this mod, i couldn't get that to kick in during testing, but the effect I described above stopped.

    I noticed DW overwrote some "onslaught" code in the SDK, maybe the effect I saw was related to "onslaught"?
     
  6. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    uh yes, maybe its the cause
    iirc i was planning to add an onslaught promotion having this effect for units
     
  7. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    ok so i should try to remove the onslaught stuff from the SDK?

    also in CIV4PromotionInfos.xml

    this code breaks the promotions for "can only defend units" like the machine gun.
    Code:
    <iWithdrawalChange>10</iWithdrawalChange><!-- @MOD Commanders -->
    
    no other units were effected, (like the cannon).
     
  8. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    yeah remove it

    not sure whats wrong with the machine gun promotions
     
  9. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    ok i removed onslaught from everything, i guess that sort of breaks the last promotion as intended. compiled and appears to work correctly.

    i think i may try separating out the commander from the great general unit. i think this is how AND works.

    thanks again for crafting this mod, it really makes the great generals useful. i always thought attaching them to a unit was a waste.
     
  10. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    thanks for your appreciation!
     
  11. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,672
    Location:
    UK
  12. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    Ok I compiled my version of the mod (link to download)

    Basically I commented out the onslaught code, and broke out the commander into its own unit. When you first get a great general you now have 3 options:
    • can attach great general to unit
    • can join city as instructor
    • can upgrade to commander

    changes from original mod (SDK and XML changes):
    • BUG 4.4 compatible
    • removed unfinished onslaught promotion from SDK and XML
    • separated out commanders into their own unit
    • great generals can upgrade to commanders
    • commanders identified by leadership points < 0 (req SDK and XML change)
    • ai values commanders after level 2 (was 4)
    • changed the art for new unit
    side note:
    Spoiler :

    in theory you can make any unit able to get commander promotions by setting
    <iLeaderExperience>-1</iLeaderExperience> in Civ4unitinfos.xml

    sdk files changed from original mod:
    Spoiler :

    • CvUnitAI.cpp
    • CvGameTextMgr.cpp
    • CvInfos.cpp
    • CvInfos.h
    • CvUnit.cpp
    • CvUnit.h

    The python file in /screens/ (CvMainInterface.py) is built on the BUG 4.4 version, use the original file for a non-BUG install.

    Thanks again to killmeplease for an awesome mod!:goodjob:
     
  13. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    modifieda4
    great!
    i like the idea of upgrading GG to Commander
     
  14. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    This is really great guys...can't wait to try it out. I was wondering though....would it be possible to make a unit act as a commander with just a promotion?
     
  15. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    im not sure. maybe not, because the commanders have a special unitcombat type as defined in the XML. but i guess via the SDK you can override this.
     
  16. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    yeah, all is possible
    though making an ordinary unit a commander will require relatively complicated coding to teach AI how to use it as both a combat unit and a commander.
    having a separate non-combat unit for the commander is much easier from this perspective.
     
  17. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    Right...ok. I was just wondering about having different commanders...like a gunship commander that only gives the benefit to the other gunships, while a marine commander gives different benefits to the marine units. Would that work somehow?
     
  18. Jennvare

    Jennvare Chieftain

    Joined:
    Jan 10, 2010
    Messages:
    371
    I had mentioned something like this previously, but no one responded to it. In the mod History of the Three Kingdoms, that mods used great generals in a very unique way. Many had names of great generals from the past that could be recruited for gold. They also had a way of generating random heroes (new generals) the same way vanilla ones are made when you attain enough combat experience.

    The heroes (generals) in this mod had rankings for different military types. Since this mod was strictly medieval, there was only melee, archer, naval, siege, and mounted. There were rankings for each category and, the higher the ranking, the more promotions that were available.

    The generals also attached to a Core unit, but could include other specific units (Legion). If any unit under the heroes command won a battle (or successfully withdrew), the commander gained experience. However, if the core unit was defeated, the general could be captured, could escape, be killed, or simply be reassigned to another surviving unit of his legion. A captured general could also be recruited by the winning side.

    I would still like to see something like this for multi-era units. I would love to see the generals that WilliamofOrange is inquiring about and make the generals a major part of the game instead of just a one unit, or small number of units, wonder.

    Just some thoughts to add in.
     
  19. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    Have to play three kingdoms :)
    thanks for the info
     
  20. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    There are many great things in the 3K mod...thanks for clearing that up..I couldn't remember how they worked. I plan on using the code from here or there for my mod....which ever is easier. Since, I am doing a modmod of Orbis, this modcomp might be easiest for a first code job.
     

Share This Page