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

Tsentom1 Python Promotions

Discussion in 'Civ4 - Mod Components' started by tsentom1, Jan 24, 2009.

  1. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
  2. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    Yay, another whole category of random python!

    Anyway, I've been busy and haven't released anything in a while so these are just a few things I threw together either based on old requests or code that's floating around inside Thomas' War.

    These promotions are basically UU abilities from my next version of Thomas' War. I figured I'd put them up as promotions here so anyone who wants can use the code (mainly because throwing together a promotion modcomp takes all of 2 minutes if the code is already written).

    See their download pages for more details, etc.
     
  3. mechaerik

    mechaerik Tuturuu!

    Joined:
    Oct 28, 2008
    Messages:
    7,064
    Location:
    Los Angeles
    Those are AWESOME!!!!!

    I especially love the Skirmisher promo. :goodjob:
     
  4. -sr

    -sr Chieftain

    Joined:
    Jul 12, 2008
    Messages:
    73
    Location:
    Austria
    Really good work! I also like your work on Python wonders and traits.
    Suggestion: How about a promotion that increases a unit's strength by 10% when fighting within it's own cultural borders? (So that when your units are attacked or attack themselves as they are in your empire, they get a 10% bonus.) It could work in the same way as the 25% bonus against melee units (shock), 20% when attacking cities (city raider) etc.
     
  5. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,895
    Location:
    Germany / Netherlands
    :worship: python master :worship:.
     
  6. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    There was an error in the Survival Promotion code (mainly because I copied it directly from Thomas' War) where it had a pre-req promotion that doesn't exist in the standard game but does in my mod. It now needs the March promotion. Sorry to the two people that downloaded it already.
     
  7. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    Hmm, good ideas though I think those are more SDK type modifications. I might be able to think of a work around for python only. Let me see...
     
  8. Duque d'Caxias

    Duque d'Caxias Great General

    Joined:
    Nov 17, 2006
    Messages:
    102
    Location:
    Brazil
    Very intelligent additions, Tsentom, as ever. But this time I've got a doubt: what exactly means - 10% Survival Chance? What is the effect in game of this promotion?
     
  9. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    The details are in the download pages for the individual promotions, but basically, if you lose a battle (i.e. your unit is killed) it's a chance for the unit to survive loosing the battle. Basically it's a defensive withdrawal chance.
     
  10. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    Marauder Promotion:

    I've used this code before in my Trafalgar Square Wonder and in Thomas' War. This it just a modification to use it as a promotion.



    By 'Plunders' I mean it removes the gold from your rival's treasury and places it in yours.

    You can control the percentage, more or less, with the line:

    iGoldStolen = ( iGold//25 )

    However, to prevent this bonus from getting out of hand and to handle situations where the rival might have no gold there are also a few lines for minimum and maximum gold so adjust those accordingly if you change the percentages.

    This really isn't meant to be used stand-alone but for modders who want to include new promotions outside the traditional XML bonuses.

    All the python is labeled and searching for 'Marauder' should find the changes.

    I recommend downloading and using Winmerge to combine python.
     
  11. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Wow, great. Will add them ALL to my mod. :D

    Wait: Will the AI use those promotions?
     
  12. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    The AI and the promotions are sort of a mixed bag.

    On the one hand there is no <AIWeight> or <Flavor> tag in the XML for promotions like there is for my Wonders to guide AI.

    On the other hand I have seen the AI choose the promotions.

    So, there's a chance they will choose them but it's more random than anything else. Then again, they only have to have them for the python to fire, but sadly more pillage orientated leaders aren't more likely to choose the marauder promotion.

    I've been looking to see if there is a way to write AI for the promotions. I know where to do it for units and buildings but promotions have very little space in the python and XML.
     
  13. ripple01

    ripple01 Chieftain

    Joined:
    Mar 7, 2006
    Messages:
    1,247
    Location:
    New York City
    Hi tsentom,

    I had a suggestion for you and your Python wizardry. You mentioned that you often use these new promotions for your UU's. I don't know if this is possible, but wanted to put it out there.

    I use the Longship as a second UU for the Vikings in my mod (you may use it too, I don't know). I was thinking it would be cool to have a promotion that would bring back the old Civ3 style of ocean exploring. It might work best for a promotion unaccessible by other means.

    For instance, the Longship could have this promotion and it would allow it to venture into Ocean squares but with x% chance of sinking every turn. This could give the Vikings a jump on colonizing but not so overpowered as just letting it explore Ocean squares.

    Let me know what you think.

    Cheers,
    ripple01
     
  14. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    Basically this has two abilities.

    The first is a pre-caravel ship going into ocean. There's two ways to do this. It is possible to do so with python (and thus as a promotion ability) using the unitCannotMoveInto function in the GameUtils python file. The problem is, unitCannotMoveInto is one of those functions by default turned off and turning it on makes the game run slower. If you don't mind this then we move on the the next step. Otherwise, the way to do it is to give the specific UU the ability to go into ocean in the XML (thus can't have it as a promotion).

    The second, the chance to sink in ocean tiles, is relatively easy. Basically it uses onUnitMove in the EventManager. First a check for the unit, then a terrain moved onto check, then a tech check: if you don't have astronomy do a random number for the percentage you want, finally if it fails the percentage then kill the unit.

    So basically, it is very doable if you just make it a UU. While possible as a promotion it's not really recommended. However, I'm unsure how the AI would view this. They wouldn't understand that the ship has a chance to sink -- and I'm unsure how to make them aware of this.
     
  15. smeagolheart

    smeagolheart Monarch

    Joined:
    Sep 4, 2007
    Messages:
    924
    Location:
    Phoenix, AZ
    I think in Civ3 the AI would not venture out to sea... Because the chance to sink is pretty darn high, the player could do so but would definitely sink before getting too far (more than a couple squares). It was kind of a gamble you could be willing to take if you had a crazy feeling that land was not far from your island.
     
  16. Shiggs713

    Shiggs713 Immortal

    Joined:
    Mar 11, 2007
    Messages:
    2,361
    Location:
    Indianapolis
    wow, these are all very nice :thumbsup:. I'll try to work some of them into the ACW mod I'm working on.

    cheers

    Shiggs
     
  17. JustATourist

    JustATourist Lost in Translation

    Joined:
    Apr 13, 2008
    Messages:
    445
    Location:
    Lower Saxony
    Have you been able to fix the problem with the message feedback we talked about for the marauder promotion by any chance?
     
  18. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    I've been able to fix the "You have captured an enemy vessel" message from being global and is now just local. I'm still trying to fix the gold return message. For some reason the code that should work just isn't, but I'll have it done soon. A little sick at the moment so haven't coded much.
     
  19. Antilogic

    Antilogic --

    Joined:
    Sep 2, 2006
    Messages:
    15,602
    Once again, I am astounded by your modding talents. It looks like I have a little more merging to do. :)

    EDIT: I came up with a random question regarding the ability to receive +1 movement on victory. Does this trigger multiple times per round? As in, if I have a unit with Blitz and Skirmisher, can it theoretically attack an infinite number of times per turn so long as it wins battles?
     
  20. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    Yes and no.

    It does work with blitz allowing you to attack over and over again (which is why both should have enough pre-reqs to make this difficult to obtain). It's fun to do.

    However, I actually have skirmisher to trigger a return of 50 as opposed to 60. If I had set 60 it would be infinite and every time you won you'd get the whole move point. At 50 you technically get like .95~.90 of a move point and the game rounds up. This doesn't mean anything under normal circumstances, except with the blitz + skirmisher combo which basically it'll let you repeat it around 10 times or so and then stop as doing infinite can cause bugs for other reasons.

    However, if you don't want the two promotions to work together you'd have to add a line checking if you also have the blitz promotion and then define what to do from there.
     

Share This Page