ModModder's Guide

one short question.

is there a promo command like "addscript", which adds a script to the unit with this promo.
I haven't found some but I want to be sure.

By script, do you mean python?

If so...

Promotion Python Tags:

  • PythonOnRemove
  • PythonPostCombatLost
  • PythonPostCombatWon
  • PyOnPromoTaken - 1.31 only!
  • PyHelp
  • PyPerTurn
Functions:

  • Python that runs when the promo is removed, naturally
  • For when the unit loses a combat
  • For when the unit wins a combat
  • For when the promotion is taken by a unit. Added in 1.31, I needed an immediate effect (for an artstyle selection, using pyperturn caused there to be a turn delay before art swaps)
  • Displays specialized help on mouseover (like for mutation, showing the actual mutation effects)
  • Run each turn

Do you have the source code for the DLL available somewhere?

Sorta. I had forgotten to release it, so I have the 1.31 source.

I could grab the 1.30 source (I know the last rev that went into 1.30), just time consuming.

Or I could just pm you the SVN repository path, and you can grab it that way.
 
Curious about one thing though: What part of the source are you interested in? :p

I'm interested in any and all AI tweaks and changes. But in particular, what I was looking for is the code getting workers to build forts. Even though forts work quite differently, I think I can adapt Snarko's code to my mod in a future release. Thanks for the link. Maybe you should just add it to the first post of this thread in case anyone else wants to see the code.
 
I'm interested in any and all AI tweaks and changes. But in particular, what I was looking for is the code getting workers to build forts. Even though forts work quite differently, I think I can adapt Snarko's code to my mod in a future release. Thanks for the link. Maybe you should just add it to the first post of this thread in case anyone else wants to see the code.

I would, but the link also allows you to access the dev files (bump the directory back a level and you can get the xml/python/art/etc needed for 1.31), and we aren't opening that up quite yet. Soon. :p

New capability has been added, btw: LeashUnit. Same thing as LeashPlot, but a unit. :p Basically, if a unit has a LeashUnit set, you cannot move further than your leashrange away from the unit. If the LeashUnit moves, your leash, and available plots, moves with it. As with the other leash method, you can ALWAYS move closer to your leash, even if the plot you are moving to is still technically out of range.

The mechanic was requested several times, and I need it as a finishing touch for my module, so it's been added. Summons will have their leashunit set to their master automatically; If they have a leashrange somehow (give them a promo for it), then they will be leashed to their summoner. This will likely become standard behavior, for permanent summons at least. If a unit has both a LeashUnit and LeashPlot, the LeashUnit takes precedence.

The only way to really access this particular mechanic, though, is python. Can't be done with xml, as it refers to a specific unit object.
 
I hope to do it with a promotion wich

1. able to walk an peaks
2. force to go on/in the tunnel

Right now promotions can't be triggered if you are on a route (which a tunnel really should have to be, not an improvement, to do this right.) Fixing that would be an easy DLL change. The real problem is the catch-22 that you can't give this promotion to units unless they step into the tunnel, which is in a peak, and impassible. Also, once in the tunnel, units could step out of the tunnel into peaks.

And yes, as Valkrionn said, it's not just about visibility. The unit has to behave as if they cannot see a unit even if another unit on their team can. If you have a dwarf in a tunnel and a dwarf outside the tunnel, the dwarf outside can see on top of the peak. This will let the dwarf in the tunnel attack whatever is on the peak. Even if they couldn't attack, they couldn't share the same tile.

The system is not perfect. In many situations the underground/submerged/atmospheric unit will be able to see units because other units the player owns can. But that is not the point. The point is that in most cases the units will be able to occupy the same tile as an enemy and not be noticed. For the most part enemies will not be able to see these types of invisibility. Units with this effect could become bNeverHostile when they are in a different altitude. Since they aren't meant for direct combat while in these modes it works. Also when the unit is isolated from units which can see surface units, those units will be invisible. In other words if a Hill Giant is traversing a large mountain range and the dwarves are mulling around underneath, as long as land based units are not able to see the Hill Giant already, the underground dwarves don't gain any visual advantage. In fact, the dwarves under the mountain and units underwater should gain a vision nerf. Perhaps restricting them to the tile they occupy.

It's not a perfect system, but it could work for scouting purposes. There's an issue with giving a moving unit 0 visibility. I am pretty sure a unit cannot move directly into a tile that has not been revealed to it's team yet. So with 0 visibility, it won't reveal any tiles around it, so it won't be useful for scouting new territory.
 
Me and black_imperator tried the citiset thing but it seems that the files are not modular.

The files are:
CIV4CityLSystem.xml
GlobalTypes.xml

Can they be made modular at all?
 
Me and black_imperator tried the citiset thing but it seems that the files are not modular.

The files are:
CIV4CityLSystem.xml
GlobalTypes.xml

Can they be made modular at all?

Unfortunately, no, on the first one. No idea on the second, would lean towards no if it's not already (seeing as modular xml is part of BtS, I'd assume all xml files that can be done modularly have been)
 
