Problem with adding units

kkmo

世界
Joined
May 22, 2008
Messages
1,245
Hi there. I tried adding a unit, Soviet MLRS, to the game. Here is what I have so far, backtracking:

Warlords/Mods/Red Dawn/Assets/Art/Units/Soviet_MLRS/Soviet_MLRS_FX.nif
Warlords/Mods/Red Dawn/Assets/Art/Units/Soviet_MLRS/Soviet_MLRS_gloss.dds
Warlords/Mods/Red Dawn/Assets/Art/Units/Soviet_MLRS/Soviet_MLRS.dds
Warlords/Mods/Red Dawn/Assets/Art/Units/Soviet_MLRS/Soviet_MLRS.nif

Warlords/Mods/Red Dawn/Assets/Art/Interface/Buttons/Units/Soviet_MLRS.dds

And then all of the XML files. It does not seem to be an XML problem, because when I go into World Builder, I can see the unit "Soviet MLRS", but the button looks scrambled and crappy, no discernable image there, and when I place the unit on the map, it is the shape of the MLRS, but it is bright pink. When I try to select the unit, Civ4 crashes.

What could be the problem?

I am using this MLRS unit... are there key files missing from the .zip?
 
you have a problem with your art defines xml. pink blobs = art defines problems 95% of the time.
 
The path in the art define should be relative to the Assets folder - so Art/Units/.... rather than Warlords/Mods/Red Dawn/Assets/....
 
First of all, thanks for the quick responses and the help.

Here is my code:

Code:
<UnitArtInfo>

			<Type>ART_DEF_UNIT_SOVIET_MLRS</Type>

			<fScale>0.61</fScale>

			<fInterfaceScale>1.3</fInterfaceScale>

			<NIF>Art/Units/SovietMLRS/Soviet_MLRS.nif</NIF>

			<KFM>Art/Units/SovietMLRS/Lion.kfm</KFM>

			<SHADERNIF>Art/Units/Soviet_MLRS/Sovie_MLRS_FX.nif</SHADERNIF>

			<ShadowDef>

				<ShadowNIF>Art/Units/SovietMLRS/Soviet_MLRS_FX.nif</ShadowNIF>

				<ShadowAttachNode>LionBip Spine1</ShadowAttachNode>

				<fShadowScale>1.0</fShadowScale>

			</ShadowDef>

			<fBattleDistance>0.35</fBattleDistance>

			<fRangedDeathTime>0.28</fRangedDeathTime>

			<bActAsRanged>0</bActAsRanged>

			<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>

			<AudioRunSounds>

				<AudioRunTypeLoop/>

				<AudioRunTypeEnd/>

			</AudioRunSounds>

		</UnitArtInfo>

So the folders seem to have the right code. I think what the problem may be is that I am using Warlords, but the Mobile SAM unit came with BtS, correct? And in the file it says to use the Mobile SAM shaders I believe.

Is there a way around this, or I suppose I would have to use a different unit?
 
There is a typo in the <Shadernif> part (soviet)

And the <KFM> and <ShadowDef> look phony to me. I am quite sure the MLRS unit does not have a LionBip_Spine node to attach the shadow nor does it animate like a lion (KFM is animation) And you shouldn't use the unit itself as shadow... There are usually no shadows included with custom units. Just use a shadow from a similar unit in the game.

It's als best to take the art define from a simiar unit as base for copy and paste. A Lion is not all that similar to a MLRS.

Also while you can rename the .nif files, if you really need to (why ?!) you really shouldnt just go and rename the textures - how the game is suppsed to know, that you renamed m270.dds into whatever ?


The author said the MLRS should use mobile sam anim... so why not take mobile sam as base... Then we insert our file names for Nif and Shadernif (i used the authors names) and Button (no idea how the file is called). We keep the Shadow as it is, because we dont have one and the Mobile sam is similar enought and keep the KFM as it si, becasue the author specifically told us too.
Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_MOBILE_SAM</Type>
			<Button>[COLOR="Red"]Art/Units/SovietMLRS/Your_Button_Name[/COLOR]</Button>
			<fScale>0.57</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
			<bActAsLand>0</bActAsLand>
			<bActAsAir>0</bActAsAir>
			<NIF>[COLOR="Red"]Art/Units/SovietMLRS/M270.nif[/COLOR]</NIF>
			<KFM>[COLOR="Green"]Art/Units/MobileSam/MobileSam.kfm[/COLOR]</KFM>
			<SHADERNIF>[COLOR="Red"]Art/Units/SovietMLRS/M270_FX.nif[/COLOR]</SHADERNIF>
