Simple Python Things

Wow you searched also for a good button representing it, thank you very much it is far more faster than i expected. Once again thank you i`ll be adding it right away.
 
1. It is only the hero units, so not all wonder units in general. In WoL all the Hero units are actually under two unitclasses, National Heroes and Military Heroes (i.e. since each civilization has two heroes, and each hero is essentially a UU version of a National Hero and Military Hero).

How do you separate the national heroes from the military heroes?
Different unitcombat, or any other specific thing?

Will a unit lose it's extra strength after an upgrade?

What do you mean with "extra strength"?

Wow you searched also for a good button representing it, thank you very much it is far more faster than i expected. Once again thank you i`ll be adding it right away.

Nice to hear :).

Can you do me a favor and put the last updated date next to EACH comp you make, it would make it easier when looking if it was updated or not lately.

mmhh...i'll try to add it (if i don't forget it) for my next modcomps.
 
Good job on the Heroic strength promo!:goodjob: I was just wondering if such a thing were possible (mostly because I know nothing of python). Im definitely going to use this promotion.

One question though. How hard would it be to make or attach an ability like this to a tech? For example if I wanted a tech to give all muskets +1 strength, to simulate rifled muskets. This isnt a request, just want to know if thats possible/easy to do.
 
you could make it an event.

Would it be possible to make it not just affect the current units but all the you will build later? (not sure how the events work or what all of them do, ive only played a few games of BtS and that was when it first came out)

EDIT: On second thought en event wouldnt be the direction I would want to go. I would want it to be available to everyone.
 
How do you separate the national heroes from the military heroes?
Different unitcombat, or any other specific thing?

National heroes and military heroes are a separate unitclass.

So, for each civ, each hero acts as a sort of Unique Unit, in the sense that, for example, the English hero Robin Hood replaces the Military Hero for the English, and the American hero Thomas JEfferson replaces the National Hero for the Americans.
 
One question though. How hard would it be to make or attach an ability like this to a tech? For example if I wanted a tech to give all muskets +1 strength, to simulate rifled muskets. This isnt a request, just want to know if thats possible/easy to do.

It's possible, and wouldn't be too hard.
There's an python-event, onTechAcquired. After that, you could loop through all units, and give them the promotion. Not a big thing, but the AI would not know it, and i have no idea, if it could somehow be shown in the tech tree.

I mean for example a warrior, STR = 2 (default), with Heroic Strength promo STR = 3, if I'm correct.

Let's say you upgrade the warrior to an Axeman, STR = 5 (default), will the upgraded unit have STR = 6?

:blush: f***, didn't test it. I guess no. I'll check it, and redo it, if necessary.

National heroes and military heroes are a separate unitclass.

So, for each civ, each hero acts as a sort of Unique Unit, in the sense that, for example, the English hero Robin Hood replaces the Military Hero for the English, and the American hero Thomas JEfferson replaces the National Hero for the Americans.

Okay. Not nice, but it'll have to work.
I wanted to make it a bit generic, but can't be done in that way.
bit more work, but not a problem.
 
Would it be possible to make it not just affect the current units but all the you will build later? (not sure how the events work or what all of them do, ive only played a few games of BtS and that was when it first came out)

EDIT: On second thought en event wouldnt be the direction I would want to go. I would want it to be available to everyone.

Events can be non-random and happen to everyone when they meet the conditions.

In the event trigger XML, if you also set iWeight to -1 it will automatically trigger when the prereq conditions are met. If iPercentGamesActive is 100 it will happen in every game. With bRecurring set to 0 it only happens once - it will be once per player if bGlobal is 0 or once per game if that is 1 (so with 0 it can apply a free upgrade to every player's units when they get the tech, or with 1 it is only free to the first player who gets the tech).

When you have the event apply a free promotion, it is applied to every unit of the specified types that already exist and also to each such unit built in the future.

This is a very easy way to do this, although it does pop up the event dialog and require you to click on the event. If you want it applied without any user interaction needed (just show a message or completely without notification) then you wouldn't do it this way.

The free promotion is, I think, kept if the unit is upgraded. But that is likely to be a problem with any method of applying the promotion.
 
:cry: like i thought, the heroic strength promotion doesn't work after an upgrade, and i can't see a way to get it to work :cry:.

:cry: cfkane, i've looked a bit closer at your request, and it can't be done in a performant way.
If i station a unit in a city, i could attach the "thief-effect" to a mission, like fortify. Not a problem. But you could go there, select the unit, wake it up, and fortify it again...and again...and again...:cry:.
 
No, it's still there.

What you do want to do?

Thats too bad. I want to use the promo for two differnt reasons.

1) just like you have it, as a earnable promotion for units.

2) Instead of having a brand new unit to fill in power gaps. I wanted to give units like the archer, musket, horseman a strength boost after researching a tech (to represent composite bows, rifled muskets, stirrups). So I figure your new promo would be a good solution to adapt somehow. And God-Emperor filled me in on a good way to go about it a few posts ago.. Only problem was the promo carrying over, which apparently isnt a problem now, wxcept for the graphic still being there.
 
I expect that the effect of the promotion not sticking around is specific to the heroic strength promotion. If the icon is still present, it still has the promotion - it just isn't doing anything.

The standard efffects (like +x% strength, flanking, and such) seem to keep their effect when the unit is upgraded. At least, I have never noticed them going away - there are various events in the regular game that apply promotions to units and as far as I can recall they still have the normal effect when the unit is promoted (and I have done this very thing myself - a free promotion when a tech is gained - and upgrades seem to still get the effects, but those were not new effects, just standard already-existing-in-the-XML type promotion effects).

A problem I see is that some of the effects being are talking about should probably be permanant (kept after upgrades) such as heroic strength (once you are a hero, you stay a hero), but other things (like rifled muskets) should not be kept when the unit is upgraded.
 
A problem I see is that some of the effects being are talking about should probably be permanant (kept after upgrades) such as heroic strength (once you are a hero, you stay a hero), but other things (like rifled muskets) should not be kept when the unit is upgraded.

Yes exactly. I would like heroic strength promotion to stick around after upgrade (hopefully the_J will figure this out). And I would like/need rifled muskets to dissappear after upgrade (which already seems to be half done except for button not disappearing).
 
The standard efffects (like +x% strength, flanking, and such) seem to keep their effect when the unit is upgraded.

Sure, but this promotion is not a standard one ;).
The python effect is directly applied after promoting, and only to this specific unit -> not after upgrading.
I've thought a bit about it, the effect could be attached/the promotion could be removed with a check after onSelectionGroupPushMission/onUnitSelected/onUnitMove, but all that options are not good for the performance :(.
 
Okay. Not nice, but it'll have to work.
I wanted to make it a bit generic, but can't be done in that way.
bit more work, but not a problem.

SO it'd just be specified by unitclass... What would make it harder, just wondering?
 
I thought of making it a bit easier.
If every wonder unit would die, i could just check after every unit is built, if it's a wonder unit -> no specification what unit would be needed.

:blush: i still haven't started, just thought about organization.
 
Top Bottom