Jump to content
Dog

Creating a LogicCommand to build a unit

Recommended Posts

Hi, I am trying to do a simple KW mod that will add units to different factions. However I can't seem to make a functioning LogicCommand to build anything.

I made a file called LCS.xml that modifies the Factory and the Hand of Nod.

<?xml version="1.0" encoding="utf-8"?>
<AssetDeclaration xmlns="uri:ea.com:eala:asset">
	<LogicCommandSet
		id="NODDropZoneCommandSet">
		<Cmd>Command_ConstructNODAttackBike</Cmd>
		<Cmd>Command_ConstructNODScorpionBuggy</Cmd>
		<Cmd>Command_ConstructNODRaiderTank</Cmd>
		<Cmd>Command_ConstructNODHarvester</Cmd>
		<Cmd>Command_ConstructNODMCV</Cmd>
		<Cmd>Command_ConstructGDIMCV</Cmd> <!-- added this line -->
		<Cmd>Command_ConstructNODFlameTank</Cmd>
		<Cmd>Command_ConstructNODBunkerTruck</Cmd>
		<Cmd>Command_ConstructNODBeamCannon</Cmd>
		<Cmd>Command_ConstructNODStealthTank</Cmd>
		<Cmd>Command_ConstructNODMobileArtillery</Cmd>
		<Cmd>Command_ConstructNODAvatar</Cmd>
		<Cmd>Command_RepairVehicle</Cmd>
	</LogicCommandSet>
	
	<LogicCommandSet
		id="NODHandOfNODCommandSet">
		<Cmd>Command_ConstructNODMilitantSquad</Cmd>
		<Cmd>Command_ConstructNODMilitantRocketSquad</Cmd>
		<Cmd>Command_ConstructNODSaboteur</Cmd>
		<Cmd>Command_ConstructNODFanaticSquad</Cmd>
		<Cmd>Command_ConstructNODBlackHandSquad</Cmd>
		<Cmd>Command_ConstructNODTibTrooperSquad</Cmd> <!-- added this line -->
		<Cmd>Command_ConstructNODShadowSquad</Cmd>
		<Cmd>Command_ConstructNODCommando</Cmd>
	</LogicCommandSet>
</AssetDeclaration>

Then I made LC.xml and tried to define a Logic Command: (I eventually want to make my own NODTibTrooperSquad so the object is just a placeholder for now)

<?xml version="1.0" encoding="utf-8"?>
<AssetDeclaration xmlns="uri:ea.com:eala:asset">
	
<LogicCommand
	Type="UNIT_BUILD"
	id="Command_ConstructNODTibTrooperSquad">
	<Object>MarkedOfKaneTibTrooperSquad</Object>
</LogicCommand>

</AssetDeclaration>

It compiled in WrathEd without any errors. When I got into the game, my Factory was able to produce a GDI MCV but the Tiberium Trooper didn't show up in the Hand of Nod at all, so my LogicCommandSet works but there seems to be something wrong with my LogicCommand.

(I looked at my mod's .big in WrathEd and Command_ConstructNODTibTrooperSquad existed but had 0 AssetReferences, while all the game's built-in Command_Construct* commands have a reference to the thing they're supposed to build. So I feel like that might be what I'm doing wrong but I am not sure how to fix it...)

If it's needed, my Static.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<AssetDeclaration xmlns="uri:ea.com:eala:asset">
	<!-- Main Mod File for Static Data -->
	<Includes>
		<Include type="reference" source="DATA:static.xml" />
		<Include type="reference" source="DATA:global.xml" />
		
		<Include type="reference" source="AdditionalMaps\MapMetaData_Global.xml" />
		
		<Include type="all" source="LC.xml" />
		<Include type="all" source="LCS.xml" />
	</Includes>
</AssetDeclaration>

Anyone know what could be wrong?

Edited by Dog

Share this post


Link to post

Looked into it; have no idea why but for some reason but the object id in the Logic Command does not match the Game Object ID. When I copied MarkedOfKaneTibTrooperSquad from this post to the GameObject xml file and used the find function on Notepad++ (Ctrl+F), the logic command version did not highlight.

Then when I copied the object from your logic command, by pasting as plain text in here the result was; Mar kedOfKaneTibT rooperSqua d. So there is something extra present, albeit no idea what it is.

Recommend retyping, see if it works

Share this post


Link to post

Thanks for investigating! Unfortunately that issue just seems to be a result of copy-pasting to/from here rather than something wrong with my code. I did the same find function thing as you, only I copied from my original code rather than the post, and it matched. Just to make sure, I looked at all of my source files in a hex editor to verify there were no invisible characters or Unicode weirdness and all of them were fine.

Share this post


Link to post

The problem was just that I was using an ancient version of WrathEd. With the update everything worked great.

It's just a simple thing but it's always nice when stuff works! :thumbsup:

Nod.jpg.cf7f3816b18203d84ea3cf152b92e060.jpg

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×