• Our Forum Hosts will be doing maintenance sometime in the next 72 hours and you may experience an outage lasting up to 5 minutes.

Fury Road LS Mod Mod

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
No I get no error messages, the python code just doesn't seem to work or even particularly register in the game? at one point I tried to change it so the excavator couldn't found anywhere just to see if it works but that didn't do anything either.

Code:
 def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX, iPlotY)
		for i in range(pPlot.getNumUnits()):
			pUnit = pPlot.getUnit(i)
			if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SETTLER'): return False
			elif pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_EXCAVATOR'): 
				if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_RUIN'): return False
			return True

that is the gameutil code. would you like me to send you the files? so I haven't done uploading files onto here yet so I don't know how it is done?

the 'excavator' is my unique settler and the ruins are referring to your ruined city features I know that normally you can't settle there but i disabled it for now its really just a place holder to get the code to work then I will replace it with a new piece of terrain. I also tried it with 'Forest' feature instead to see if it was a problem with the ruin, but it didn't work either, the excavator just founds anywhere?

Like I said if you need files I'll send it to you some how just let me know what to do and I'll get straight on it.

thanks a lot this is one of the two bits of python code that i need to really make my mod work the way I would like it to. Everything else I can think of so far is xml and i can do that without too much difficulty.
 

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
There are some python callbacks which are very expensive in runtime because the AI calls them very often. So there is one additional step you must take to have your callback run. Please see file assets/xml/pythoncallbackdefines.xml:

Code:
	<Define>
		<DefineName>USE_CANNOT_FOUND_CITY_CALLBACK</DefineName>
		<iDefineIntVal>0</iDefineIntVal>
	</Define>

The callback you are using, cannotFoundCity, is not activated by default. Please change the "0" to "1" in the above file, and then your callback will be executed.

However, I am not sure the callback does quite what you think. I cannot find any good documentation on this. But I believe that this function is called by the AI when checking *potential* city sites. That is, before it even builds the settler unit, it calls this on every square to see if it might be a good city site. In this case your excavator unit will obviously not be there. As a result, your function will always return true and the AI will never even try to found a city.

Is the excavator a *replacement* for the settler? Or do some civs get both a regular settler and this settler? If it is a replacement, then probably what you want is to check whether the player's civ is one which has only excavators, and return false if the plot is a ruin else true. If a civ has both types I am not sure how this could work.
 

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
Sorry yeah I have activated the callbackdefine.xml switched it to '1'

yeah plan is that a civ will either have a settler or an excavator not both.

would you be able to tell me the code for what you just said to do, I don't really have much understanding of python I am sort of able to get an idea from it now but I don't really know how to write it?

someone supplied me the code when i asked if it was possible, i don't fully understand what it is really doing.

Code:
 def cannotFoundCity(self,argsList):
        iPlayer, iPlotX, iPlotY = argsList
        pPlot = gc.getMap().plot(iPlotX, iPlotY)
        for i in range(pPlot.getNumUnits()):
            pUnit = pPlot.getUnit(i)
            if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SETTLER'):
                return False
            elif pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_RUINS_SETTLER'):
		if pPlot.getImprovementType() == 2: # 2 = IMPROVEMENT_CITY_RUINS
                    return False
                return True
        return False

here is the code someone provided me for achieving a similar goal in a bts game I think in my attempts to get it to work i may have cut some bits off that it needs but when I adapted this code for fury road it still didn't make my excavator be allowed to found only on certain sites
 

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
I do not think I will be able to write the python for this. But if you go back to the person who wrote it for you, they may be able to suggest something. Sometimes when working with others, it is easiest to make the new code work on a pure vanilla installation. This way the other person does not have to first install Fury Road, and there are fewer things that can go wrong.

I recommend you create a simple mod, directly on top of vanilla, which has your excavator unique unit which you want to only found cities on a vanilla feature -- say forest. Get that to work with the help of your friend. Then the working code can be easily placed into Fury Road. If you haven't already, you may be able to get help on the sdk/python sub-forum; but it is rare to find a volunteer who will write python for you.
 

Kael

Deity
Joined
May 6, 2002
Messages
17,401
Location
Ohio
Sorry yeah I have activated the callbackdefine.xml switched it to '1'

yeah plan is that a civ will either have a settler or an excavator not both.

would you be able to tell me the code for what you just said to do, I don't really have much understanding of python I am sort of able to get an idea from it now but I don't really know how to write it?

someone supplied me the code when i asked if it was possible, i don't fully understand what it is really doing.

Code:
 def cannotFoundCity(self,argsList):
        iPlayer, iPlotX, iPlotY = argsList
        pPlot = gc.getMap().plot(iPlotX, iPlotY)
        for i in range(pPlot.getNumUnits()):
            pUnit = pPlot.getUnit(i)
            if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SETTLER'):
                return False
            elif pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_RUINS_SETTLER'):
		if pPlot.getImprovementType() == 2: # 2 = IMPROVEMENT_CITY_RUINS
                    return False
                return True
        return False

here is the code someone provided me for achieving a similar goal in a bts game I think in my attempts to get it to work i may have cut some bits off that it needs but when I adapted this code for fury road it still didn't make my excavator be allowed to found only on certain sites

This code should always let you found a city with a settler. It should always let you found a city on a ruins with a RUINS_SETTLER. It should never let you use a RUINS_SETTLER to found a city on any plot except for those with ruins in them.

A side effect of the way this is written is that a RUINS_SETTLER can found a city anywhere if a normal settler is in his same stack. Also the AI is going to get really confused by this because this makes all plots unfoundable until the settler moves into them. The AI won't know this and will just think it can't found in any plot.

I would switch it too:

Code:
def cannotFoundCity(self,argsList):
        iPlayer, iPlotX, iPlotY = argsList
        pPlayer = gc.getPlayer(iPlayer)
        if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_THAT_USES_RUIN_SETTLERS'):
                pPlot = gc.getMap().plot(iPlotX, iPlotY)
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENTS_RUINS'):
                    return False
                return True
        return False

That way the plots are always enabled or disabled regardless of whats in the plot.
 

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
Right ok thanks for this input Kael I will definately try it. Could you show me how to write it for more than 1 civ?
Basically I have 3 civs that use the special settler, also would this mean that I no longer use the special settler or could I use it to help players see the difference?
would I simply repeat the if pPlayer line entering each civ or is there some other script?

If I'm understanding right it would basically become a civ trait (sort of) rather than a unit trait and any unit capable of settling for that civ would only work on that tile type?]

Thank you so much for your time I'm sure your busy, I really appreciate your assistance.

I managed to get a piece of code working for vanilla bts Caos supplied me with a modular that I ran and it worked yet the code doesn't work for fury road. Could it have something to do with the python entry points or gameinterface files. it just seems like the game isn't seeing my python code (unless it isn't quite right and the it make the gold counter in the top corner go screwy) but it is seeing the other bits of fury python code?
 

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
Could you show me how to write it for more than 1 civ?

The straightforward way to do it is by extending the "if" statement. This is a standard programming technique. A different approach which is much more complicated is to enhance the sdk and add a new xml flag to the civilization, for example which gives the legal feature type for a settler. Then you would just check the flag instead of checking the civ name. Modding the sdk requires a lot more programming experience.

I managed to get a piece of code working for vanilla bts Caos supplied me with a modular that I ran and it worked yet the code doesn't work for fury road. Could it have something to do with the python entry points or gameinterface files. it just seems like the game isn't seeing my python code (unless it isn't quite right and the it make the gold counter in the top corner go screwy) but it is seeing the other bits of fury python code?

Integrating python from two different mods is certainly possible, but you need to understand how both of them connect to the event manager and game utilities. There is a good explanation at this link. It definitely requires a little programming ability.
 

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
Hi David, me again, going back to my problem with python I have finally got the python error messages to appear, but I don't really understand what it is referring to and I was wondering if you might be able to understand where I need to look.

There are two messages: (these might not be word perfect)

1. Error(?Loading Python Module?) no python module named Fury_Road

2. error loading most recent call
<string> line 1?
no python module named Fury_Road

I copied all the folders from your Fury Road mod into a new folder and renamed it might that be where the problem stems from, the frustrating thing is that it doesn't refer to a specific file as far as I can tell so I don't no where to go looking to fix the problem?

Thanks for any light you might be able to shed. Your efforts are always much appreciated.

Also on a completely different topic, how were you able to successfully remove units and things from the game because all my attempts have ended in the game simply crashing to desktop with no error messages as to why, I have tried to look through your files to see which ones need to be altered but it is difficult for me to figure out which ones need to be altered as you have added so many new and different elements to your mod.

Again thanks for your time
 

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
1. Error(?Loading Python Module?) no python module named Fury_Road

If the message is specifically about Fury_Road (with underscore) then this refers to the mapscript. Please make sure you copied the PublicMaps directory and it contains a file Fury_Road.py.

Also on a completely different topic, how were you able to successfully remove units and things from the game because all my attempts have ended in the game simply crashing to desktop with no error messages as to why.

If you start out with very small changes and get them to work, then you will be able to move onto bigger changes. First, just try changing something about a unit. For example, give one of the units a movement of 4 points instead of 1-2 by changing the iMoves value in the xml. If you can see this, then go on to try adding a new unit, which is a copy of the old one with a new <Description> field. You can just put text there, for example: <Description>My Copy</Description>

If you are able to get this stuff working, then try deleting a unit. Please note that sometimes, other xml files may refer to the unit. For example, the unitclass file usually refers to a unit, and the civilizationinfo file may also. Sometimes it is tricky to find all the references. If you have a good text editor, you can do a "global search" in all the xml files to find references. Be sure to change or delete all of them.

I highly recommend civcheck, a program I wrote to catch various types of missing references. Once you set it up and learn how the output works, it will be easy for you to catch these errors before you bring up the game itself.
 

Chusquero

Chieftain
Joined
Sep 22, 2009
Messages
63
Location
Málaga (Spain)
Looks great! I like the ideas, also I'll be bothering you with my mental junk...

It is an early stage, I think, but it's taking a good shape.

I saw lack of religions.
 
Top Bottom