KarlBar99

General Modding Questions Thread (All Welcome)

General Modding Questions Thread (All Welcome)

Whilst i'm creating this for my own little pet project to ask dumb basic questions in, anyone who has a question and wants it answered should feel free to drop by, the lack of anything like this that i've been able to find, (maybe i'm blind :p), is a bit sad for everyone else who has questions.

 

 

Ok my first really basic question. is there any way to modify an existing entry in an XML file without overwriting the entire file? The readme talks about adding new stuff and Total Conversions fine, but my modified tech tree is going to need to add tech option entries to some existing improvements. Having to completely overwrite the existing improvements file is not ideal, and their may be other examples i need to edit.

 

Does anyone know is ComponentClasDefs.xml is working as far as adding and using entries. I know occasionally some files won't be enabled in some games and this strikes me as the type of file that's most likely to have issues.

80,469 views 118 replies
Reply #101 Top

Hadn't noticed that tag at all! Thank you!

Now it works the way I intended... :)

Reply #102 Top

Well, almost.

The <Role> tag in the blueprint definition seems to have no effect. Or maybe it's purpose is something else? At least it doesn't set the role of the ship. Looking at how the role changes as the components get updated the automatic designer seems to just do its default calculation of threat, fortitude, and value and set the role by that.

Is there any way to force the automatic designer to set a specific role?

Reply #103 Top

While playing around with my Enhanced Terraforming mod, I decided I should check out the debug.err file to see just how clean it was.  Looks more or less good. but I keep seeing this error in it:

Debug Message:  ERROR: GetTranslation() failed

I first see it after the tree for the Colonization branch was created internally.  Then I see it intermittently afterwards.  

The mod seems to run without any problems, but as I said, I like to keep my code clean. :)

Link to mod: https://drive.google.com/uc?export=download&id=0By8Y969dyvLHNDctWGdVX0g2Skk

Link to a sample debug.err file: https://drive.google.com/uc?export=download&id=0By8Y969dyvLHZ1ZxUjV3UnNiRUU

Any ideas what it could be and/or what I need to fix to clean it up? 

Reply #104 Top

Actually it doesnt seem to matter whether you have mods running or not, I get that error message repeatedly every time I start a game regardless.

I suspect it's some internal hook for alternate language versions which does not hook into anything at this time.

Reply #105 Top

Quoting Deathwynd, reply 104

Actually it doesnt seem to matter whether you have mods running or not, I get that error message repeatedly every time I start a game regardless.

I suspect it's some internal hook for alternate language versions which does not hook into anything at this time.

Interesting.  Just have to live with it, I suppose. :)

Reply #106 Top

Another batch of questions for the leanred assembly here. :)  I just talked about this in the thread for my mod, but I thought I would ask it here as well.

Is it possible to create a custom resource, have it so an improvement can use it, and give said custom resource to a faction WITHOUT it being mined?  It's more than a bit kludgy for what I want, but it seems to be one of the better avenues I have.

The second question I have is, is it possible to "turn on" a custom racial or grant a cultural trait for a faction mid-game?  This would be slightly less cludgy for me, but as long as it is mostly behind the scenes, I wouldn't care about the kludge factor.

I suppose the last question is, is it possible to grant a specific tech (that isn't currently being studied) to a faction mid-game?  If I could do that, I might have other avenues to explore.

Thanks in advance for any and all comments. :)

Reply #107 Top

You can't create a strategic resource. They're listed in the Enums rather than in an xml file (like, say, ship class augments).

 

I suspect the answer to the other two is also no, though I've not tried them myself. There doesn't seem to be much in the way of triggers that can be used to fire something on, say, turn 100. 

Reply #108 Top

Quoting naselus, reply 107
There doesn't seem to be much in the way of triggers that can be used to fire something on, say, turn 100. 

AIUI, that's not actually that difficult:

<Triggers>
<OnEvent>OnStartTurn</OnEvent>
<CriteriaTurnNum>100</CriteriaTurnNum>

BLAH BLAH BLAH

</Triggers>

it's getting to do it on EVERY turn is the problem.  If there is one thing I'd really like added to the modding kit, it'd be that. Hopefully as things expand, that'll be one of them. :)

Reply #109 Top

Well, you could use that trigger on a racial ability. Several of the others already use triggers. And you could set durations on certain effects - what kind of effect do you want to trigger?

Reply #110 Top

Quoting naselus, reply 109

Well, you could use that trigger on a racial ability. Several of the others already use triggers. And you could set durations on certain effects - what kind of effect do you want to trigger?

What I want is for all tiles on all planets (current and future) owned by a faction to be upgraded (upto LandPecentageMin .15) after an improvement is built.  I can get it so it works when:

The improvement itself is built

A future planet is colonized.

A future planet is conquered.

Getting it so the trigger fires when a later planet is culture flipped or purchased via trade isn't working no matter what I do on the improvement side.

---

Before I get TOO deep into this, can racial traits be assigned to preexisting factions via mod?  That is, make an appendable racial trait XML file?  If so, I might be able to play with that if I can get the racial trait to trigger when I want it to.

 

Reply #111 Top

No you cannot add a racial trait to an existing race via append, you could do it on an overwrite but just no way to do it via append.

Reply #112 Top

Huh.  This is interesting.  There are a few new things in 1.2.  One that immediately caught my eye:

In the new file ArtifactDefs.xml there are a couple of new things.  The tag "<Artifact>" is new as is "<PerTurnStats>" 

 Makes me wonder just what can be shoved into "<PerTurnStats>"
 
Hmmm....
 
(Lots of other new goodies in there as well, mostly centering around Mega Events)
 
Here is the entierty, so far, of ArtifactDefs.xml:
 

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<ArtifactList
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/ArtifactDefs.xsd">
<!-- Created with the Gal Civ 3 Editor -->
<!-- ArtifactDefs.xml -->

<Artifact>
<InternalName>DefaultArtifact</InternalName>
<DisplayName>DefaultArtifact_Name</DisplayName>
<Description>DefaultArtifact_Dec</Description>
<ArtDefine>DefaultArtifactArt</ArtDefine>

<Stats>
<EffectType>ProductionPoints</EffectType>
<Scope>Global</Scope>
<Target>
<TargetType>Colony</TargetType>
</Target>
<BonusType>Flat</BonusType>
<Value>0.25</Value>
</Stats>

<PerTurnStats>
<EffectType>ProductionPoints</EffectType>
<Scope>Global</Scope>
<Target>
<TargetType>Colony</TargetType>
</Target>
<BonusType>Flat</BonusType>
<Value>0.25</Value>
</PerTurnStats>

</Artifact>

</ArtifactList>

Hmmmmm.......

 

EDIT::::

*checks ArtifactDefs.xsd*

*sees that it looks like <Triggers> can be put in the ArtifactDef.xml*

Hmmmmm.......  

Wonder exaxctly what triggers can be put there.

Reply #113 Top

/Schema/ArtifactDefs.xsd will contain the list of what can be put in there. You can open it with notepad, though it'll default to Visual Studio if it's installed on your system. The exact set of triggers that can be put in will be listed in one of the Enum files listed at the top of the file as a dependency.

Reply #114 Top

Well I can only find reference to this in the ArtifactDefs.xml and ArtifactDefs.xsd and its attached to ModifierType in the xsd file, at a guess I suspect it adds .25 ProductionPoints globally to all colonies and then adds an additional .25 points times the number of turns elapsed in the game.

If this is the case it would be of tremendous use in balancing things like flat bonus research point amounts which quickly become meaninglessly small as the game progresses.

Unfortunately it is only defined in ArtifactDefs.xsd which means it cannot be used elsewhere unless SD is willing to add it as an option in other files such as improvements cultures anomalies race traits etc.

Reply #115 Top

Well, I asked at the live stream about adding resources. 4 times. And TurielD repeated it at least once, too... I don't think we're going to get it.

Reply #116 Top

Quoting Deathwynd, reply 114

Well I can only find reference to this in the ArtifactDefs.xml and ArtifactDefs.xsd and its attached to ModifierType in the xsd file, at a guess I suspect it adds .25 ProductionPoints globally to all colonies and then adds an additional .25 points times the number of turns elapsed in the game.

If this is the case it would be of tremendous use in balancing things like flat bonus research point amounts which quickly become meaninglessly small as the game progresses.

Unfortunately it is only defined in ArtifactDefs.xsd which means it cannot be used elsewhere unless SD is willing to add it as an option in other files such as improvements cultures anomalies race traits etc.

It came up in the devstream; it's tied to a Mega Event.  It's designed to make the weakest race more slightly more powerful each and every turn.  Sorta like the equivilent GC II Mega Event.

Reply #117 Top

Yeah I saw that, pretty cool just wish it was usable elsewhere.

Reply #118 Top

This was hidden far away. :P

Anyways, anyone here have some experience with modding events? I am trying to create a custom race that can't colony rush early, and want to create a on colonization event that spawns a third habitable planet in their solar system to boost them off since they can't colony rush. (similar to the benevolent free planet, the class 16 one) 

Is there any way to create unique events (only available once) this way? Because as I have it now, I would spawn a new planet at home every time I colonize a world... and that was not intended ;) There seems to be very little examples in the base game to draw from, so if anyone could point me to some good mods with events, that would help as well.