dam... now I will have to... well I don't know what I will do.
Either way... does anyone know any good guide on the AI settings for leaders (the ones that are done via XML)?

I want to make 3 new leaders and I don't want them to turn out outright psychotic. Well, 2 out of 3 of them at least.
 
Right now promotions can't be triggered if you are on a route (which a tunnel really should have to be, not an improvement, to do this right.) Fixing that would be an easy DLL change. The real problem is the catch-22 that you can't give this promotion to units unless they step into the tunnel, which is in a peak, and impassible. Also, once in the tunnel, units could step out of the tunnel into peaks.

I've created a improvement (like Dwarven Gate or something else) where a unit can cast the spell "Enter Cave" and "Leave Cave" to gain and loose the promotion.
 
First, is it possible to have multiple features on a single tile? The idea is this:

If a mine is built, a tunnel (feature) is automatically added to the tile. The hope is that these tunnels will auto-spread over time (like other features). This represents the slow but steady work the miners are doing spreading their tunnels. But, I don't want the tunnels to override other features like forests etc. I know hills are features and forests can grow on hills, is there a way to ensure multiple features can co-exist?

Second, is it possible to have a promotion force units to move only on tiles with a specified feature?

I know its possible to limit units to certain terrain types? How hard would it be to limit them to forests/ancient forests etc. (or in this case tunnels).

If both of these effects can be created, I think they combine to make an interesting and fun way of allowing dwarves to use an underground network of tunnels, including under peaks. Dwarves inside tunnels could be given movement bonuses similar to roads, but be invisible to other units. It would allow them to walk under peaks, but be limited to only walking in the existing tunnels until more have "been built" (spawned).

Third, can improvements affect feature spread rates?

For example can building a mine/underhome on a tile speed the rate at which tunnels spread to adjacent tiles?

Ultimately this is what I am envisioning:

Dwarven workers building dwarven mines, which create tunnel "entrances." Dwarven (by race) units standing on these mines will have the option to take a free promotion representing the unit going underground. This promotion will make the unit invisible (with no unit being given the ability to see this type of invisibility except those that have it), the promotion allows walking on peaks, but forces the unit to stay on tiles with the tunnel feature. The promotion is blocks unit from attacking any other unit. The promotion removes the ability to build all improvements besides dwarven mine, and grants the ability to build a new improvement (underhomes) on (under) peaks. Earth's Boosom could be replaced with a spell allowing tunnels to be built on a tile (but not under peaks without true mountain climbing). Dwarven workers will be able to spread through tunnels into neutral and even enemy territory allowing interesting guerrilla tactics. The only entrances and exits to tunnels would be through the Dwarven mines (and their upgrades). So workers would build an exit mine from the underground out. A new Earth II spell could be given which allows tunnels to be destroyed on a tile. There are so many awesome possibilities with tunnels as features.

Edit: Another idea, perhaps the mapscripts could be editted to allow some random tunnels to already pre-exist (aka natural or ancient tunnels) dwarves (especially khazad) would have a flavor for them on start.
 
Can't you simply count tunnels as a type of road?
 
the problem is in building the road, in order to build a road on a peak, you need to be on that peak, but the unit should only be on the peak if it is in a tunnel thus a problem. Plus with tunnels as a route, both a road and a tunnel cannot be on the same tile. But I don't want units to have to choose to move underground or above ground on non peak tiles. Also features come with the ability to spread, while routes AFAIK don't.
 
Project Magpie is progressing, but I've got a stumbling block. I can control which units are available to specific civilisations by using Magpie_Civ4CivilisationInfos.xml, hence only the Grigori get a "Statesman" unit. How do I make a Guild unit available to all civilisations (e.g. Masquerade Gypsies) I found the PrereqCorporation tag, but this doesn't seem to be sufficient on its own.
 
I have a question about a feature you said you will be including.
The secondary unitcombat thing.

If I have a leader with the Spiritual trait, and a unit with Unitcombat_Adept and secondary Unitcombat_Disciple, will the unit benefit from the free Mobility and Potency from Spiritual?
 
I need to know that since the whole mechanic just fits incredibly for my Mage/Priest units.


Also, where is the music plaid when a player zooms over a city?
 
I wasn't really sure where I could ask this question, and this seemed like a topic somewhat pertaining to what I wanted to ask...

I thought it might be fun to do a minor reskin for the Ancient Forests... it was just for my own amusement, really, I wanted to make them a sort of goldish-yellow-orange, a bit like they did Lothlorien in the LotR movies. Just to see how I liked it, because I always had a little bit of trouble distinguishing Ancient Forests from normal ones, and I thought that would certainly make it easier. And give a little more flavor.

Trouble is, I can't seem to locate anything that I can identify as the skin for the Ancient Forests. I assumed it would be located somewhere in Rise from Erebus > Assets > Art, but I've been poring over it for nearly an hour and I can't find a thing. Is it hidden away in a compacted directory somewhere that I haven't noticed, or am I just ******ed?

Thanks a bunch to anyone who can give the moron a pointer. Even if you can't, thanks for giving this a read :p
 
Top Bottom