Platy's Peculiar Pleasant Posh Python

hey man:

1 - resources that vanish after some time (maybe if some player has hold of them - others are popping over after a while - some kind of a dynamic resource system.

2 - you can stockpile an amount of a resource - say for each 1 resource you have - like 1 iron - you get per turn +1 iron income - with it - you can pay to buy stuff - maybe units- a certain unit needs 1 iron (regular system) and +10 iron cost from your pile. (maybe to complicated for just python?)

3. a different resource system - a unit need 2 iron and 1 copper to be built, or 2 iron 3 oil.

just shooting some old ideas.

1 is possible depending on how tedious you wanna do checks.
A) Every turn,
Roll Dice, select random plot.
If got resource, roll dice, jackpot, remove it.

B) Every turn,
Scroll through every plot and do the same.

2 and 3 can be possible by making alot of these new resources and changing the XML to require them instead.
For instance,
Every turn,
For every cow, give you 5 bottles of milk.
Set milk as the XML requirement for training Cow Warrior.
When Cow Warrior is built, remove 1 bottle of milk.
Done.
If however, you want X Bottles of milk for every Cow Warrior, that requires cannotTrain callback.
 
a town probably wouldn't benefit from the concept of terraforming anyway, it doesn't matter whether it is dirt, grass, or sand.. it would all be stone and concrete by the time they'd finish building it...just like how a city has the same yield regardless of what tile it is on..

Terraforming would really come into it's own if you have say a large amount of desert in your borders which is unusable, you then move in and terraform to lush meadow paradise, before paving it to put up a parking lot!

or perhaps if you could turn ocean into land, but that is a much more complicated undertaking...
 
Hello Platy, I think you need your own sub-forum with multiple threads!

I was able to get your War on Vassal mod component to work with BUG, hover text and all (I don't think I broke anything).

I have a very basic question about your getWidgetHelp code. This function is not used for anything but the hover text for your mod (or any other mod like this I decide to install?) - getWidgetHelp is there solely for modding? Or are there somehow multiple definitions of this function within Civ 4 that get called from different places? [judging by its name it sounds like a def that would be used often]

Is your mod intended to replace BUG? I'm wondering if I should switch but I think BUG still has some important functionality you don't have as I'm using Better BUG AI which has some AI improvements.

1) GetWidgetHelp is important because for certain codes, without the widget, the codes don't function at all.
Pedia is an example, if you remove that section, none of the new pages like traits and routes will function. It is a new style I use compared to Sevo's which rely on dummy XML concepts for things like traits where user has to create a dummy concept for every trait.

2) Sub Forum, I thought of it before, but well, abit lazy to change :D

3) Whether Ultrapack is meant to replace BUG or complement BUG is up to users.
For instance, some modders have mentioned that it is hard to add the new Specialist Count portion to BUG, but Lemon has already done so with the latest BAT.
Anything python can always be merged together, unless there is a direct conflict which cannot be compromised.

As for Better BUG AI, well, the AI part is SDK and has nothing to do with the BUG mod itself. It is just that certain options like prechopping are made available in the BUG option screen.
You can't compare Ultrapack to BBAI or BULL, because those AI or new functions involved SDK work. BUG itself is just the interface for you to select whether those new functions are optional or not.
 
@Lib
As mentioned, the yields are simply the XML effects of the event.
There are tons of XML tags in the EventInfo.xml file whereby you can pretty much select many different effects.

For more special effects, you can even use the python to code them.

I chose yields rather than buildings because:
1) Yields can be repeatable, so even if the upgrade occur for the 1000th time, it is still beneficial.
2) I don't wanna waste my time making new buildings in the XML file :D
3) Palace moving

A town that is currently on a desert will still benefit if the desert is terraformed into grassland.
But the current system, to terraform, the town will be destroyed by the dummy improvement just to change desert to tundra then to plains and finally grassland.

Is it really worth it to destroy a town that takes so long to mature?

Furthermore, I doubt the improvement yields will make the AI terraform as intended.
 
Yeah, about the towns I was thinking more conceptually rather than in game terms. just the idea that indeed you wouldn't wnat to blow up an entire town to just repave it and put the town back up! :D

