PDA

View Full Version : Coding Adding Children to Statics


Rhino
2007-06-08, 17:06
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:
http://img522.imageshack.us/img522/4930/38870971uq0.jpg

To this:
http://img522.imageshack.us/img522/1785/12926905re1.jpg

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:
http://img522.imageshack.us/img522/7504/20848787el7.jpg

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:

BF2 Editor
Text Editor (I would use the Crimson Editor for this task since it reloads files etc. download: http://www.crimsoneditor.com/ and the BF2 plugin: http://www.filecloud.com/files/file.php?user_file_id=126906)


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
http://img522.imageshack.us/img522/3792/33872765zv3.jpg
Exspand the "ReloadFileSettings" and inside the check every box so it looks like this:
http://img522.imageshack.us/img522/3208/50454047zm0.jpg
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.
rem -------------------------------------
ObjectTemplate.addTemplate ladder_3m
rem -------------------------------------
so it looks like this.
http://img522.imageshack.us/img522/149/28775873xl8.jpg
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.
http://img522.imageshack.us/img522/8343/44436952xp7.jpg

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.
http://img522.imageshack.us/img522/579/24005729qk0.jpg

To put the object into the correct postion, simpley move it there and when its set, save the object.
http://img522.imageshack.us/img522/7073/99070930pb9.jpg
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.
http://img522.imageshack.us/img522/4800/10zg5.jpg

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:
http://img522.imageshack.us/img522/9436/11eh7.jpg
Now to rotate it 180degs, simpley add this line of code under the new object.
ObjectTemplate.setRotation 180/0/0
so it looks like this:
http://img522.imageshack.us/img522/1330/12ru2.jpg
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.

http://img522.imageshack.us/img522/7446/13ht2.jpg
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
http://img522.imageshack.us/img522/5959/14qp0.jpg

Which will resault in all the objects being removed, left with only the pearnt.
http://img522.imageshack.us/img522/6271/15sb2.jpg

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 :)

http://img522.imageshack.us/img522/3570/16uc5.jpg
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

ub3rxn00b
2007-06-12, 00:15
Where can I get some of these statics?

Katarn
2007-06-12, 00:20
you cannot. Matt.B and all his work is copyright of the Project Reality dev team. Har har.

El_Vikingo
2007-06-12, 00:33
Why would you add children to statics?

Rambo Hunter
2007-06-12, 00:37
so it's easier and faster to add them without modeling new statics?

El_Vikingo
2007-06-12, 00:39
Well, maybe the children don't want to be added to statics...they're only children.

ub3rxn00b
2007-06-12, 00:58
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?

Rhino
2007-06-12, 02:07
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.

IronTaxi
2007-06-12, 02:27
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...

Rhino
2007-06-12, 02:38
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.

S.A.S jackwebsterdunstan
2007-07-07, 23:46
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

Terror_Terror_Terror
2008-02-09, 00:04
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.

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

LekyIRL
2008-06-20, 17:06
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?

Rhino
2008-06-20, 17:11
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

Lister471
2009-09-11, 15:46
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?

Rhino
2009-09-11, 16:17
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.

Lister471
2009-09-11, 16:31
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.

Rhino
2009-09-11, 16:39
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.

Lister471
2009-09-11, 17:35
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.

ledo1222
2009-11-19, 23:19
Rhino;391764']As long as you use them for the PR mod, and not any other mod or vBF2.

Yeah or thell Hunt you down and take your Computer. Cant wait for new Static :DDD

lucky.BOY
2013-03-21, 20:21
Pictures in this one are missing (at least for me). Pretty please Rhino, fix 'em :)

Rabbit
2013-03-21, 21:22
Did you ever figure out if this is the actual way to make a group of statics one static? Mine was just a guess.

lucky.BOY
2013-03-21, 22:13
Alright. seems like this is not the way I want to do my thing after all, Ill post a new thread for it. Having these pictures fixed would still be nice, though :)

EDIT: Think I figured it out myslef, Ill just import and reexport it trough 3ds max.

Rhino
2013-03-22, 05:24
Don't have the pics any more, you will just have to do without them.

Did you ever figure out if this is the actual way to make a group of statics one static? Mine was just a guess.

While yes you can very easily group up multiple objects into one object via this method, the biggest problem with doing that is that you can't lightmap the child objects, with either the BF2 editor nor 3DsMax as BF2 won't pick up the childs as objects to lightmap, although the children will cast shadows on other objects, and 3DsMax wont even import child objects...

Daniel
2013-12-26, 22:58
the filecloud-link is dead too, (website filecloud not existing it seems), can you provide a new link with the BF2 plugin?