Adding New Crate Surprises

No Avatar

Rebelmoon

Category: Code
Level: Beginner
Created: Monday September 17, 2007 - 11:19
Updated: Monday September 17, 2007 - 12:32
Views: 5352
Summary: A basic example of adding new crates.
Rating
  • Staff4.0
  • Members-
  • Average4.0/5.0

1 vote

This is a simple basic tutorial to adding new crate surpises.

Required tools: Text Editor & SDK
Locations: data (in your mod folder), CnC3Xml
XML Files Needed: GenericCrateSpawner.xml & UnitCrate.xml

I prefer Notepad++ for my XML editing because it has syntax highlighting, tabbed interface, a built-in hex editor & other useful features. Plus it's free which is always a great feature.

In this we'll be adding a Predator crate so you'll only need to add 2 new xml files to your mod. The 1st is the GenericCrateSpawner.xml found in the Neutral/Units folder. The next is the UnitCrate.xml found in your Neutral/Crates folder. Make copies of both in your Mod/Data folder.

1st we'll make the Predators crate info. Open the UntiCrate.xml and look for the following code ID under Game Object.

              
Code
<GameObject
id="UnitCrate"


Change the ID to:

              
Code
<GameObject
id="UnitGDIPredatorCrate"


Next go to the following code under Behaviors:

              
Code
<Behaviors>
<UnitCrateCollide
id = "ModuleTag_CrateCollide"
UnitCount="4"
UnitType="GDIPitbull"></UnitCrateCollide>


Change it to:

              
Code
<Behaviors>
<UnitCrateCollide
id = "ModuleTag_CrateCollide"
UnitCount="1"
UnitType="GDIPredator"></UnitCrateCollide>


If you don't want to know what type of crate it is ingame before grabbing it then change this line of code:

              
Code
<DisplayName>NAME:UnitCrate</DisplayName>


To this:

              
Code
<DisplayName>NAME:Crate</DisplayName>


Finally, save it and then rename it as UnitGDIPredatorCrate.xml

Ok, that part is done. Next comes the GenericCrateSpawner.xml which tells the game what crates to spawn. This bit is simple and quick.

Open and find this code under Behaviors:

              
Code
<Behaviors>
<SpawnCrateUpdate
id="ModuleTag_SpawnCrateUpdate">
<CrateList>MoneyCrateMP</CrateList>
<CrateList>VeterancyCrateMP</CrateList>
<CrateList>HealCrateMP</CrateList>


Just add your new crate name like this:

              
Code
<Behaviors>
<SpawnCrateUpdate
id="ModuleTag_SpawnCrateUpdate">
<CrateList>MoneyCrateMP</CrateList>
<CrateList>VeterancyCrateMP</CrateList>
<CrateList>HealCrateMP</CrateList>
<CrateList>UnitGDIPredatorCrate</CrateList>



Save and you're done with that one.

Lastly, open your mod.xml and add both the GenericCrateSpawner.xml & UnitGDIPredatorCrate.xml files to it and save.

That's it. Just build and play. You will need to make a unit file for each unit you want added. And it's not just limited to units. Any number of things can be added, like exploding crates, etc, so play around with it and have fun.

Cheers,

Rebelmoon

Comments

Display order: Newest first

Banshee (Administrator) - Saturday May 5, 2012 - 17:38

Upgrades Tutorial linked by Phil is now located at http://cncguild.net/item-151?addview

Boomerang Python - Saturday September 29, 2007 - 5:04

This brings up some crazy ideas in my mind..

Rebelmoon - Monday September 17, 2007 - 12:33

Thanks Dark Lord, I've updated it.

Cheers,

Rebelmoon

Phil (Administrator) - Monday September 17, 2007 - 11:38

You can add code tags like the ones on the boards [ code ][ /code ] (without the spaces). I've added them for you now.
It would probably also be a good idea to provide some short info about required tools and such, like I added in my Upgrades Tutorial.

Return to top