Game Development Community

Stumped on collision damage ?

by RageO · in Torque Game Engine · 12/25/2006 (10:52 am) · 7 replies

Well I have muddled my way through many tutorials manuals resources etc.. Im still having trouble with this engine.
I bought the 3d diggers FX resource. I am trying to make the item explode when hit by the player or the car I have.
I have changed the damage level to 1 so I can destroy it very easy. However I can only get it to blow up when I hit it with a crossbow shot.
I have tried to get the bottle to blow up when touched by adding the damage line here but that does not work. I have added code to the player and tried to make object damage from there etc... I just cannot figure it out or get my head around this. I have cut and pasted so much code and changed it to no avail. Its got me stumped.
How can I get the 3d digger object to blow up when it is hit by the BTcar ? or atleast the darn player....

This is a small sample of the script for the bottle. I tried to add the damage command and this does not work.
What am I missing ? In my head this command should apply damage when the bottle is hit. Since I have te damage destroy level set to 1 it should work. What am I missing ?

function BottleDestroyShape::onCollision(%this,%obj,%collider)
{
echo("Bottle collision!");
%obj.applyDamage(10);
}

And I have been deleting my dso files after a change in code etc..

#1
12/25/2006 (11:32 am)
Any weapon will work with Fx pack as long as the cs weapon file for the weapon is setup correctly. All my weapons work find with the pack. If you want them to blowup when player or car collide with them than you need add code for that because they are not design to do that.

Check out the land mine resource, it may have what you want.
#2
12/26/2006 (12:07 pm)
Thanks the land mine resource is exactly what I was looking for.
Ive had to alter it but it does what I need and is teaching me a whole lot!

For those trying to make something blow up when hit such as crates etc
the land mine resource is perfect and a good learning tool.

Here is the link

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8154
#3
12/26/2006 (12:50 pm)
What did you change, I have been work on it from time I saw your post. I have no problem get the items to blow. I am try cause damage to the player when the item blow up. Thanks for any help.
#4
12/26/2006 (11:50 pm)
I am still messing with the mine resource. ITs not perfect yet but once I get it straight Ill post it here.
Right now the mine will kill the player it comes like that. I am replacing the mine /weapon.dts with crates and other Items.
It will explode when the car hits it. Im just working on a way to use this for powerups and destruction.
Im attempting to make it a regular Item that I can place anywhere without it being thrown by the player.
Will post when I have it done. Should not take long.
question: Are you trying to cause damage to the player when the FX object blows up ?
#5
12/27/2006 (6:01 am)
The mine2 can be place anywhere in the mission and it will work when player come in contact, mine2 does not need to be throw by the player to work. You can place them from world editor. What I am work on right now is cut mine2 out and move it to new cs file. Yes that what I am tring to when FX object blow up to cause damage to the player. I can spawn mine2 when FX object blows up, if player advance to pick the mine2 up, boom.
#6
12/27/2006 (9:12 am)
Well you are ahead of me here. I am still getting my head around the scripting structure.
I just figured out that It could make a mine without throwing it. I went into Items.cs to stop them from rotating and replaced the mine shape with the crate shape.
I also want to cut the mine2 portion out of the code. That will be my next attempt. Thats a goog Idea about spawning the mine.
#7
12/27/2006 (1:43 pm)
I manage to get mine2 down to bare minimal to work. I also separate mine2 from mine but not sure if I will use it. I may use the mine orginal script because with my spawn code I can drop either mine or mine2 so may use mine for weapon for the player to care and threw. I am work on right now to move the barrel over to the mine script. I have the barrel dts over and it is working on the player collision.

I forgot to say early did you catch the misstake in the mine.cs

In " datablock ItemData(mine2)" look this line

category = "Health";

I change it to be the same as in " datablock ItemData(mine) "

category = "Weapon";