Simple Python Things

Yeah until that city (first city founded I guess) gets conquered. Tested this code for another thing.
 
Hi J

I was thinking... The "Celebrity" promotion that you made for me - which works great, BTW - could be made available as a separate download. I'm sure it could be useful to a lot of other modders out there.

Also, I had an idea for another python promotion. It would be assigned to recon units. Whenever it is stationed in a foreign city, it would automatically siphon off a small percentage of that city's wealth and add it to your treasury. It could be called Thief, or something like that.

What do you think?
 
Actually, come to think of it, J, you could take some of the python stuff you made for me in the ModComp threads and also release it as a separate download, too (the different Marauder promotions and the WoL Herc). I would hate to see me being the only one using them. :)

EDIT:

Also, I have another little request for you, if you don't mind. How easy - or hard - would it be using python to be able to specify for a unit die after a certain amount of turns? In WoL, for example, I want my hero units to automatically disband/die after, say, 20 turns (that way no civ can have a super-powerful military unit running around forever). Would the easiest way to do this be something similar to your respawn promotion, or is it just possible in python to tell a unit to go *dissappear magically* just like that?
 
Hi J

I was thinking... The "Celebrity" promotion that you made for me - which works great, BTW - could be made available as a separate download. I'm sure it could be useful to a lot of other modders out there.

Actually, come to think of it, J, you could take some of the python stuff you made for me in the ModComp threads and also release it as a separate download, too (the different Marauder promotions and the WoL Herc). I would hate to see me being the only one using them. :)

I'm happy, that you both suggest it, because it means, that it works and you like it :).

I'll maybe do it...or you could do it :D. I will not have enough time this weekend, so it'll probably need 2 weeks or so.
And i have no real idea, how to name/where to attach the two things which i made for you, cybrxkhan :dunno:. A suggestion is welcome :).

I also think of improving the AI for the promotions.
Wouldn't be to hard to force the AI to take the original and modified marauder promotions, a bit harder for the celebrity promotion, because it would need a city.
But like above, it'll need some time (i'm just not a real good programmer :/ ).


Also, I had an idea for another python promotion. It would be assigned to recon units. Whenever it is stationed in a foreign city, it would automatically siphon off a small percentage of that city's wealth and add it to your treasury. It could be called Thief, or something like that.

What do you think?

What do you mean with "stationed"? Just a round in the city, or fortified there?
First could be done, not sure for the second.
Also the AI would be a bit tricky for the second, because it would need to force real combat troops to stay in a city, so before i would have to see, if they are needed somewhere else.


EDIT:

Also, I have another little request for you, if you don't mind. How easy - or hard - would it be using python to be able to specify for a unit die after a certain amount of turns? In WoL, for example, I want my hero units to automatically disband/die after, say, 20 turns (that way no civ can have a super-powerful military unit running around forever). Would the easiest way to do this be something similar to your respawn promotion, or is it just possible in python to tell a unit to go *dissappear magically* just like that?

I haven't found out yet, how to store a value global, meaning to store it for more than a round.
I've seen modcomps with this ability, and i've also got a hint, where it's implemented too, but didn't have the time to look at it.
If i can find this out, it wouldn't be to hard, but maybe a not small problem for the AI :dunno:.
 
Well, for the modified Marauder promos, the one for espionage could be named "Sneak", "Patrol", or "Stalking", or something of that sort. As for the research, that's a bit harder, as it's kind of not usual to think of soldiers stealing research prototypes, but here's a few ideas: "Resourceful", "Skillful", "Innovation", "Inventive", or something of that sort.

I could release the WoLHerc whatchamadoodoo for you if you want (of course full credit goes to you), it was going to be the Bamiyan Buddha Statue wonder for WoL.

As for the heroes thingy, I certainly understand your position. However, what do you mean by "maybe not a small problem for the AI"? I do understand that it may be harder to make the AI strategize when to build the unit (as in the AI may be stupid enough not to save the unit, or that the AI may just build the unit and leave it there without actually using it). Is this what you mean?

And thanks again for your efforts!
 
What do you mean with "stationed"? Just a round in the city, or fortified there?
First could be done, not sure for the second.
Also the AI would be a bit tricky for the second, because it would need to force real combat troops to stay in a city, so before i would have to see, if they are needed somewhere else.

I just mean when it's inside the city. It doesn't have to be fortified.
 
...As for the research, that's a bit harder, as it's kind of not usual to think of soldiers stealing research prototypes, but here's a few ideas: "Resourceful", "Skillful", "Innovation", "Inventive", or something of that sort...

How about Library Raider? There's already a City Raider (granted, it has a different effect), so the name would be in a similiar vein. Also, how is it not usual to think of soldiers stealing research prototypes? When they pillage they take anything of value, which to me would include intellectual property (which could be research).
 
Well, for the modified Marauder promos, the one for espionage could be named "Sneak", "Patrol", or "Stalking", or something of that sort. As for the research, that's a bit harder, as it's kind of not usual to think of soldiers stealing research prototypes, but here's a few ideas: "Resourceful", "Skillful", "Innovation", "Inventive", or something of that sort.

How about Library Raider? There's already a City Raider (granted, it has a different effect), so the name would be in a similiar vein. Also, how is it not usual to think of soldiers stealing research prototypes? When they pillage they take anything of value, which to me would include intellectual property (which could be research).

Hhhmm, both interesting ideas.
I prefer "Sneak", and the idea from TheLadiesOgre, but...not the name. I'm sure, that we can find a better sounding name :).

I could release the WoLHerc whatchamadoodoo for you if you want (of course full credit goes to you), it was going to be the Bamiyan Buddha Statue wonder for WoL.

If you do it, add a wonder, the stats, the graphics and button, and upload it here, then the credits should go to us both ;), because then it's not purely mine work

As for the heroes thingy, I certainly understand your position. However, what do you mean by "maybe not a small problem for the AI"? I do understand that it may be harder to make the AI strategize when to build the unit (as in the AI may be stupid enough not to save the unit, or that the AI may just build the unit and leave it there without actually using it). Is this what you mean?

I mean the problem, that the AI maybe stands with a stack right before your city, waiting a senseless turn to bomb down the last 2% of culture defense, and then the hero could be gone.
Haven't thought about the things you've mentioned, but this could sure also be problems.

I just mean when it's inside the city. It doesn't have to be fortified.

Mmmh, maybe more difficult, then i thougt.
To explain it:
I can attach an effect, if a unit does something.
If the unit does nothing, i would have to search it/test every round, if there's maybe any unit in any city for every player with every unit...the performance is the problem.
No idea, if doing nothing is also a kind of action. If yes, it can be done.
Will have to test it, but, like said, not this weekend. My Bachelor Thesis needs a bit polishing, has to be printed on monday, so please excuse me for this weekend :).
 
I mean the problem, that the AI maybe stands with a stack right before your city, waiting a senseless turn to bomb down the last 2% of culture defense, and then the hero could be gone.
Haven't thought about the things you've mentioned, but this could sure also be problems.

I suppose I could make the default Unit AI in the unitinfos.xml to, say, only ATTACK or COUNTER, or something like that, although I suppose this maybe won't still solve the AI stupidity on knowing when to use units.

Would it be difficult to tell the AI, through python, to automatically use the hero to attack weaker units and/or to automatically not stand around doing nothing? Or would this be towards the insane SDK stuff?
 
Would it be difficult to tell the AI, through python, to automatically use the hero to attack weaker units

Uuh...shouldn't be a problem to force the AI to do it, but there are several parameters to check.
Exampe:
Stack has moved, hero as a movement point left.
- Check, if there are units on surrounding plots
- If the strongest unit is weaker
- And how much it's weaker
- If you're at war with the owner
- If the hero would stand alone on a plot after combat
- If the probably lost health would be needed for another attack (city attack)
- If the unit has to heal
- If it's not maybe more intelligent to pillage the plot (iron mine)
...and probably more things, which i forgot.

And the most important thing: To prevent the unit going into a battle with small chance of winning would need the same checks and maybe more. Would also cripple the AI, i guess.

and/or to automatically not stand around doing nothing?

...depends on what you mean with it.
AI builds a hero, and is not at war with anybody. Would this count?

Or would this be towards the insane SDK stuff?

Insane yes ;), SDK not needed, but sure better.
 
So, it's becoming a bit better with my time, so i'm going to do, what's on the list :D.


Sneak Promotion

Spoiler :



Industry Espionage Promotion

Spoiler :



Like requested by cybrxkhan, i've edited the Marauder Promotion from tsentom1, but changed to espionage and research points.

All changes are labeled with "Sneak"/"Industry Espionage", there are two parts in it.
Most important part: I've added a bit AI.
If the AI has a low research rate (<=70%), there's a change, that the "Industry Espionage" will be applied to an unit.
The same with espionage, but with >10% (didn't know a better way :dunno:).

Because of that adjustments, i've also modified the original marauder promotion (Marauder Promotion Advanced.).
Will be applied to an unit, if the AI's commerce rate is >=30%, or income per round is <8 Gold.




Next, i'll do the celebrity promotion from cfkane :).
 
Celebrity Promotion

Spoiler :


The celebrity promotion allows a unit to increase the happiness of a city by 1 :), when it's stationed in it.

All changes are labeled with "celebrity", it has 3 parts.
Part 1: Changes the :) in the city depending on the promotion, and teaches the AI in an simple way, that the unit has to stay for a moment in a city, when the city is unhappy.
Part 2: AI changes, so that the promotion will maybe be applied, when the unit is promoted in an unhappy city.
Part 3: Changes city happiness directly after promoting.

Small bug (can't be changed): Airlifting a unit with the promotion will not affect the city which airlifts, and the city where the unit arrives.


This modcomp was originally requested by cfkane for his Fictionalization IV Mod.

The button is from ohcrapitsnico, from this button pack.
 
Great work and its extremely easy to integrate this into the game thanks a lot. :goodjob:
I also have a question can you make a promotion that gives you +1 strengh like in HOTK or can it be made into this simple manner?
Thanks a lot for the great job your doing so far and awaiting your answer:)
 
Thank you for your reply, then i`ll patiently wait for it;)
 
Done :). Faster than i thought.


Heroic Strenght Promotion

Spoiler :


There are 2 parts in the CvEventManager.py, both labeled with "heroic strength". One part is for the AI (40% chance, that the AI will take the promotion, if available).

The button is by rabbit, white, from this button pack. The original inspiration for this buttons is from the MMORPG Guild Wars.

The inspiration for the name and to take the button is from FfH2.


I hope, it's what you've wanted :).




So, the next thing to do are the 2 requests by cybrxkhan and cfkane.
I'll do the one by cybrxkhan first, i guess.
2 questions:
- All wonder-units should die, or only special ones?
- After different time, or all the same time?
 
I'll do the one by cybrxkhan first, i guess.
2 questions:
- All wonder-units should die, or only special ones?
- After different time, or all the same time?

Thanks for your time and effort!

To answer your questions -

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).

2. All heroes would die after a set amount of turns regardless, say, 25 turns.

Thanks again for your time and effort!
 
Top Bottom