Mod Component Requests Thread

pioneertank will build a new kind of path, as described by MagisterCultuum. But he stays in the game and the peak never turns into a hill.

Now I have released exceptions for a while and the game writes this:
 

Attachments

  • python.jpg
    python.jpg
    22.7 KB · Views: 46
Hey, everybody. I see that I won't learn anything about the differences in the code for BUGmod and without it. However, it is true that despite all my efforts in my personal mod, this code does not work. Most likely there is a eror on my side.

I was thinking about a different approach.
I created a bomb model.
modrabomba.jpg

Do you think it would be possible to write the code:
When UNIT_BOMB is on PLOT_PEAK, it changes peak to hill
Or something similar. Would that be possible please?
thanks
 
I'm not a programmer, but I was wondering if it could work like this. So far it seems that no :(


Code:
    def onUnitPromoted(self, argsList):
       'Unit Promoted'
       pUnit, iPromotion = argsList
       player = PyPlayer(pUnit.getOwner())
## Bomba Start ##
       if pUnit.isHasPromotion(gc.getInfoTypeForString("PROMOTION_BOMB")):
                    pPlot = CyMap().plot(iX, iY)
                    if iRoute == gc.getInfoTypeForString('ROUTE_ROAD'):
                    pPlot.setRouteType(-1)
                    if pPlot.isPeak():
                        pPlot.setPlotType(PlotTypes.PLOT_HILLS, True, True)
 
@hrochland

You need to be careful with indentation in Python.
(The indentation decides what is triggered in which if, elif, else.)

-------------------

The line below this if you did not indent.
(I am not sure if that is really what you want.)

if iRoute == gc.getInfoTypeForString('ROUTE_ROAD'): <--- let us call this if statement "A"
pPlot.setRouteType(-1) <----- No indentation. thus not considered in if statement "A"

-------------------

Questions
Where does plot method get iX, iY from ?
It is not assigned / referenced before.

pPlot = CyMap().plot(iX, iY)

Is it maybe also in the argslist?
Or do you want to read it from the Unit?

-------------------

Maybe try it like this, so you are already a step closer.
And sorry, I am editing here in the Forum which is horrible to indent.
It is better to use a good editor like Notepad++ instead to get indentations right.
Code:
   def onUnitPromoted(self, argsList):
       'Unit Promoted'
       pUnit, iPromotion = argsList
       player = PyPlayer(pUnit.getOwner())
       ### Bomba Start ###
       if pUnit.isHasPromotion(gc.getInfoTypeForString("PROMOTION_BOMB")):
          ### Get the Plot from the Unit ###
          iX= pUnit.getX()
          iY= pUnit.getY()
          pPlot = CyMap().plot(iX, iY)
          ### Roads are bombed away ###
          if pPlot.getRouteType() != -1:
                pPlot.setRouteType(-1)
          ### Peas are bombed to Hills ###
          if pPlot.isPeak():
                pPlot.setPlotType(PlotTypes.PLOT_HILLS, True, True)
 
Last edited:
You're right. The determining factor should be the position of the unit that has the BOMB promotion, stands on PEAK and creates a ROAD there.

This combination should lead to the conversion of PEAK to HILL.

I'm not a programmer at all, unfortunately. The solution proposed by MagisterCultuum and The_J is not suitable for me and moreover it doesn't work in my mod. (Probably because of some bug of mine) So I am trying to find another way, but I rather guess the solution in python.

I tried to make a minimod with your code, but even in this form, the mountain does not turn into a hill.

I attach a mod if anyone is willing to help me.
 

Attachments

  • bombamod.rar
    52 KB · Views: 28
I would like a Python modcomp that if a civ has X civic than it is immune to foreign culture. Foreign culture is not increasing in cities (but it doesn't need to vanish) and cities cannot culture flip to other civ's.
 
would like a Python modcomp that if a civ has X civic than it is immune to foreign culture
hi
i can try and check this with the dll.
we need s civic xml tag for nark it and to to a check for a set civic with that mark
on the culture functions that relate to foreign.
ill need full dll source for this + the nmake and project files.
 
I would like a building/wonder in my mod that would establish a religion in my empire. Does anyone know if there is already a code for this somewhere, or even a minimod? thanks HROCHland :)
 
I would like a building/wonder in my mod that would establish a religion in my empire. Does anyone know if there is already a code for this somewhere, or even a minimod? thanks HROCHland :)

In my buildings can fund SPECIFIC techs, so I have dummy buildings with dummy techs to fund religions and it works pretty good 🙂
I can share the source code with you, if you want.
 
Thank you very much for your reply. If I may, I will tell you exactly what I mean. When I added the Druidic tradition to the religions, I noticed that Judaism became somewhat neglected by the game. That is why I added the Bait ha mikdash (Solomon's temple) among the wonders. I would need a code so that the player, if he builds Solomon's temple, found Judaism.
 
Thank you very much for your reply. If I may, I will tell you exactly what I mean. When I added the Druidic tradition to the religions, I noticed that Judaism became somewhat neglected by the game. That is why I added the Bait ha mikdash (Solomon's temple) among the wonders. I would need a code so that the player, if he builds Solomon's temple, found Judaism.
That's exactly how things work in my mod 🙂
 
dear spring bunnies, is there any way of obsoleting terrain improvements? I've had a (not very comprehensive) search but can't find anything ... I'm guessing it's beyond a simple schema addition to civ4improvementinfos.xml
 
Yes, obsolete by tech ... disappears from the worker build list. It can still sit there being old-timey, but the new all-singing all-dancing improvement should be favoured instead.

I think the main idea is to stop the improvement being built because a more productive improvement (that has a different set of parameters) version is available. It has suddenly occured to me that it would be possible to change the improvement via LSystem to a different artref ... but I want it to have slightly different specifications. In the schema I note there is an ObsoleteTech tag (used for Bonuses for example), and I'll test this, but the fact I've never seen this implemented in all the 3*10^6 years of civ4 modding doesn't give me any great hopes for anything other than it throwing an error ...

I couldn't find anything in CvGameUtils.py that might serve, I guess it's something like 'if you have technology_x, improvement_y is not available'.

The improvement in question is a feature based one, a 'forester', later replaced by a classic civ4 lumbermill. The earlier version is only available on regular forests, the latter on jungles too. I'd like to switch off the earlier one for workers ... the other way round is too create a 'Forester' unit that just makes these, but it's a super messy solution (and one I indulge in a lot because it's easy and I'm a bit thick), or even something that just chucks them on tiles randomly - "Cripes a forester just set up close to your city" - which is even messier.

Would appreciate some help!
 
ah uh umm sdk ... i wouldn't know how, I have difficulty soiling myself without an illustrated guide. i'm modding adv-civ away from Technology_Race-2000 into fun. So ... there's no clever and quick solution outside SDK? That makes me a sad bear.

Workers are useful in the late game, usually adding routes into devastated areas that were just invaded (increased moves for vehicles), or adding Future improvements to tiles (Robot Farm, with robots dressed as milkmaids ... and maybe robot cows: <beep> mooooooooooooo).

I know there is code for 'if you have building_x, then improvement_y becomes improvement_z on completion', I used it before (some kind of wonder effect I think).
 
So ... there's no clever and quick solution outside SDK?
I just looked it up in vanilla and sadly CvPlayer::canBuild doesn't have a python callback. It only test if a tech is present to unlock, but there is no code to hide it again. It can be added without too much hassle, relatively speaking for C++ changes in mods, but it does require the DLL file to be recompiled. I didn't check if adv-civ has added one, but I find it unlikely. Generally speaking, if the DLL is being modded, it will be best to have all the new stuff in the DLL file for performance reasons. Pushing the same calculations to python will slow down the game. It's also easier to just do it in C++ since you have to modify C++ anyway.

I like the idea through. The concept that new technology requires workers to upgrade existing infrastructure makes sense and it does alter gameplay in a way, which could be interesting.
 
hey,
dont be a sad bear, papa bear keldath is here.

since you use advciv, it makes it easier.
ill create the code for my mod which is advciv based and merge it to vanilla advciv after so.
may take me a bit though since im a bit tight on time, but, will make it so.

dont worry and bug me here or in a pm if time passes.


edit:
well started to work on it.
just to clarify:

- build order of workers will now have a new tag : TechObsolete
if its obsolete, the worker will not be able to build.
- another same tag, TechObsolete , will be on an improvement.
when obsolete, the improvement ->
QUESTIONS:
1. will stop adding its benefits and will render to being useless? if its perks should be stopped? all of them? only yield?
2. will be destroyed? or changed to some rubble improvement?
3. keep being active until pillaged or upgraded/changed?

- this will be a game option.


--
ok izi pizi,
i worked with improvement decay mod that i also use.
done with the code, i need to test.
rules:
build order can be obsoleted.
improvement obsoleted by tech gets pillaged to its pillaged improvement or none.

ok?

edit:
well that was quick of me.
i have the mod ready, its included in my doto now as a game option.
ill post the link tomorrow.
ill update here when it up .
then you can test the mod and see if you like it and it works as expected .
if you approve ill create it for you clean on advcciv vanilla without my mod of course.

cheers!
 
Last edited:
Top Bottom