[COLOR="Green"]			<ShadowDef>
				<ShadowNIF>Art/Units/01_UnitShadows/MechInfantryShadow.nif</ShadowNIF>
				<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
				<fShadowScale>.8</fShadowScale>
			</ShadowDef>[/COLOR]
			<iDamageStates>4</iDamageStates>
			<TrailDefinition>
				<Texture>Art/Shared/tanktread.dds</Texture>
				<fWidth>0.7</fWidth>
				<fLength>180.0</fLength>
				<fTaper>0.0</fTaper>
				<fFadeStartTime>0.2</fFadeStartTime>
				<fFadeFalloff>0.35</fFadeFalloff>
			</TrailDefinition>
			<fBattleDistance>0.35</fBattleDistance>
			<fRangedDeathTime>0.12</fRangedDeathTime>
			<bActAsRanged>1</bActAsRanged>
			<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
			<AudioRunSounds>
				<AudioRunTypeLoop>LOOPSTEP_TANK</AudioRunTypeLoop>
				<AudioRunTypeEnd>ENDSTEP_TANK</AudioRunTypeEnd>
			</AudioRunSounds>
		</UnitArtInfo>

PS> As your problem seem to be more than just a couple of typos, i would suggest to take a look in the tutorial section - http://forums.civfanatics.com/showthread.php?t=236836 - here is a index of tutorials - there are some on adding units.


Edit: I see you dont have BTS, so you dont have the mobile sam unit... Try useng Mobile Artillery or Mech Infantry insetead - it will give you a shadow and sound definitions, but the unit will not animate - to make it animate you need the mobile sam animation files.
 
Refar,

Thanks very much for the help. I noticed that typo and changed it earlier. I see what you mean, though. I had looked at a tutorial, but it said I could use any unit, but it was going on if I were to be using the Warrior frame, I believe. It makes sense that a MLRS would not look like a lion. That is probably why when I tried to create a Latino Conscripts unit, similar to Infantry, the unit was tiny.

So when the author says, uses Marine animations with an Infantry model, I am guessing that means to copy the Infantry unit in ArtInfos, and then use a Marines.kfm file.

I did this with the Latino Conscripts unit I am trying to organize, and it worked great after I followed your steps and changed some of the names and tags to be less jumbled and more game-friendly. The game didn't crash and the unit was spot-on.

However, one interesting note. I had unit and improvement animations turned off, and the units I placed using WorldBuilder were a bright pink - the perfect figure of the units, but pink, and the game was *not* crashing, it would allow me to move the units... and whenever the units were selected or moving, they were normal, and not pink. When they were done moving, pink again. So I turned animations on, and the units were no longer pink because they were always moving. Is there anything I did wrong so that the units are pink when they are stationary, or is this something that cannot be avoided?

Thanks again for your help!!

Edit: Another quick question... what is the link to the webpage that explains what all of the tags mean in UnitInfos?
 
That is probably why when I tried to create a Latino Conscripts unit, similar to Infantry, the unit was tiny.
You can scale the unit using the <fScale> tag. It's a bit tedious, because you need to go by trial and error...

However, one interesting note. I had unit and improvement animations turned off, and the units I placed using WorldBuilder were a bright pink - the perfect figure of the units, but pink, and the game was *not* crashing, it would allow me to move the units... and whenever the units were selected or moving, they were normal, and not pink. When they were done moving, pink again. So I turned animations on, and the units were no longer pink because they were always moving. Is there anything I did wrong so that the units are pink when they are stationary, or is this something that cannot be avoided?

This is a odd one, i did not seen so far. It might be somehow connected to missed or wrong animations (not necessarily your fault)... But i dont really know...
Perhaps it's what those UnitName_freeze****.nif files are for (Look into one of the Warlods default units, if you dont know what i mean)...

It's a looong shot, but you could this:
(Say for example the unit is called UnitName.Nif, the foler would be ModName\Assets\Art\Units\UnitName)

