Joined: 18 Jun 2005 Location: Dordrecht, the Netherlands
Posted: Sat Aug 07, 2010 4:26 pm Post subject:
(**) Different Chassis Tutorial (ZH)
In this tutorial we'll discuss the use of BuildVariations and ObjectReskin.
First of all, what exactly are BuildVariations you may ask? Remember the GLA Technical? When you build it, it had 3 kinds of chassis, from which one was randomly chosen. This was done with BuildVariations and ObjectReskins.
I tried this for my own mod, but scrapped it as it requires X times more models (where X is the amount of BuildVariations - 1) for each unit, making the mod much bigger.
Anyways, enough intro text, lets get started:
What do we need:
-your vehicle codes (preferable in a separate .ini file)
-NotePad / your preferable .ini editing tool
-some decent knowledge of Generals editing
First, find your vehicle codes. We will need to edit those. Something I always do before making large changes is backing-up the original codes. If you think it is necessary, do so.
The way the BuildVariation logic works is as following:
We have:
-the original vehicle (1)
-the variations on the original vehicle (2)
-a fake vehicle which specifies which variations there are, which is also the vehicle you build from your Command Bar (3)
When selecting and building the specific unit from the sidebar, you aren't building the actual vehicle, but you are building the fake vehicle (3). Upon completion of the construction, it will choose what variation it will build (either 1 or one of the options from 2).
We already have 1; this is your original vehicle. 2 isn't that hard either; it's only model codes, and a small reference to the original vehicle. An example (take from the GLA Technical):
Notice the variant's name:
ObjectReskin (A) GLAVehicleTechnicalChassisTwo (B) GLAVehicleTechnicalChassisOne (C)
(A) is the very important part. It lets the game know it's a reskin of a different object. (B) is the name of this object. (C) is the object of which this is a reskin. This must be the object name of 1, or else it won't know what parameters (name, health, weapon, etc) this object has.
From what I know, you can has as much variations as you please. Don't nail me on this, as I've never tried more then the usual 3 used by the Technical.
When you're done with this, we'll continue to 3. This is the hardest part, but is also easy to understand. As said before, this is the actual vehicle we build when clicking the button on the Command Bar. This also decides which variations there are, and what the unit parameters are.
In essence, it links 1 and 2.
Again, I use the GLA Technical codes as an example:
Code:
;------------------------------------------------------------------------------
; this unit is never really "built"; building one triggers the random building of
; one of the other chassis. If you want a *specific* chassis, choose it explicitly;
; if you want a chassis at random, specify this.
Object GLAVehicleTechnical
Draw = W3DModelDraw ModuleTag_01
DefaultConditionState
; give it a model so it'll show up in WB
Model = UVTechTrck
End
End
; set cost and time fields here or else they won't work
BuildCost = 500
BuildTime = 5.0 ;in seconds
; Needed to get the Veterancy Overlays on top of the Technical with his build variations.
;------------------------------------------------------------
Behavior = VeterancyGainCreate ModuleTag_03
StartingLevel = VETERAN
ScienceRequired = SCIENCE_TechnicalTraining
End
If you know a bit of Generals editing, most stuff here is speaking for itself. The important bit is the BuildVariations line. This piece of code says what the original object is, and what the reskins are.
Besides this single line, there are more important things to remember. As this is the object being built, you must specify the Owner, Cost, BuildTime, Prerequisites (if your vehicle has any), and the KindOf in this object. Specifying a model and the Cameos is also useful, or else it would show up as blank in the WorldBuilder, or would be missing building cameos ingame. I ain't really sure what else stuff must be specified in this object, besides the mentioned VeteranGainCreate module.
Be sure to edit the CommandButton that builds this vehicle: it must point to 3, not to 1. If you forget this, it will always build the same model, instead of using the BuildVariation object.
Save all files, compile it in a .BIG file if you use those, and fire up your mod. Build some of your vehicle, and they should have different models.
Have questions, comments or feedback? Post them here.
Dutchygamer out.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum