Page 1 of 2

Making a Destroyable Object Into a Non-Destroyable Object

Posted: 2013-02-22 00:22
by AFsoccer
Making a destroyable object into a non-destroyable object

1. Make a copy of the .con and .tweak file and place those copies in the same folder as the original but re-name the two new files with a _nondest suffix.

Code: Select all

[stonebridge_dest]
[indent][Meshes]
stonebridge_dest.con
stonebridge_dest.tweak
[color=Red]stonebridge_nondest.con
stonebridge_nondest.tweak[/color][/indent]
2. Now open the stonebridge_nondest.con file, which looks like this:

Code: Select all

GeometryTemplate.create StaticMesh stonebridge_dest
CollisionManager.createTemplate stonebridge_dest

ObjectTemplate.create DestroyableObject stonebridge_dest
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator MB03:mb
ObjectTemplate.collisionMesh stonebridge_dest
ObjectTemplate.mapMaterial 0 concrete 0
ObjectTemplate.mapMaterial 1 gravel 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.geometry stonebridge_dest

include stonebridge_dest.tweak
3. Change the name of the static each time it appears EXCEPT for the two lines where it points to the collision mesh and geometry. Those two need to stay because the non-destroyable static will still use the same meshes as the destroyable one. It should look like this:

Code: Select all

GeometryTemplate.create StaticMesh [color=Red]stonebridge_nondest[/color]
CollisionManager.createTemplate [color=Red]stonebridge_nondest[/color]

ObjectTemplate.create DestroyableObject [color=Red]stonebridge_nondest[/color]
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator MB03:mb
ObjectTemplate.collisionMesh [color=Green]stonebridge_dest[/color]
ObjectTemplate.mapMaterial 0 concrete 0
ObjectTemplate.mapMaterial 1 gravel 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.geometry [color=Green]stonebridge_dest[/color]

include [color=Red]stonebridge_nondest[/color].tweak
4. Then change "DestroyableObject" to "SimpleObject":

Code: Select all

GeometryTemplate.create StaticMesh [color=Red]stonebridge_nondest[/color]
CollisionManager.createTemplate [color=Red]stonebridge_nondest[/color]

ObjectTemplate.create [color=Red][b]SimpleObject[/b][/color] [color=Red]stonebridge_nondest[/color]
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator MB03:mb
ObjectTemplate.collisionMesh [color=Green]stonebridge_dest[/color]
ObjectTemplate.mapMaterial 0 concrete 0
ObjectTemplate.mapMaterial 1 gravel 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.geometry [color=Green]stonebridge_dest[/color]

include [color=Red]stonebridge_nondest[/color].tweak
Save and close.

5. Now open the stonebridge_nondest.tweak file:

Code: Select all

rem *** Generated with Bf2Editor.exe [created: 2006/5/15 12:52]
GeometryTemplate.setSubGeometryLodDistance 0 0 50
GeometryTemplate.setSubGeometryLodDistance 0 1 150
GeometryTemplate.setSubGeometryLodDistance 1 0 50
GeometryTemplate.setSubGeometryLodDistance 1 1 150
GeometryTemplate.doNotGenerateLightmaps 0
GeometryTemplate.lightmapOverride 0
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
GeometryTemplate.glowing 0
GeometryTemplate.noLighting 0
ObjectTemplate.activeSafe DestroyableObject stonebridge_dest
ObjectTemplate.creator MB03:mb
ObjectTemplate.modifiedByUser "mb"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.saveInSeparateFile 1 
ObjectTemplate.isDestructable 1 
ObjectTemplate.cullRadiusScale 6
rem ---BeginComp:Armor ---
ObjectTemplate.createComponent Armor
ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints 1000
ObjectTemplate.armor.defaultMaterial 78
ObjectTemplate.armor.waterLevel -0.3
ObjectTemplate.armor.explosionDamage 80
ObjectTemplate.armor.explosionRadius 5
ObjectTemplate.armor.explosionForce 5
ObjectTemplate.armor.explosionForceMod 8
ObjectTemplate.armor.explosionForceMax 50
ObjectTemplate.armor.explosionMaterial 78
ObjectTemplate.armor.wreckExplosionMaterial 78
ObjectTemplate.armor.wreckHitPoints 100
ObjectTemplate.armor.timeToStayAsWreck -1
ObjectTemplate.armor.timeToStayAfterDestroyed -1
ObjectTemplate.armor.wreckDelay 0.05
ObjectTemplate.armor.canBeDestroyed 0
ObjectTemplate.armor.canBeRepairedWhenWreck 1
ObjectTemplate.armor.showDamageAsDirt 500
ObjectTemplate.armor.addArmorEffect 0 e_mexp_m_prwall 0/0/0 0/0/0
rem ---EndComp ---
rem ---BeginComp:StrategicObject ---
rem ObjectTemplate.createComponent StrategicObject
rem ObjectTemplate.StrategicObject.strategicObjectName stbrdg
rem ObjectTemplate.StrategicObject.destroyedIcon Ingame\Minimap\Icons\Bridge_broken.tga
rem ObjectTemplate.StrategicObject.intactIcon Ingame\Minimap\Icons\Bridge.tga
rem ObjectTemplate.StrategicObject.part 1
rem ---EndComp ---
ObjectTemplate.geometry stonebridge_dest
ObjectTemplate.setCollisionMesh stonebridge_dest
ObjectTemplate.mapMaterial 0 concrete 78
ObjectTemplate.mapMaterial 1 gravel 3
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
6. Delete the middle rem statements and all the lines inbetween. Also find the lines that say "ObjectTemplate.isDestructable 1" and "ObjectTemplate.setNetworkableInfo BasicInfo" and delete those too:

Code: Select all

rem *** Generated with Bf2Editor.exe [created: 2006/5/15 12:52]
GeometryTemplate.setSubGeometryLodDistance 0 0 50
GeometryTemplate.setSubGeometryLodDistance 0 1 150
GeometryTemplate.setSubGeometryLodDistance 1 0 50
GeometryTemplate.setSubGeometryLodDistance 1 1 150
GeometryTemplate.doNotGenerateLightmaps 0
GeometryTemplate.lightmapOverride 0
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
GeometryTemplate.glowing 0
GeometryTemplate.noLighting 0
ObjectTemplate.activeSafe DestroyableObject stonebridge_dest
ObjectTemplate.creator MB03:mb
ObjectTemplate.modifiedByUser "mb"
[color=Red][-]ObjectTemplate.setNetworkableInfo BasicInfo[/-][/color]
ObjectTemplate.saveInSeparateFile 1 
[-][color=Red]ObjectTemplate.isDestructable 1[/color][/-]
ObjectTemplate.cullRadiusScale 6
[-][color=Red]rem ---BeginComp:Armor ---
ObjectTemplate.createComponent Armor
ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints 1000
ObjectTemplate.armor.defaultMaterial 78
ObjectTemplate.armor.waterLevel -0.3
ObjectTemplate.armor.explosionDamage 80
ObjectTemplate.armor.explosionRadius 5
ObjectTemplate.armor.explosionForce 5
ObjectTemplate.armor.explosionForceMod 8
ObjectTemplate.armor.explosionForceMax 50
ObjectTemplate.armor.explosionMaterial 78
ObjectTemplate.armor.wreckExplosionMaterial 78
ObjectTemplate.armor.wreckHitPoints 100
ObjectTemplate.armor.timeToStayAsWreck -1
ObjectTemplate.armor.timeToStayAfterDestroyed -1
ObjectTemplate.armor.wreckDelay 0.05
ObjectTemplate.armor.canBeDestroyed 0
ObjectTemplate.armor.canBeRepairedWhenWreck 1
ObjectTemplate.armor.showDamageAsDirt 500
ObjectTemplate.armor.addArmorEffect 0 e_mexp_m_prwall 0/0/0 0/0/0
rem ---EndComp ---
rem ---BeginComp:StrategicObject ---
rem ObjectTemplate.createComponent StrategicObject
rem ObjectTemplate.StrategicObject.strategicObjectName stbrdg
rem ObjectTemplate.StrategicObject.destroyedIcon Ingame\Minimap\Icons\Bridge_broken.tga
rem ObjectTemplate.StrategicObject.intactIcon Ingame\Minimap\Icons\Bridge.tga
rem ObjectTemplate.StrategicObject.part 1
rem ---EndComp ---[/color][/-]
ObjectTemplate.geometry stonebridge_dest
ObjectTemplate.setCollisionMesh stonebridge_dest
ObjectTemplate.mapMaterial 0 concrete 78
ObjectTemplate.mapMaterial 1 gravel 3
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
7. Lastly, change the name of the static EXCEPT for the two lines where it points to the collision mesh and geometry, and change "DestroyableObject" to "SimpleObject".

Code: Select all