* Copy the animation that should be used on that unit into your units folder - but don't rename them. (Those are the .KFM and all .KF files)
* Change the <KFM> tag in the art define to point to the copied files insted of the Originals. Meaning Art\Units\UnitName\AnimationFileName.kfm
(This, so everything is present into the Units folder and no links go to outside of the Mod - i am not sure if that is necessary, but just to be sure -because i do not know what place the game will search for those "freeze"-files).
* Make three copies of the units .nif them UnitFile_freeze1000.nif and UnitFile_freeze1021.nif and UnitFile_freeze1031.nif (1000, 1021 and 1031 are the "idle" event codes for different types of units.)

Again its only a - somewhat educated - guess. If you try it, leave a note if it works please ;)
 
Scaling seems interesting. Well, I am proud to say I have succeeded (95%, if the stationary units were not pink) in implementing my first unit into XML. I am new to XML, so it is a big deal for me. :)

I tried it out and it didn't work. I think it might be something else, but I'm not sure what. Do we have to tell it in the ArtInfos to use the Freeze version or something? Who knows. I might just have to stick a huge notice on my scenario, "Before you play make sure animations are turned on!" The down-side to this is I know some people turn animations off because it makes their systems sluggish. I see no other way around the problem tho. :/
 
Do we have to tell it in the ArtInfos to use the Freeze version or something? Who knows.
Pity. No there are no tags to point to those freeze thingies - that's why i was not really sure in the first place... I just know, that they are completely static and that those numbers correspond to some animation sequences - so the hypothesis, them somehow beeing meant fo the "no animation"-mode was possible - but i have no idea, how and if at all the game will know how or when to use it... Maybe they need to have the name of the animation, rather than the name of the unit... Or maybe they are just some kind of bogus...
 
Okay *sigh* another problem. I am trying to install the T-72 unit. I have all of my tags right, my art folder is spot on, everything should be fine. When I go into WorldBuilder, first of all, the button is pink (so the .dds is not working) and when I place the T-72 it looks identical to the Tank unit. I am using Tank .kfm and tank FX, because only a standard .nif file was included. Do I copy and rename the T72.nif to T72_FX.nif?

Oh, and one more thing you should know (because this might be why your theory did not work), I am on a Mac. :nuke:
 
The problem with freezed animation is afaik exactly what Refar expect and the solution sounds also good,

as i made a test with my models without the freeze nifs (all), models using a standard animation used the freeze files from the model where i used animation (for example a model using fighter animation was the standard fighter without animation and changed only when moving), so the games search the for the files where the animation is. Models with custom animation and without freeze nif were shown properly but also fully animated. It seems if you really want models also shown correct with frozen animation, than after you copy the animation you must create the necessary freeze nifs.

Additional when you copy an animation (kfm, kf files) also copy the nif, when the nif of the target folder has not the same name (in the kfm file is a link to this nif)

But after this logic there should be a missing texture in your marine folder (because the game should use the freeze nifs from the marine) :confused:

Edit: if you pc is good, the game uses the model you link in the shader (FX) tags, so here it uses tank_fx (the standard tank), if you only have one nif, simply link to this nif in both tags (NIF, SHADERNIF)
 
I wonder why my freeze files are not working. :confused: They actually came with the unit, and I made the link go to marines.kfm, in the unit folder I created.

Additional when you copy an animation (kfm, kf files) also copy the nif, when the nif of the target folder has not the same name (in the kfm file is a link to this nif)

I'm not quite sure I understand this. Does this mean I need to copy tank.kfm and paste it in my T-72 folder?

Why is it that in my vanilla civ and warlords civ folders, I cannot see all of the unit graphics? Some are missing, but the game shows them. Does it have to with unpacking those pkg files?
 
I'm not quite sure I understand this. Does this mean I need to copy tank.kfm and paste it in my T-72 folder?
Yes, i didn't think of this myself...
Why is it that in my vanilla civ and warlords civ folders, I cannot see all of the unit graphics? Some are missing, but the game shows them. Does it have to with unpacking those pkg files?
This is because (at least on windows) the Vanilla art-files came packaged into those
Assets*.fpk files.... There is a PakBuild utility (http://forums.civfanatics.com/showthread.php?t=136023) to unpack them on windows... unfortunately i have no idea, if there is one on mac :( Maybe you can google something up... Or can you run Windows software in a emulator, could be painfully slow, but you only need to do that once (Unpack the Assets*.fpk files into a extra folder outside your game installation)?
 
I found that AlanH actually created an excellent Mac PakBuild utility. So now I have all of the Assets and I'm ready to go. :goodjob:
 
Back
Top Bottom