Quick Modding Questions Thread

more siblings than memory allocated for them in CvXMLoadUtility::Setvariabletag pair...

??? what does this error mean?
 
I figured it meant the XML was screwed up, I was hoping it provided a hint on how it was screwed up so I didn't have to go find the line.
I ended up deleting the file, and making a new one.

Firstly, you don't edit the game files. At all. Instead, you put edited copies of the files in CustomAssets (or something) and load them modularly.
I know but I need to know which file to copy to start with.

If I want to pass a mod on to someone else, I should just be able to send a zipped copy of the mod folder, right?

On another note, can I have a unit see two invisible unit classes?
 
I know but I need to know which file to copy to start with.
What I meant was that you look for a BtS version first, and if that fails you use the Warlords version. Only if there is none of the above should you make a copy of the Vanilla file for your mod.

If I want to pass a mod on to someone else, I should just be able to send a zipped copy of the mod folder, right?
Yeah.
 
1. Does the AI know how to use guided missile?
2. Can the AI handle a land (or air) based missile launcher unit (as opposed to the current sea-based Missile Cruiser and Submarine)?
 
I think the answers to these are:

1) Somewhat. It isn't very good at it, but it does use them.

2) No. There is no land unit AI that uses missiles. If you give a land unit the sea unit AI that uses missiles then it still doesn't seem to work (and it may never build the unit except in a port city as well).

These two things, and especially point number 2, are some of the reasons why the AIs in Final Frontier (including the Plus version) are a lot worse at fighting wars than the player. They never load missiles onto their cruisers. The other, similar, problem is that they never load fighters onto a carrier or starbase (they do not normally build carriers at all, which is actually good because without the ability to carry fighters they are a waste of production). They sometimes have missiles on starbases because starbases periodically produce a missile for free that is automatically forced onto it (even though the starbase unit isn't actually defined to carry missiles, they can carry fighters, the Python that does this forces it to happen and it doesn't cause any problems), although the AI apparently sometimes moves them off the starbase.

You sometimes see them moving missiles out of harms way when a star system is seriously threatened, like it does with fighters & bombers (but not very well in either case) instead of realizing that they are very cheap (and often free, in the case of those produced by starbases) and should just be used - it might save the star system, or at least make the attackers loose a ship or two that they wouldn't have lost if you didn't use them.

Dune Wars has some custom code in the unit AIs. I know it has some custom stuff that makes land transports usable by the AI. It may have some for carriers, but I don't remember ever seeing the AI use a suspensor carrier unit so it might not.
 
I think the answers to these are:

1) Somewhat. It isn't very good at it, but it does use them.

2) No. There is no land unit AI that uses missiles. If you give a land unit the sea unit AI that uses missiles then it still doesn't seem to work (and it may never build the unit except in a port city as well).

These two things, and especially point number 2, are some of the reasons why the AIs in Final Frontier (including the Plus version) are a lot worse at fighting wars than the player. They never load missiles onto their cruisers. The other, similar, problem is that they never load fighters onto a carrier or starbase (they do not normally build carriers at all, which is actually good because without the ability to carry fighters they are a waste of production). They sometimes have missiles on starbases because starbases periodically produce a missile for free that is automatically forced onto it (even though the starbase unit isn't actually defined to carry missiles, they can carry fighters, the Python that does this forces it to happen and it doesn't cause any problems), although the AI apparently sometimes moves them off the starbase.

You sometimes see them moving missiles out of harms way when a star system is seriously threatened, like it does with fighters & bombers (but not very well in either case) instead of realizing that they are very cheap (and often free, in the case of those produced by starbases) and should just be used - it might save the star system, or at least make the attackers loose a ship or two that they wouldn't have lost if you didn't use them.

Dune Wars has some custom code in the unit AIs. I know it has some custom stuff that makes land transports usable by the AI. It may have some for carriers, but I don't remember ever seeing the AI use a suspensor carrier unit so it might not.

Thanks for the info. How about just launching missiles from cities? Would the AI do that? I was thinking of increasing missile range (at say Robotics) but I don't want to do that if the human player is going to get a big advantage over the AI.
 
