GothmogtheOrc
|
Category: |
Code |
Level: |
Intermediate
|
Created: |
Sunday July 19, 2009 - 21:12 |
Updated: |
Tuesday July 21, 2009 - 13:28 |
Views: |
4856 |
Summary: |
A brief explanation of certain features of building geometry |
|
Rating
Staff says
4.0
|
Members say
4.0
|
Average
4.0/5.0
|
5 votes
|
Notes about random geometry issues:
-Buildings that are spawned will not have any geometry no matter what you do (actually I never tried using a walkable plane so I suppose that could work, but no code will turn on the geometry). The best solution I found to this is to spawn a foundation that can only build the building you want. Then make the building free and have no build time and give the foundation's CommandButton the following option: SINGLE_USE_COMMAND and put a lifetime timer on the foundation so that it will disappear after a few seconds. This is a decent work around to having buildings summonable. I use it in my Kings of the West mod if you want to see how it works (the GondorFort is a great example). And if you are asking why this matters: infantry cannot attack a building that doesn't have any geometry. Archers and Siege Equipment can, but not infantry... not a very good balance issue.
The basics:
Code |
Geometry = BOX
GeometryActive = Yes
GeometryName = Geo_Original
GeometryMajorRadius = 54.0
GeometryMinorRadius = 99.0
GeometryHeight = 50.0
AdditionalGeometry = BOX
GeometryName = Geo_Jut
GeometryActive = Yes
GeometryMajorRadius = 100
GeometryMinorRadius = 60
GeometryHeight = 50.0
GeometryOffset = X:80 Y:0 Z:0
GeometryIsSmall = No
GeometryRotationAnchorOffset = X:375.0 Y:0.0
Shadow = SHADOW_VOLUME |
The above is what you can expect to see for just about any building's geometry. Here's what they all mean:
Code |
Geometry = BOX or SPHERE or CYLINDER |
These are the shape options available for the geometry. And obviously the BOX shape can create both squares and rectangles. There may be one or two more options, LINE for example, but they are not commonly used and I'm not sure how they work.
Code |
GeometryActive = Yes or No |
This tells the game whether or not this piece of geometry is on or off. If it is on, then units will respect the geometry and not walk through the building. But if it is off then the units can walk through this piece of geometry. This us used when a building has an extension that is granted at a different level than the start level. So if your barracks has an additional tower that you activate when it reaches level 2, then that piece of geometry would start out off but be turned on when the building reaches level 2. More on this below.
Code |
GeometryName = whateverYouWant |
This is the name for this piece of geometry. Useful for when the geometry can be turned on and off. More on that below.
Code |
GeometryMajorRadius = 60 |
This code controls the radius if your geometry is cylindrical in shape. Or if your geometry is a box then it controls the length of the box.
Code |
GeometryMinorRadius = 30 |
This code (as far as I know) does nothing when your shape is cylindrical. However when your geometry shape is a box this code controls the width of the box.
As you can probably guess, this code controls how height the geometry will go.
These next two settings are optional and most often used when you have more than one piece of geometry
Code |
AdditionalGeometry = BOX or SPHERE or CYLINDER |
This tells the game that this is not the main geometry but rather another piece.
Code |
GeometryOffset = X:40 Y:20 Z:0 |
This code tells the game where to put this piece of geometry in relation to the unit or building. This is useful when you have a tower or other part of your building that needs geometry but that is off center in relation to the model as a whole. For example the tower on the Gondor Archery Range is off center on that model and uses this code.
These last three items only need to be listed once in the building or unit's code:
Code |
GeometryIsSmall = No |
This tells the computer that nothing can go through the geometry, unless it was spawned in there.
Code |
GeometryRotationAnchorOffset = X:375.0 Y:0.0 |
This is the code that the Gondor (and Morgul) castle walls use to make them all line up around the citadel. Easy to look up but I thought I'd post it anyway.
Code |
Shadow = SHADOW_VOLUME |
This code tell the game engine what type of shadows to cast on the ground. For buildings you will most often use the SHADOW_VOLUME option, however there are many others so I recommend you take a look at the building or unit you are basing your new unit off of to find the best type of shadow for it.
How to upgrade, activate, or deactivate Geometry:
Code |
Behavior = GeometryUpgrade Geom_ModuleTag_HideAll
TriggeredBy = Upgrade_StructureLevel1
ShowGeometry = Geom_Orig
HideGeometry = Geom_V1 Geom_V2
End
Behavior = GeometryUpgrade Geom_ModuleTag_ShowWalls
TriggeredBy = Upgrade_StructureLevel2
ShowGeometry = Geom_V1
HideGeometry = Geom_Orig Geom_V2
End
Behavior = GeometryUpgrade Geom_ModuleTag_ShowFlagsAndTower
TriggeredBy = Upgrade_StructureLevel3
ShowGeometry = Geom_V2
HideGeometry = Geom_Orig Geom_V1
End |
This is from the Gondor Farm and is how the geometry is upgraded. The first behavior hides all the additional geometry pieces. Then the second two upgrades show different pieces for different levels. Fairly straight forward. Here is the rest of the Gondor Farm Geometry code so you can see what it is calling:
Code |
Geometry = BOX
GeometryName = Geom_Orig
GeometryMajorRadius = 28.0
GeometryMinorRadius = 37.5
GeometryHeight = 18.0
GeometryOffset = X:-18 Y:0 Z:0
AdditionalGeometry = BOX
GeometryName = Geom_Orig
GeometryMajorRadius = 17.5
GeometryMinorRadius = 20.0
GeometryHeight = 40.0
GeometryOffset = X:22 Y:0 Z:0
AdditionalGeometry = BOX
GeometryName = Geom_V1
GeometryMajorRadius = 45.0
GeometryMinorRadius = 36.0
GeometryHeight = 20.0
GeometryOffset = X:-3 Y:0 Z:0
AdditionalGeometry = BOX
GeometryName = Geom_V1
GeometryMajorRadius = 17.5
GeometryMinorRadius = 20.0
GeometryHeight = 40.0
GeometryOffset = X:22 Y:0 Z:0
AdditionalGeometry = BOX
GeometryName = Geom_V2
GeometryMajorRadius = 45.0
GeometryMinorRadius = 36.0
GeometryHeight = 20.0
GeometryOffset = X:-3 Y:0 Z:0
AdditionalGeometry = BOX
GeometryName = Geom_V2
GeometryMajorRadius = 17.5
GeometryMinorRadius = 20.0
GeometryHeight = 65.0
GeometryOffset = X:22 Y:0 Z:0
GeometryIsSmall = No
Shadow = SHADOW_VOLUME |
Finally there is also the GeometryContactPoint code, which I am not familiar with. My understanding is that it has something to do with where the units will attack the building but I could be wrong. I've never had to mess with it, I've just used the most similar pre-existing structure's code or have gotten rid of it completely.
Well that's all I got. Hopefully that will help any future modders who attempt to create brand new bases with walkable and unique walls :)
-GothmogtheOrc