Noob here, is this written correctly?

Peng Qi

Emperor
Joined
Aug 19, 2007
Messages
1,431
Location
Irrelevant.
This is supposed to remove the WWI bomber, swap the Battleship with the Submarine on the tech tree, and move Destroyers to Replaceable Parts.

EDIT: Code revised already. See two posts down. Also, I need to know how to change prereq techs for other techs. Haven't researched such yet so that may be answered by the time you show up here. :D

EDIT: Latest version is now in post number seven.
 
EDIT: This version is now also out of date.

New version: Note that I'm doing this totally blind by comparing it to other XML code I see, having literally no training or experience with XML

Code:
<Units>
		<Update>
			<Delete Class="UNITCLASS_WWI_BOMBER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REFRIGERATION"/>
			<Where Class="UNITCLASS_BATTLESHIP"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_ELECTRONICS"/>
			<Where Class="UNITCLASS_SUBMARINE"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_DESTROYER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_ARTILLERY"/>
		</Update>
		<Update>
			<Set ObsoleteTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_RIFLEMEN"/>
		</Update>
	</Units>
 
New version: Note that I'm doing this totally blind by comparing it to other XML code I see, having literally no training or experience with XML

Code:
	<Units>
		<Update>
			<Delete Class="UNITCLASS_WWI_BOMBER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REFRIGERATION"/>
			<Where Class="UNITCLASS_BATTLESHIP"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_ELECTRONICS"/>
			<Where Class="UNITCLASS_SUBMARINE"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_DESTROYER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_ARTILLERY"/>
		</Update>
		<Update>
			<Set ObsoleteTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_RIFLEMEN"/>
		</Update>
	</Units>

1st, use code blocks at the beginning and end of any code you are "quoting" in your posts, because it makes it much easier to read the text of programming code that way.
  • place [.code] at the beginning of your XML coding "quote" (except without the period sign)
  • place [/.code] at the end of your XML coding "quote" (except without the period sign)
  • I have to show you the forum commands that way so the forum software will not try to perform the formatting it would otherwise do when it sees those two commands in that order
  • If you use the "Go Advanced" pushbutton when making a forum reply, you can use the hashtag button to automatically put "code" wraps around a selected group of text.

2nd, to the point of your question: No, you don't have everything correct yet.
  • This part is incorrect and will cause complete discard of the file where it occurs:
    Code:
    <Update>
    	<Delete Class="UNITCLASS_WWI_BOMBER"/>
    </Update>
  • To make a delete command that would remove all WWI bomber-class units from the game, you simply do as follows:
    Code:
    <GameData>
    	<Units>
    		<Delete Class="UNITCLASS_WWI_BOMBER"/>
    	</Units>
    </GameData>
  • <Delete> is never wrapped within <Update> -- </Update> or within <Row> -- </Row> or within <Replace> -- </Replace> or within <InsertOrAbort> - </InsertOrAbort> wraps. All of these are mutually exclusive to each other.
  • You can, of course, tack the rest of the code with the various <Updates> to the <Units> table you are doing onto that sample of code after the <Delete> line, as in:
    Spoiler :
    Code:
    <GameData>
    	<Units>
    		<Delete Class="UNITCLASS_WWI_BOMBER"/>
    		<Update>
    			<Set PrereqTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_BATTLESHIP"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_ELECTRONICS"/>
    			<Where Class="UNITCLASS_SUBMARINE"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_DESTROYER"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_ARTILLERY"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_RIFLEMEN"/>
    		</Update>
    	</Units>
    </GameData>
 
[*]<Delete> is never wrapped within <Update> -- </Update> or within <Row> -- </Row> or within <Replace> -- </Replace> or within <InsertOrAbort> - </InsertOrAbort> wraps. All of these are mutually exclusive to each other.
Is there a tutorial about <Replace> and <InsertOrAbort> somewhere? I have a feeling understanding these will be supremely useful to me. Kael's tutorial only covered Row, Update, and Delete.
 
Is there a tutorial about <Replace> and <InsertOrAbort> somewhere? I have a feeling understanding these will be supremely useful to me. Kael's tutorial only covered Row, Update, and Delete.