So I was playing the "Road to War" mod, and I must say, in general, I think the combat system is broken.
Any artillery in your stack seem to do a "ranged bombardment" before another unit in the stack attacks, and they keep doing this for every unit in the stack- way over powered.
(not to mention the ranged bombardment can kill units, as can air units

However, there are some mechanics I liked.

#1) Ranged bombardment - it seems more like it is actually carrying out an airstrike on the target tile- How can I mod this into one of my own mods?

#2) Anti-Air guns- they can be set to intercept, and take damage from enemy fighters they intercept, as if doing combat with them like an intercepting plane.

Combine #1, and #2, and I have all the mechanics I want for a VTOL fighter (harrier, F-35, Yak-38/141, etc) - a unit that can move on any square, as opposed to just sitting in cities, and perform all the roles of a normal fighter.

However, both #1 and #2 can defend against attacks from ground units.
I'd like a "VTOL" fighter to need a "garrison"/ stack to protect it.

If I can combine mechanic #1 and #2 into a single unit, how can I prevent it from defending against ground attacks?
also, Ideally it could be intercepted when doing its "ranged bombardment" gimmick.

And lastly, is there any way I can make paratroopers able to launch from an aircraft carrier (or other dedicated ship)
 
So I was playing the "Road to War" mod, and I must say, in general, I think the combat system is broken.
I have made significant changes in the way artillery and aircraft are used and it is much better balanced now. Also SoDs are virtually non-existent
 
#1) Ranged bombardment - it seems more like it is actually carrying out an airstrike on the target tile- How can I mod this into one of my own mods?

Just set for a normal ground unit iAirRange to something higher than 0.

Else you can use RevDCM, where this system is also present.

For the rest i have no real idea :/.
 
*edit* New Question:
I just played a game, reloaded several times, marathon speed - modded, and map edited with world builder.
It plays fine until 3715 BC, then it always crashes to the desktop at the end of the 3715 BC turn.
Any hints as to why?
(I wonder if it has to do with random events)


#1) Ranged bombardment - it seems more like it is actually carrying out an airstrike on the target tile- How can I mod this into one of my own mods?
Just set for a normal ground unit iAirRange to something higher than 0.

I'm pretty sure doing that for a ground/naval unit will only increase its interception radius, it won't allow ranged bombardment (to my knowledge).


Switching to another question:
building prereqs for units... the way I read them (such as for the missionaries), it looks for the specific building, not the building class.
Thus if I want to make certain units require Building_Factory, then Germany is SOL because it will only have Building_German_Assembly_Plant - and the only remedy I see is to make a UU for germany for each of those units, and have it require the assembly plant instead (which is trivial for Panzers/ tanks).

Am I missing something?

And I'll repeat a question earlier...
Can I have a unit see two invisible classes?


*Edit*
Crash log:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000240
Crashed Thread: 0

Thread 0 Crashed:
0 com.aspyr.civ4bts 0x001864d0 CvUnitInfo::getBuildings(int) const + 6
1 com.aspyr.civ4bts 0x000dfd9d CvCityAI::AI_specialistValue(SpecialistTypes, bool, bool) + 1181
2 com.aspyr.civ4bts 0x000df7b6 CvCityAI::AI_addBestCitizen(bool, bool, int*, SpecialistTypes*) + 456
3 com.aspyr.civ4bts 0x000debc1 CvCityAI::AI_updateWorkersNeededHere() + 879
4 com.aspyr.civ4bts 0x000defa5 CvCityAI::AI_doTurn() + 95
5 com.aspyr.civ4bts 0x000cea47 CvCity::doTurn() + 123
6 com.aspyr.civ4bts 0x0020220d CvPlayer::doTurn() + 367
7 com.aspyr.civ4bts 0x00202a35 CvPlayer::setTurnActive(bool, bool) + 1495
8 com.aspyr.civ4bts 0x00202c74 CvPlayer::setAutoMoves(bool) + 78
9 com.aspyr.civ4bts 0x000f4d43 CvGame::updateMoves() + 325
10 com.aspyr.civ4bts 0x00104415 CvGame::update() + 285
11 com.aspyr.civ4bts 0x00a763b1 CvApp::OnIdle() + 1137
12 com.aspyr.civ4bts 0x00653227 FWinApp::Run() + 31
13 com.aspyr.civ4bts 0x00b0e5ac WinMain + 50
14 com.aspyr.civ4bts 0x000a7f01 sEventLoopEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 111
15 com.apple.HIToolbox 0x94b6713d DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1181
16 com.apple.HIToolbox 0x94b6657b SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
17 com.apple.HIToolbox 0x94b663e0 SendEventToEventTargetWithOptions + 58
18 com.apple.HIToolbox 0x94b94d54 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 356
19 com.apple.HIToolbox 0x94b674f6 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2134
20 com.apple.HIToolbox 0x94b6657b SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
21 com.apple.HIToolbox 0x94b82ecc SendEventToEventTarget + 52
22 com.apple.HIToolbox 0x94befa6c ToolboxEventDispatcher + 86
23 com.apple.HIToolbox 0x94bec2c2 RunApplicationEventLoop + 222
24 com.aspyr.civ4bts 0x000a7fba InstallEventsAndRunGameLoop() + 166
25 com.aspyr.civ4bts 0x000a8352 main + 356
26 com.aspyr.civ4bts 0x000025d2 _start + 216
27 com.aspyr.civ4bts 0x000024f9 start + 41
...
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x0000006d ecx: 0x00000004 edx: 0x38964c00
edi: 0x00000000 esi: 0x00000004 ebp: 0xbfffe778 esp: 0xbfffe778
ss: 0x0000001f efl: 0x00010206 eip: 0x001864d0 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x00000240
 
*edit* New Question:
I just played a game, reloaded several times, marathon speed - modded, and map edited with world builder.
It plays fine until 3715 BC, then it always crashes to the desktop at the end of the 3715 BC turn.
Any hints as to why?
(I wonder if it has to do with random events)

3715 BC is not a standard date, AFAIK -> did you change the calendar?


I'm pretty sure doing that for a ground/naval unit will only increase its interception radius, it won't allow ranged bombardment (to my knowledge).

Not sure about that, but i've copied the ranged bombardment ability from another unit to my mod, and as far as i can see the only difference is the iAirRange.

Switching to another question:
building prereqs for units... the way I read them (such as for the missionaries), it looks for the specific building, not the building class.
Thus if I want to make certain units require Building_Factory, then Germany is SOL because it will only have Building_German_Assembly_Plant - and the only remedy I see is to make a UU for germany for each of those units, and have it require the assembly plant instead (which is trivial for Panzers/ tanks).

Am I missing something?

No, you're right, it's a bad implementation.


And I'll repeat a question earlier...
Can I have a unit see two invisible classes?

I think you can put both invisible classes just comma separated into the tag, but not sure about it.
 
I found some excellent Modparts which I put together in my DLL, but is there somewhere a guide which file to edit for the amount of players allowed? I can imagine this is only one or two lines of text, can someone tell me in which file(s) to edit which line(s)?

Thank you
 
A unit that is not air domain unit can do a "range strike" if you set its air range to > 0 and its air strength > 0.

The code to determine if a unit can use a ranged strike:
Code:
bool CvUnit::canRangeStrike() const
{
	if (getDomainType() == DOMAIN_AIR)
	{
		return false;
	}

	if (airRange() <= 0)
	{
		return false;
	}

	if (airBaseCombatStr() <= 0)
	{
		return false;
	}

	if (!canFight())
	{
		return false;
	}

	if (isMadeAttack() && !isBlitz())
	{
		return false;
	}

	if (!canMove() && getMoves() > 0)
	{
		return false;
	}

	return true;
}
As you can see from the code, if the unit has blitz it can do ranged attacks multiple times per turn. Each attack uses movement.

The only units in the game as shipped that can do this are in mods that come with the game. The Next War mod has the Assault Mech (which has blitz and 3 moves, so it can do it a lot) and the Final Frontier mod has the Starbase (which is actually DOMAIN_IMMOBILE which works fine for this; you can also add this to sea units since DOMAIN_SEA is also not DOMAIN_AIR). There might be more, but these are the ones I remember.
 
OK, cool.
My next question is if the ranged strikes can be "intercepted", and if you have to add a special button for them?

How does one make something like the AA gun in road to war, where it is a ground unit that can defensively intercept, but can also take damage from the intercepted unit?

I guess I'll try and figure it out myself while waiting for a response.
 
Back
Top Bottom