Yeah, I figured you wouldn't do buildings becasue you then need to have buildings :) I was just wondering how much more difficult it would be to do it with buildings code wise, as I do intend to make a bunch of buildings anyway :D this might just be a more interesting way for the player to interact with it :D
and the Xth time issue would just be about balancing it out so that it happens with 'just the right amount' of regularity :D
Really from a coding perspective I was just interested in how much harder it would be or if there was a major block to doing it! :D
 
Well, looking at the eventinfo file, there are already tags to place a building in the city.

The only extra thing is to code onBuildingBuilt, when Palace built, remove all existing free buildings.
 
1) GetWidgetHelp is important because for certain codes, without the widget, the codes don't function at all.
Pedia is an example, if you remove that section, none of the new pages like traits and routes will function. It is a new style I use compared to Sevo's which rely on dummy XML concepts for things like traits where user has to create a dummy concept for every trait.....

What I'm asking is that without this mod of yours that I installed, GetWidgetHelp is not doing anything right? It was added by the original developers for modding only. Just trying to understand what I did by creating a function called GetWidgetHelp. Does Base BTS use GetWidgetHelp and if so how does the program know which instance of the function to call?
 
It does for all widgets.
It adds additional help text to existing widgets.

Code:
	def getWidgetHelp(self, argsList):
		eWidgetType, iData1, iData2, bOption = argsList
## Train XP ##
		if eWidgetType == WidgetTypes.WIDGET_TRAIN:
			pCity = CyInterface().getHeadSelectedCity()
			if pCity:
				iUnitType = gc.getCivilizationInfo(pCity.getCivilizationType()).getCivilizationUnits(iData1)
				if gc.getUnitInfo(iUnitType).getUnitCombatType() > -1:
					sXPText = CyTranslator().getText("[COLOR_HIGHLIGHT_TEXT] \nXP:", ()) + str(pCity.getProductionExperience(iUnitType))
					return sXPText

For instance, this is to display projected XP for units in city screen.
Obviously in default BTS, when you hover over the units to be trained, there are already text there like Unit Stats and Cost.

What the getWidgetHelp does is add additional Text to it.
 
Manufactured Resources

Features
Certain Resources produce X New Resources Per Y Turns.
These new resources can then be set as requirements for units or whatever.
Units consume 1 copy of these resources when built.

Civ4ScreenShot0007_zpsd0722d9f.jpg


Civ4ScreenShot0006_zpsef7d71df.jpg


Civ4ScreenShot0000_zps662223db.jpg


Civ4ScreenShot0004_zpsa301a645.jpg

A.I. will still build Archers if possible.

A) Iron is set to produce 1 Globe every 2 Turns
Cow is set to produce 2 Globes every 1 Turn
10 Cows will produce 20 Globes every Turn, straightforward
10 Irons however, will produce 10 Globes every 2 Turns, rather than 5 Globes every Turn.

B) Consumables are stored in the Capital.
If the Capital is captured, all stored Consumables are burned :D

C) Resource System
Unit Requires Bonus A and (Bonus B or Bonus C)
If A, B and C are all Consumables:
=> Consumes 1 A + 1 Max(B or C)
If A and B are Consumables while C is a standard resource
=> If player has C => Consumes 1 A only
=> Else => Consumes 1 A + 1 B

D) Currently, it is all set to consume just 1 copy of each resource when unit built.
1) Unit Created however, does not consume because that requires onUnitCreated callback, you can shift it there if you like
2) If you want to define more copies per unit, such as 3 Bananas per Monkey, then that requires (i) cannotTrain callback (ii) Long list of units and consumables, which means can be done but I am lazy to do so :D

E) Naturally, you still cannot trade for more resources since that involves SDK.

F) Consumables are set as Non Tradeable Resources.
The Iron or Cow can be traded but not the Globe itself.
 
Are you taking requests? How about allow an Explorer to settle an outpost (consumes him) - like a city but no culture growth and only minor improvements or none at all. Prevents other cities/outposts being settled within 2 squares. Hard to defend against Barbarians.
 
Only certain requests when I bored.
This for instance is one where AI will find it difficult to understand.
And of course, pretty impossible to teach AI how to use without SDK involved.
 
Manufactured Resources:

1) Added a Dummy Tech to prevent trading of consumables
2) Added PediaTech because Firaxis codes cannot handle Dummies...
3) Consumables are now consumed when city start building the unit rather than when unit built.
If you change your mind halfway, too bad...

This means that if you only have 5 Globes, then only 5 cities can build Archers, rather than previously where deduction only takes place when built which allows 5 cities to build 5 Archers even when you only have 1 Globe.