rem *** Generated with Bf2Editor.exe [created: 2006/5/15 12:52]
GeometryTemplate.setSubGeometryLodDistance 0 0 50
GeometryTemplate.setSubGeometryLodDistance 0 1 150
GeometryTemplate.setSubGeometryLodDistance 1 0 50
GeometryTemplate.setSubGeometryLodDistance 1 1 150
GeometryTemplate.doNotGenerateLightmaps 0
GeometryTemplate.lightmapOverride 0
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
GeometryTemplate.glowing 0
GeometryTemplate.noLighting 0
ObjectTemplate.activeSafe [color=Red]SimpleObject stonebridge_nondest[/color]
ObjectTemplate.creator MB03:mb
ObjectTemplate.modifiedByUser "mb"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.saveInSeparateFile 1 
ObjectTemplate.cullRadiusScale 6
ObjectTemplate.geometry [color=Green]stonebridge_dest[/color]
ObjectTemplate.setCollisionMesh [color=Green]stonebridge_dest[/color]
ObjectTemplate.mapMaterial 0 concrete 78
ObjectTemplate.mapMaterial 1 gravel 3
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
Save and close.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-22 10:11
by J.F.Leusch69
i would remove the "-" out of "non-dest", i might be wrong but it think there was or were or can be a problem with "-" in code

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-22 10:22
by Psyrus
[R-DEV]J.F.Leusch69 wrote:i would remove the "-" out of "non-dest", i might be wrong but it think there was or were or can be a problem with "-" in code
I think it works fine... I tried the tutorial and added one to my Albasrah's compiled server.zip (staticobjects.con) and it seemed to be ok... Not sure though.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-22 19:20
by AFsoccer
Yeah, there are already some non-destroyable objects named that way... and thus why I stuck with that designation, to make it consistent. :)

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-22 22:35
by billoute
it's really a good tut for us ,thanks AF !
Also I think to myself that maybe we could use the wreck-object with the same way to do ???

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-23 00:37
by AFsoccer
That's a good question: Is there a way to place the wrecked object? Maybe Rhino will know the answer.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-23 02:01
by Rhino
[R-DEV]AFsoccer wrote:That's a good question: Is there a way to place the wrecked object? Maybe Rhino will know the answer.
If you keep it a destroyable object with a networkable there is, in the same way we have CSBs starting off as wrecks, by simply setting the armour setting to:

Code: Select all

ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints [color=Red][b]0[/b][/color]
Instead of:

Code: Select all

ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints [u]1000[/u]
But without keeping it a dest object, there might be a way to do it by code but don't know of any, only way I would know how to do that is by re-exporting the wreck as a new static.


BTW you should move this topic into the community modding tuts forum where it will be easier in the long run to be found by us and helpful for everyone, no reason to keep it in here.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-27 01:40
by Rabbit
'[R-DEV wrote:Rhino;1867931']If you keep it a destroyable object with a networkable there is, in the same way we have CSBs starting off as wrecks, by simply setting the armour setting to:

Code: Select all

ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints [color=Red][b]0[/b][/color]
Instead of:

Code: Select all

ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints [u]1000[/u]
But without keeping it a dest object, there might be a way to do it by code but don't know of any, only way I would know how to do that is by re-exporting the wreck as a new static.


BTW you should move this topic into the community modding tuts forum where it will be easier in the long run to be found by us and helpful for everyone, no reason to keep it in here.
Not sure if I'm following exactly, but....
If you have an object that is in the object spawner you can set them as destroyed through a tmp.con

For example I want a wreak of a t-90, but I don't have a wreak static.

Code: Select all

ObjectTemplate.activeSafe DestroyableObject ru_tnk_t90
ObjectTemplate.armor.maxHitPoints 1000
ObjectTemplate.armor.hitPoints 0
Can be done for object spawn buildings and bridges too. Now if its an object that will disappear after so long, you can stop that with.

Code: Select all

rem make ru_tnk_t90 never destroyable
ObjectTemplate.activeSafe PlayerControlObject ru_tnk_t90
ObjectTemplate.armor.timeToStayAsWreck 99999
ObjectTemplate.armor.canBeDestroyed 1
Now what I have not tried is setting if setting the hitpoints to 0 will spawn it as a wreak in game or not, would need to test tomorrow to find out.

Warning, this will cause ALL "ru_tnk_t90" to have this same value. Went into it here.
https://www.realitymod.com/forum/f388-p ... ost1862367

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-27 09:35
by Rhino
Interesting method but its far better to do it though making a clone of that object that is set to have those settings, rather than modifying it map side, which all also as you say, affect all the objects of that type on the map, as well as not optimize them by getting rid of unnecessary networkables etc.

You also really shouldn't be doing this to vehicles...

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-27 15:37
by Rabbit
[R-DEV]Rhino wrote:Interesting method but its far better to do it though making a clone of that object that is set to have those settings, rather than modifying it map side, which all also as you say, affect all the objects of that type on the map, as well as not optimize them by getting rid of unnecessary networkables etc.

