Page 1 of 2

Adding Children to Statics

Posted: 2007-06-08 16:06
by Rhino
In this tutorial I will show you how to attach an object, or mutible objects such as ladders, other bits of building sections etc to an object as a child, which will overall save time when placing these objects in the map.

This is not the building I'm going to use to show you how to do it in this tut, but I'm just going to show you this one as an exsample of one I have done earlyer.

Basicly you can add all the objects in the object editor, to change this building, from this:
Image

To this:
Image

Diffrences being the 2nd part (the balconey) has been attached as a child, and also 6 ladders thou you can only see one of the ladders in the 2nd pic.


Thou as I have already done that building, I am going to use this building as an exsample:
Image

Before I start this tut is very simple and it shouldnt take very long to get to grips with it, I only just had my first go at this last night before going to bed and did 2 buildings :p

Tools you will need: Step 1: Setting up your editor to reload the .con and .tweak files.
This is important so that you do not have to reload the editor every time you change something in the code by hand.
Go to Tools>Options at the top of the editor
Image
Exspand the "ReloadFileSettings" and inside the check every box so it looks like this:
Image
Then click ok to apply the settings.

Step 2: Setting up the static so it can take children.
First open up the .con file of your staticobject with your text editor (I would use the Crimson Editor).
Look/Search for the line "ObjectTemplate.create SimpleObject". After you have found it, we want to change this object from a SimpleObject to a Bundle, so just replace "ObjectTemplate.create SimpleObject" with "ObjectTemplate.create Bundle" and save the .con file, then you can close it.
The Editor may ask at this point if you want to reload the object, you can ignore it for the time being and leave it, or press yes.

Step 3: Adding a child.
Open up the .tweak of your staticobject with your text editor (this is the one you really want the Crimson Editor for).
Now I want to add a "ladder_3m" to my static, so all I need to do is add these lines to the very bottom of my .tweak file.

Code: Select all

rem -------------------------------------
ObjectTemplate.addTemplate ladder_3m
rem -------------------------------------
so it looks like this.
Image
Note: if you want to add anouther kind of static other than a ladder_3m, just find out its file name, and repalce the "ladder_3m" above with the file name of your object.
then save the .tweak and the editor should pop up a window asking if you want to reload the file, press yes.
Now if you look in the editor, you will noticed on the left in the recorces bar, that you now have your new object there.
Image

Step 3: Putting the child in the correct spot.
At the moment the object is located at excatly 0/0/0 of the pearent object, as we have not yet defeined any cordinets for it to be in, it also has a 0/0/0 rotation as we have not defeind any rotation as well.
Image

To put the object into the correct postion, simpley move it there and when its set, save the object.
Image
When you save the object, if you are using the Crimson Editor it will ask you if you want to reload the file, click yes and it will update it with the changes, if you are using notepad or something you will need to exit notepad, and reload the .tweak file.
If you look back you will notice it has added a new line under your new object with its x/y/z cordinets.
Image

Now That I have done the first ladder, time to move onto the next ladder. I want to put a ladder at the back of this building, to do this we simpley follow the same prcedia as above, but now we want to also rotate the ladder 180degs. This ladder is longer so I want to add a ladder_7m.
Under the last object, just add the new object so it looks like this:
Image
Now to rotate it 180degs, simpley add this line of code under the new object.

Code: Select all

ObjectTemplate.setRotation 180/0/0
so it looks like this:
Image
Now save the .tweak up, and click yes for the editor to reload the file.
Now you will find your new object sitting in the middle of your building, that now just needs moving into postion.
When the new object is in postion, just save it up again, and keep on doing this till all your new objects are on your building :D

Now Mappers can simpley drag and drop the pearent object into there map and will not need to place all the ladders, 2nd parts to the objects etc into there map wasting lots of time.

Image
Note: only 2 objects placed on the left in the recorces tab.

Now just to make sure you guys know, if the mapper wants to for w/e reason, take off all the children from an object and maybe place them by hand in other areas, or so he dont have any ladders etc on them this is easily done by just checking this box when you have the object selected in the level editor, in the tweaker bar: DisableChildren
Image

Which will resault in all the objects being removed, left with only the pearnt.
Image

Then you can go about in the level editor adding them back by hand if you wanted to, just for an exsample im going to add the balconey number 2 onto it :)

Image
Note: there are no ladders on the side.

Hope this tut helps! :D

Credit to matt.b for the statics, they are not my statics :p

Posted: 2007-06-11 23:15
by ub3rxn00b
Where can I get some of these statics?

