Destructable walls
by Skylar Kelty · in Torque Game Engine · 03/27/2006 (8:50 am) · 17 replies
Hi,
Is there anyway to do destructable walls. Ive heard about some function that explodes a dts. And Ive tried using a modified version of player.cs but i cant get anything to work. Is there anything in realmwars or does anyone know how to do it. At the moment i just want the walls to dissapear when destroyed.
Is there anyway to do destructable walls. Ive heard about some function that explodes a dts. And Ive tried using a modified version of player.cs but i cant get anything to work. Is there anything in realmwars or does anyone know how to do it. At the moment i just want the walls to dissapear when destroyed.
About the author
#2
03/27/2006 (10:35 am)
Do not use Items for destructable walls unless you have a really good reason to. StaticShapes are probably the best stock class to use for this, as they have working damage/explosions and don't do any physics calculations.
#3
in fact that the TGE doesn't have moving DIFs you have to do this with dts shapes. Maybe with a combination from invisible blocker and an animation which shows the exlposion.
I don't want to make propaganda, but if you take a look at our webshop.
We have a content pack with FX scripts => FX01 -dev, this pack contains models (incl. milkshape files) and the scripts.
So you can learn about how to explode DTS Shapes.
Also we have two packs which includes doors, this doors are working with dts shapes. When the doors are closed they are blocked by invisible blocker shapes, when the door is open, the opening animation starts and the blocker moves away.
This functions you will find in the Blacksmith Pack and the Tavern Pack
Maybe I can push one of our modeler and scripter to create an exploding wall pack, but this will be last some time.
03/27/2006 (10:37 am)
Hi James,in fact that the TGE doesn't have moving DIFs you have to do this with dts shapes. Maybe with a combination from invisible blocker and an animation which shows the exlposion.
I don't want to make propaganda, but if you take a look at our webshop.
We have a content pack with FX scripts => FX01 -dev, this pack contains models (incl. milkshape files) and the scripts.
So you can learn about how to explode DTS Shapes.
Also we have two packs which includes doors, this doors are working with dts shapes. When the doors are closed they are blocked by invisible blocker shapes, when the door is open, the opening animation starts and the blocker moves away.
This functions you will find in the Blacksmith Pack and the Tavern Pack
Maybe I can push one of our modeler and scripter to create an exploding wall pack, but this will be last some time.
#4
03/27/2006 (11:07 am)
Sven: It can be done with stock StaticShapes, you shouldn't need any hacky work-arounds with invisible shapes for this, at least I didn't.
#5
how do you handle the collision box ? If your wall have to take hits and should block things from walking through, you will need a collision box and a bounding box.
But after you trigger the explosion animation your wall will disappear, but your collision box and bounding box will still be there. If I'm not wrong.
And the idea behind the invisible blocker is, the invisible blocker shape can take the hits and trigger the animation of the visible shape. Also the invisible blocker will move out of the way (if you move any visible shape it will be seen by the player). After that the player can walk through his "handmade" door.
03/27/2006 (11:34 am)
Josh,how do you handle the collision box ? If your wall have to take hits and should block things from walking through, you will need a collision box and a bounding box.
But after you trigger the explosion animation your wall will disappear, but your collision box and bounding box will still be there. If I'm not wrong.
And the idea behind the invisible blocker is, the invisible blocker shape can take the hits and trigger the animation of the visible shape. Also the invisible blocker will move out of the way (if you move any visible shape it will be seen by the player). After that the player can walk through his "handmade" door.
#6
Not sure if you'd want the object to stick around after it's been destroyed. ;)
03/27/2006 (11:47 am)
StaticShape.cs:function StaticShapeData::onDestroyed(%data, %obj, %prevState)
{
%obj.schedule(300, "delete");
}Not sure if you'd want the object to stick around after it's been destroyed. ;)
#7
For example, you make a door which the player have to open with the "big" key. So if you delete the door after destroying you have to make the door out of 2 models. 1 model which should be delete after destroying and 1 model which stays as rest of the door. First of all the modeling would be more work, because you can't blow up a door and the doorframe stays like fresh painted. Second you have to trigger synchron animation of two shapes (because you want that the whole thing is looking good).
Okay for a simple wall the whole modeling efforts will be easier.
Both ways will work, but I think to delete the shape won't work in many situatitions such easy.
But to make it short, we give James two ways. And he can figure out which one is for his project the better and easier one.
03/28/2006 (3:22 am)
Okay that will work if you can delete the complete shape, but what is if you want to go through a wall or a door. For example, you make a door which the player have to open with the "big" key. So if you delete the door after destroying you have to make the door out of 2 models. 1 model which should be delete after destroying and 1 model which stays as rest of the door. First of all the modeling would be more work, because you can't blow up a door and the doorframe stays like fresh painted. Second you have to trigger synchron animation of two shapes (because you want that the whole thing is looking good).
Okay for a simple wall the whole modeling efforts will be easier.
Both ways will work, but I think to delete the shape won't work in many situatitions such easy.
But to make it short, we give James two ways. And he can figure out which one is for his project the better and easier one.
#8
03/28/2006 (3:48 am)
It should work perfect for destructable walls. :P
#9
03/28/2006 (9:02 am)
Wow, thanks for all the replys, ill work on this right away and let you know what I did :-)
#10
{
interiorFile = "~/data/interiors/castle/city_walls/2s2.dif";
maxDamage = 100;
}
function wall::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if (%obj.getDamageState() $= "Destroyed")
return;
%obj.applyDamage(%damage);
}
function wall::onDamage(%this, %obj)
{
%damage = %obj.getDamageLevel();
if (%damage >= %this.destroyedLevel / %obj.scaleLevel)
{
if(%obj.getDamageState() !$= "Destroyed")
{
%obj.setDamageState(Destroyed);
}
}
else
{
if(%obj.getDamageState() !$= "Enabled")
%obj.setDamageState(Enabled);
}
}
function wall::onDestroyed(%data, %obj, %prevState)
{
%obj.schedule(300, "delete");
}
This is what ive got but it wont load (problem at line 7) can anyone help?
03/28/2006 (9:24 am)
Datablock defenceData(wall){
interiorFile = "~/data/interiors/castle/city_walls/2s2.dif";
maxDamage = 100;
}
function wall::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if (%obj.getDamageState() $= "Destroyed")
return;
%obj.applyDamage(%damage);
}
function wall::onDamage(%this, %obj)
{
%damage = %obj.getDamageLevel();
if (%damage >= %this.destroyedLevel / %obj.scaleLevel)
{
if(%obj.getDamageState() !$= "Destroyed")
{
%obj.setDamageState(Destroyed);
}
}
else
{
if(%obj.getDamageState() !$= "Enabled")
%obj.setDamageState(Enabled);
}
}
function wall::onDestroyed(%data, %obj, %prevState)
{
%obj.schedule(300, "delete");
}
This is what ive got but it wont load (problem at line 7) can anyone help?
#11
http://www.garagegames.com/mg/forums/result.thread.php?qt=9466
can Kevin's script be modified for interiors? I tried it and nothing appears
03/28/2006 (9:34 am)
I found:http://www.garagegames.com/mg/forums/result.thread.php?qt=9466
can Kevin's script be modified for interiors? I tried it and nothing appears
#12
03/29/2006 (5:35 pm)
Correct me if I'm wrong but I don't think using interiors is possible, it would have to be a staticshape. though you could probably hack your way around it.
#13
03/30/2006 (11:40 pm)
Is there a tool for converting interiors to static shapes? (.dif to .dts). Cant find one on google
#14
05/16/2006 (7:51 am)
*big bump*
#15
Does that help?
05/16/2006 (8:01 am)
You won't find one. Start you 3D app for DIF's, export the data in a commonly used file format (.3ds for example), start your DTS Exporter software (e.g. 3DS Max, Maya etc), import the file, add the necessary dummy nodes (see the exporter docs) and export the DTS file. Does that help?
#16
05/16/2006 (8:04 am)
You can use map23ds (search here on GG) to convert the map file to a dts shape. I can't remember if it manages texturing or not. I believe Lith Unwrap can load a map file and then save it as OBJ for conversion.
#17
This:
Should be:
Datablocks are declared as objects, thus they need a semi-colon (;) after the closing bracket.
05/17/2006 (8:48 am)
There's a compile error in your code:This:
Datablock defenceData(wall)
{
interiorFile = "~/data/interiors/castle/city_walls/2s2.dif";
maxDamage = 100;
}Should be:
Datablock defenceData(wall)
{
interiorFile = "~/data/interiors/castle/city_walls/2s2.dif";
maxDamage = 100;
};Datablocks are declared as objects, thus they need a semi-colon (;) after the closing bracket.
Associate Chip Lambert
Crusader Games
This is a good place for you to start.