Actually this makes more sense.
Think about it, obviously you need to melt the iron to make iron swords for swordsmen.
If you change your mind halfway, the iron is still consumed, so too bad.
 
Don't praise too early yet :D
After some thinking, deduction when unit start building is not good idea as the next turn, if there is not even one Globe left, production will stop.

Thus, have to shift codes back to onUnitBuilt instead.
Although this allows 10 Cities to Train Archers even though there is only one Globe, when the first Archer is done, all 9 others will be stopped, so not a big issue.

Edit:
Rewrite the wordings in the Bonus Pedia as "1 copies" look ugly...

Only issue is because it is coded onUnitBuilt, only units that are trained in cities will consume the bonus.
Unit Upgrades or Drafted ones however, do not consume the bonus.
 
Ultrapack

Tech Advisor
1) Got rid of more redundancies
2) Rewrite formula for locations of tech placement to be more "understandable"
3) Tech Era Colors now auto adjusted for mods with more eras or renamed eras
4) Auto Adjustment of Tech Panel Width when number of items allowed by tech exceeds 6

Platypedia
1) Added Promotions Allowed to Religion Screen, if any

InfoScreen
1) Further cut the code redundancies

Movies
1) Added No Movie check to fix some stuff
 

Attachments

  • Civ4ScreenShot0003.JPG
    Civ4ScreenShot0003.JPG
    166.3 KB · Views: 216
  • Civ4ScreenShot0004.JPG
    Civ4ScreenShot0004.JPG
    164.4 KB · Views: 179
  • Civ4ScreenShot0008.JPG
    Civ4ScreenShot0008.JPG
    155.6 KB · Views: 217
Don't praise too early yet :D
After some thinking, deduction when unit start building is not good idea as the next turn, if there is not even one Globe left, production will stop.

Thus, have to shift codes back to onUnitBuilt instead.
Although this allows 10 Cities to Train Archers even though there is only one Globe, when the first Archer is done, all 9 others will be stopped, so not a big issue.

Edit:
Rewrite the wordings in the Bonus Pedia as "1 copies" look ugly...

Only issue is because it is coded onUnitBuilt, only units that are trained in cities will consume the bonus.
Unit Upgrades or Drafted ones however, do not consume the bonus.

The only solution I was able to come up with was to have a sparse array for each player with index of resource id and value to contain the amount used for queued units. So
When unit ordered remove resource(s) from capital and place in sparse array.

When unit built remove resources from sparse array.

Before save put all resources in sparse array back in capital.

After save go through all city build queues and move resources to sparse array.

On load go through all city build queues and move resources to sparse array.​

Ugly but would do the job. Only doing a reconcile at save should be enough if done on auto saves as well.
 
Well, it is not a big problem actually.
Although 1 consumable can allow unlimited cities to train the same unit together, only the first one can be finished successfully.
The rest will be halted even if they all supposed to finish on same turn, but hammers not wasted because once your consumable supply continues, you can continue production.

It is just like training planes halfway and your only oil is destroyed.
Production will stop but can be continued once you reconnect the oil
 
Well, it is not a big problem actually.
Although 1 consumable can allow unlimited cities to train the same unit together, only the first one can be finished successfully.
The rest will be halted even if they all supposed to finish on same turn, but hammers not wasted because once your consumable supply continues, you can continue production.

It is just like training planes halfway and your only oil is destroyed.
Production will stop but can be continued once you reconnect the oil

Not so in C2C, delaying the finishing of a unit or building will cause the loss of some of the hammers spent on the build so far. There is s delay before this kicks in.

What happens in the other cities?:confused: Do they sit there trying to finish the unit or does the unit disappear from the queue and you have to remember to add it back in?
 
As mentioned, it is just like training of units that require normal resource.

Say, a plane that needs oil.
So now the city has 40/200 Production on the Plane.
Oil got pillaged, so you cannot continue production.
If you cannot reconnect the oil this turn, then next turn you get the popup "You cannot continue Production on XXX, select something new"

When you manage to reconnect the oil, and you want to continue training the plane, then production continues from 40/200, so no harm done, unless you lost the oil for good.

I believe even in BTS, if you cannot reconnect the oil, the 40 production slowly decays away too, but shouldn't be a big issue considering there is a constant supply, unless the supply rate is damn slow.
 
Back
Top Bottom