Posted: 2007-06-11 23:20
by Katarn
you cannot. Matt.B and all his work is copyright of the Project Reality dev team. Har har.

Posted: 2007-06-11 23:33
by El_Vikingo
Why would you add children to statics?

Posted: 2007-06-11 23:37
by Rambo Hunter
so it's easier and faster to add them without modeling new statics?

Posted: 2007-06-11 23:39
by El_Vikingo
Well, maybe the children don't want to be added to statics...they're only children.

Posted: 2007-06-11 23:58
by ub3rxn00b
'[R-DEV wrote:Katarn']you cannot. Matt.B and all his work is copyright of the Project Reality dev team. Har har.
Are you being serious? If so, what if I was to make a high-quality map for PR to use? Would I then have access?

Posted: 2007-06-12 01:07
by Rhino
ub3rxn00b wrote:Are you being serious? If so, what if I was to make a high-quality map for PR to use? Would I then have access?
you must be on the dev team, or the R-CON team at the very least to use them.

Posted: 2007-06-12 01:27
by IronTaxi
the whole point is us getting to use our hard work in the manner in whihc we designed them to be used BEFORE we release them to the general public modding community..once they are in a map and being used you are free to use whichever you like...

Posted: 2007-06-12 01:38
by Rhino
'[R-DEV wrote:IronTaxi']once they are in a map and being used you are free to use whichever you like...
As long as you use them for the PR mod, and not any other mod or vBF2.

Posted: 2007-07-07 22:46
by S.A.S jackwebsterdunstan
'[R-DEV wrote:Rhino']As long as you use them for the PR mod, and not any other mod or vBF2.
im going to use them in a new mod called project tube where you start off in a helicopter then fastrope down to the ground and everyone jumps over to trucks and picks up unlimited rpg guns and then they all enter a room together and just go crazy. sound fun? oh never mind then

Posted: 2008-02-09 00:04
by Terror_Terror_Terror
I can't recall seeing those statics in-game are they in yet? If not do you know roughly when they will be? They're rather nice I must say.

Re: [Tutorial] Adding Children To Statics

Posted: 2008-06-15 04:32
by greenfire07
i believe he was talking about making a map for pr using said statics

Re: [Tutorial] Adding Children To Statics

Posted: 2008-06-20 16:06
by LekyIRL
Just had a go at this tut,it was very quick and easy. Good job Rhino! :thumbsup:

One Question: I can't save the .tweak or .con files in the Crimson Editor without first unchecking the "Read Only" box in their properties,is this normal?

Re: [Tutorial] Adding Children To Statics

Posted: 2008-06-20 16:11
by Rhino
LekyIRL wrote:One Question: I can't save the .tweak or .con files in the Crimson Editor without first unchecking the "Read Only" box in their properties,is this normal?
yes that is normal with any file set to read only.

Also just for any one to note, children on statics can not be lightmapped directly with the BF2 editor or 3DsMax, so dont add children that you want lightmapped. Just spent the last week fixing up a load of our statics with this being one of the problems I was fixing :p

Re: [Static Tutorial] Adding Children To Statics

Posted: 2009-09-11 14:46
by Lister471
Great tutorial, this could save overall alot of time when it comes to placing statics inside houses and such.

Ok i know this is probably a stupid question, but i take it the con and tweak files we changed doing this need to be packaged into the mod yes?

Re: [Static Tutorial] Adding Children To Statics

Posted: 2009-09-11 15:17
by Rhino
yes, ho ever dont put objects such as other building pieces onto an object as a child object that needs lightmaps since there is no simple way to light map child objects. Only put on ladders, glass etc that do not require lightmaps.

Re: [Static Tutorial] Adding Children To Statics

Posted: 2009-09-11 15:31
by Lister471
Yes it was just for the little things, like for example, adding some plates or cups to a set of shelves. Would have saved me a lot of time, i know there is the save object save object option but it never seems to work for me :)

Nice tutorial though. And thanks for the fast reply.

Re: [Static Tutorial] Adding Children To Statics

Posted: 2009-09-11 15:39
by Rhino
then you will have little plates and cups on the shelves standing out like a saw thumb since they dont have any shadow on them when they are meant to, placed on a shelf that is totally in shadow.

Re: [Static Tutorial] Adding Children To Statics

Posted: 2009-09-11 16:35
by Lister471
Yes i see your point, i was hoping that i would be able to place them in a light source, like opposite a window or next to a door way. But your right is would look silly.