You only need Row, Update and Delete - stick with those until you have more experience - the other two will only just lead to more confusion ;)
 
So these are my two latest attempts at doing the things I want. The top one MOSTLY works! The obsoletetech entries don't seem to work for some reason, if anyone can tell me why that is.

The second bit doesn't seem to work at all.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 3/28/2015 7:27:01 PM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
 
  <!-- TODO: Insert table data example here.-->
  
  <!-- Enter your Game Data here. -->
	<Units>
			<Delete Class="UNITCLASS_WWI_BOMBER"/>
		<Update>
			<Set PrereqTech="TECH_REFRIGERATION"/>
			<Where Class="UNITCLASS_BATTLESHIP"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_ELECTRONICS"/>
			<Where Class="UNITCLASS_SUBMARINE"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_DESTROYER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_ARTILLERY"/>
		</Update>
		<Update>
			<Set ObsoleteTech="TECH_DYNAMITE"/>
			<Where Class="UNITCLASS_RIFLEMEN"/>
		</Update>
		<Update>
			<Set ObsoleteTech="TECH_REPLACEABLE_PARTS"/>
			<Where Class="UNITCLASS_CANNON"/>
		</Update>
		<Update>
			<Set ObsoleteTech="TECH_REFRIGERATION"/>
			<Where Class="UNITCLASS_FRIGATE"/>
		</Update>
	</Units>
</GameData>

This second one is supposed to just swap the requirements and location of Rifling and Military Science on the tech tree. It doesn't appear to do either. :(

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 3/28/2015 10:01:52 PM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
 
  <!-- TODO: Insert table data example here.-->
  
  <!-- Enter your Game Data here. -->
	<Technologies>
		<Update>
			<Where TechType="TECH_MILITARY_SCIENCE" GridY="6"/>
			<Set GridX="9"/>
			<Set GridY="8"/>
		</Update>
		<Update>
			<Where TechType="TECH_RIFLING" GridY="8"/>
			<Set GridX="9"/>
			<Set GridY="6"/>
		</Update>
	</Technologies>
	<Technology_PrereqTechs>
		<Update>
			<Where TechType="TECH_MILITARY_SCIENCE" PrereqTech="TECH_CHEMISTRY"/>
			<Set PrereqTech="TECH_ECONOMICS"/>
		</Update>
		<Update>
			<Where TechType="TECH_RIFLING" PrereqTech="TECH_ECONOMICS"/>
			<Set PrereqTech="TECH_CHEMISTRY"/>
		</Update>
	</Technology_PrereqTechs>
</GameData>

Once these two bits of code do what I want though, I'll officially have the bare minimum of my personal unofficial patch finished though! :D

Addendum: If you add a new PrereqTech to something, does it draw the line between those two items on the tech tree automatically or do you need to do that yourself somehow?
 
Addendum: If you add a new PrereqTech to something, does it draw the line between those two items on the tech tree automatically or do you need to do that yourself somehow?

When you reorganize social policies, the game automatically draws the lines for you. But that program makes some assumptions, it seems, and if your rearrangement violates them the arrows are wonked. Those assumptions are basically that the lines never cross. They may merge and diverge, but not pass over each other. Also, prereqs are above the requisitioning techs.

By moving Military Science and Rifling, you're forcing Rifling's arrow to Steam power to pass over Military Science -> Dynamite, if the game does that at all. I have no idea what could be wrong with your file otherwise. And even this shouldn't abort your changes.

Perhaps break down the file into multiple files , as many logically separate ones as you can, and try enabling them in pieces until you find which one doesn't work. The obsolete tech reassignments are each independent. Your musical chairs with modern naval assets would go together, as would the aforementioned industrial swapping. And the WWI bomber deletion can go in its own file. You can name it WWIBombersCauseCancer.xml or whatever it is you have against them.
 
You can name it WWIBombersCauseCancer.xml or whatever it is you have against them.
Lulz. The whole file's name is already BomberKill.xml. :D

Does an XML file that changes the tech tree ordering or the like need to be loaded into VFS? If not, would it cause a problem if it were loaded?

I'm attempting a different and far more simple solution now. Thanks for all the help!
 
Top Bottom