Couple of modding questions

Poke

Warlord
Joined
Oct 30, 2010
Messages
168
Been trying to create a new civ but have come up against some walls.

Customfunctions.py has scripts like def doTurnLuchuirp, doTurnKhazad. Where do these calls originate? I couldn't find anything related to them in the xml files

Secondly, is it possible to create units that cannot leave your borders? I'm thinking that I have to create terrain types that only appears within the borders, like the Infernal's hell terrain, and give the units abilities to only be able to traverse those terrain types, but I've no idea how to assign that to a specific civilization

Thanks
 
1)the doturnkhazad and such are called in the doturn function which itself is called at the start of each turn by the C++ code of the game.

2)A clean way to do that would be to create a new xml tag for that in c++ , ( though it may alread exists, not sure)
 
Thanks. I think I found the doturn info in the def onBeginPlayerTurn() part of cveventmanager. So it should be a case of adding my civ to this list below, and add the code for doTurnMyciv in customfunctions, right?
Code:
		if   eCiv == Civ["Khazad"]: 	cf.doTurnKhazad(iPlayer)
		elif eCiv == Civ["Luchuirp"]: 	cf.doTurnLuchuirp(iPlayer)
		elif eCiv == Civ["Archos"]: 	cf.doTurnArchos(iPlayer)
		elif eCiv == Civ["Scions"]: 	cf.doTurnScions(iPlayer)			
		elif eCiv == Civ["Grigori"]:	cf.doTurnGrigori(iPlayer)
		elif eCiv == Civ["Cualli"]:		cf.doTurnCualli(iPlayer)

I could have sworn one of the civs had a feature where one of their units was unable to leave the borders, or atleast be severely crippled by doing so, but I can't find any info. If not, I'd have to try to adapt doFFTurn's hell terrain code to compensate - I really don't want to touch C++!
 
If you want terrain within their borders to change to a single new terrain type, try making a new climate (very simple, just make sure there are NO gaps between climates!) and setting that climate for your civ as a climateform (single line of xml).

As for borders: You can have units that can't explore (check the wyrmfisher), but not any that can't leave borders. You can, however, use an autoacquired promo for them (like what the Elohim have) to nerf them outside their own borders.
 
If you want terrain within their borders to change to a single new terrain type, try making a new climate (very simple, just make sure there are NO gaps between climates!) and setting that climate for your civ as a climateform (single line of xml).

Sounds interesting. Not sure what I want to do with the terrain for this civ just yet, other than qualify the movement of certain units

As for borders: You can have units that can't explore (check the wyrmfisher), but not any that can't leave borders. You can, however, use an autoacquired promo for them (like what the Elohim have) to nerf them outside their own borders.

I've not played Elohim in RiFE (only just got it!) but I think that's pretty much how I had it for FfH. Setting a unit with a strength of 2, and <iCombatPercentInBorders> set at a ridiculously high value.

However, just found this - <PrereqInBorderSelf> - can attach a movement modifier to that, and if I give the unit the warp-to-capital spell, I should be set, I hope



Thanks :)
 
If you want units to move SLOWER in terrains when outside their borders (sounds like what you want?): In RifE 1.31 (when released) there will be tags allowing you to manipulate movement cost through features and terrains, accessible by promotions (which can be automatically gained when outside your borders... Meaning no need to mess with native terrains if it's just for outside your borders ;)).

As an example:
Code:
			<TerrainMoveCosts>
				<TerrainMoveCost>
					<TerrainType>TERRAIN_MARSH</TerrainType>
					<iTerrainMoveCost>-1</iTerrainMoveCost>
				</TerrainMoveCost>
				<TerrainMoveCost>
					<TerrainType>TERRAIN_TUNDRA</TerrainType>
					<iTerrainMoveCost>1</iTerrainMoveCost>
				</TerrainMoveCost>
				<TerrainMoveCost>
					<TerrainType>TERRAIN_SNOW</TerrainType>
					<iTerrainMoveCost>2</iTerrainMoveCost>
				</TerrainMoveCost>
			</TerrainMoveCosts>


One note: Never, EVER decrease movement for terrains that only have 1 movecost (plains, grassland); You will be able to move infinitely. :lol:
 
It's really zero movement once outside the borders (the return to capital spell is a fall back just in case I do move the unit out - it won't be able to move back in), and that's assuming how <PrereqInBorderSelf> functions.
I'd have to experiment (I'm currently playing!) but I remember Call to Power allowing for fractional movements - the Leviathan could only move 0.1 tiles per turn, and required meglevs (10*movement) to move one tile, or something to that effect. If Civ4 is similar, then I could set the base movement to 0.1, and have the promotion multiplying that by 10
 
That already exists; Several RouteMovement tags exist for units (but sadly NOT via promotion), including one that limits units to moving just on a specific route (for the Mechanos, their Fort Commander can become a "Mobile Fort", which is limited to railroads).

There are four tags: Requiring a unit to move on a specific route, blocking a unit from moving on a specific route, ignoring the bonus for a route (so, say, a warrior could move on railroads, but gain no movement boost), and swapping the bonus of one route for that of another (so a warrior could move on a railroad, but only as fast as it could on a road).


These tags exist ONLY on units, however, so the effect applies in your own territory as well as enemy territory. Could use python to place the route everywhere in your territory (make a new, invisible route), and have units that can only move on that; They can't leave your territory that way. Unless you send an advance force to build a route to your enemy. ;)
 
The mobile fort sounds like a fun idea. I just started playing RiFE, and haven't tried out all the new civs yet, but Mechanos are next.

Looks like any way I do it I'm altering the terrain in one form or another then, guess I'll need to think up new units and features that'll take advantage of that!


One more thing. Does Civ's python support math.sqrt? The documentation for python says to use 'import math' for that function, but doesn't state if it's necessary for exponents - wouldn't x**.5 work in that case?
 
Top Bottom