You also really shouldn't be doing this to vehicles...
Yeah, it was mainly a theory test behind a game mode/level where insurgents attack a base and can win by capturing or destroying key vehicles.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 08:15
by pr|Zer0
what about the LM samples... wreck static lightmap of the newly created object will still be rendered?

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 08:52
by Rhino
You need to resize the wreck LMs to 8x8px for each lod.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 16:39
by BroCop
I tried following the tutorial step by step, and while the object I used (basically the "kashan village" wall - AKA vwa1) did actually work to an extent, every time I would place it, the editor would freeze for more than a minute and seems to influence every new placement and deletion of statics in the same way of freezing everything (and somehow magically kick out my internet connection). I dont plan on working hours to replace a few dozen statics, can someone help me out here?

Cant figure out whats wrong, but heres how my files look like (con and tweak respectively)

Code: Select all

GeometryTemplate.create StaticMesh vw1a_non-dest
CollisionManager.createTemplate vw1a_non-dest

ObjectTemplate.create SimpleObject vw1a_non-dest
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator MB03:mb
ObjectTemplate.collisionMesh vw1a
ObjectTemplate.mapMaterial 0 Penetrable_plaster_wall 0
ObjectTemplate.mapMaterial 1 Gravel 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.geometry vw1a

include vw1a_non-dest.tweak

Code: Select all

rem *** Generated with Bf2Editor.exe [created: 2006/5/15 12:52]
GeometryTemplate.setSubGeometryLodDistance 0 0 30
GeometryTemplate.setSubGeometryLodDistance 0 1 150
GeometryTemplate.setSubGeometryLodDistance 1 0 50
GeometryTemplate.setSubGeometryLodDistance 1 1 150
GeometryTemplate.doNotGenerateLightmaps 0
GeometryTemplate.lightmapOverride 0
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
GeometryTemplate.glowing 0
GeometryTemplate.noLighting 0
ObjectTemplate.activeSafe SimpleObject vw1a_non-dest
ObjectTemplate.creator MB03:mb
ObjectTemplate.modifiedByUser "mb"
ObjectTemplate.saveInSeparateFile 1 
ObjectTemplate.cullRadiusScale 6
ObjectTemplate.geometry vw1a
ObjectTemplate.setCollisionMesh vw1a
ObjectTemplate.mapMaterial 0 Penetrable_plaster_wall 1001
ObjectTemplate.mapMaterial 1 Gravel 3
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 16:47
by Rhino
Can't see anything wrong at a glance although may be something like a spelling mistake or w/e but we already have coded up non-dest versions of these statics (what this tut was actually made for) and for now, just place the dest versions in and when 1.0 is released you can just do a quick swap out of the dest versions for the non-dest ones :)

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 16:48
by Psyrus
Also, as an FYI, the _nondest naming scheme was decided upon as some finished ones use that, so it's good to keep it consistent.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 16:56
by BroCop
[R-DEV]Rhino wrote:Can't see anything wrong at a glance although may be something like a spelling mistake or w/e but we already have coded up non-dest versions of these statics (what this tut was actually made for) and for now, just place the dest versions in and when 1.0 is released you can just do a quick swap out of the dest versions for the non-dest ones :)
Rgr. Just need to count all them objects then.

Kinda embarrassing when you notice that you have some odd 650 dest objects on the map. Seems I am gonna be busy for a while :p

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-02-28 17:57
by AFsoccer
When the new undest objects come out in v1.0, you can do a quick replace by selecting an object, then in the top right corner click the button the says "Select all of same type" and then click "Replace object(s)" and select the _undest version. The editor will automatically replace all of them. This way you only have to do it once for each static type.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-03-01 07:53
by Rhino
[R-DEV]AFsoccer wrote:When the new undest objects come out in v1.0, you can do a quick replace by selecting an object, then in the top right corner click the button the says "Select all of same type" and then click "Replace object(s)" and select the _undest version. The editor will automatically replace all of them. This way you only have to do it once for each static type.
Or quicker still you can just open the staticobjects.con with a text editor and do a massive find and replace, other than you need to reload the editor if you have it open before you do it but you can in most cases, replace objects on multiple types, especially if you using something like notepad++ :p

BTW if you do really need them before 1.0 is released someone could look into uploading them for ya.

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-03-01 08:33
by AFsoccer
[R-DEV]Rhino wrote: BTW if you do really need them before 1.0 is released someone could look into uploading them for ya.
Yeah, especially since v1.0 won't be out until next year.


j/k ;-)

Re: [Tutorial] Making a destroyable object into a non-destroyable object

Posted: 2013-04-25 13:42
by BroCop
Slight necro here, but can someone give me a hand here and pass me the files for those statics (the pr/village series, most notably the walls although I would appreciate the houses as well)?

I am trying to shape up the map for a pub test, so eliminating the odd 200 networkables I shouldnt have present is sort of a must :p .