Game Development Community

Bullet impact sparks on ground, interriors, etc. HELP NEEDED

by Jesse P · in Torque Game Engine · 12/22/2007 (10:07 am) · 7 replies

Hello, I just got the FX Pack that contains scripts for different impacts for the bullets including dirt impacts, rock sparks, etc., I have the mod makers weapons pack and what I need to know is how would I go about changing it so when my gun shoots the engine determines what the bullet has hit (an interior, a terrain, object, ect.) and thus what impact script to use to call the right animation to show. Right now I have the AK and it just shows a simple spark for everything regardless of what it hits. I'm not much of a coder but I'd love to get a thread started to discuss where to begin and hopefully begin to work this out along the way.

The FX Pack includes the following scripts:
bulletImpact_building.cs
bulletImpact_dirt.cs
bulletImpact_metal.cs
bulletImpact_rock.cs
bulletImpact_water.cs

and I THINK each can be called upon in the scripts with their assigned names, e.g. BulletBuildingExplosion, BulletDirtExplosion, BulletMetalExplosion, etc.

Thanks in advance

#1
12/22/2007 (3:57 pm)
Well it wouldn't call it to the engine, it would call it to the server... I would say that you would need to have the server find out where it hit, and have it exec the function on the bullet.
#2
12/22/2007 (7:38 pm)
Ron Nelson has this code, he sent it to me, see if he'll send it to you.
#3
12/22/2007 (10:23 pm)
Thanks, been messing with it a bit and got it to work but I'm not sure if the code is the best, I'm not really much of a coder but here's what I pieced together:
To add different "sparks/explosions" for the bullet impacting on each surface, after of course having the explosions defined/written in my FX Pack scripts I made functions in my rifle.cs for each impact that I needed, terrains, interiors, etc., once again I don't know if this is the best way but it works:

if (%col.getType() & $TypeMasks::TerrainObjectType)
{
%explosion = new Explosion()
{
dataBlock = "BulletDirtExplosion";
sourceObject = %this.sourceObject;
sourceSlot = %this.sourceSlot;
client = %this.client;
position = %pos;

};
MissionCleanup.add(%explosion);

}


if (%col.getType() & $TypeMasks::InteriorObjectType)
{
%explosion = new Explosion()
{
dataBlock = "galilExplosion2";
sourceObject = %this.sourceObject;
sourceSlot = %this.sourceSlot;
client = %this.client;
position = %pos;

};
MissionCleanup.add(%explosion);
}


With BulletDirtExplosion and galilExplosion2 being my different bullet "sparks" written elsewhere. I don't know if there is a better way or not to do this so please let me know if anyone knows if this way is clean or not
#4
12/22/2007 (11:57 pm)
Well my other game team members probably won't be real happy with me sharing it, but you know what? I am the only programmer and SDK owner on the team so I am gonna do it anyway.

Here is a resource I just released for it.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14044

Chris you amy want to look at it as well, I added some extra stuff to it and made some improvements since I shared what I had done with you.

Somebody is gonna owe me a beer for this.
#5
12/23/2007 (9:15 am)
Awesome! Thanks

-JP
#6
12/23/2007 (9:56 am)
Haha thanks Ron, I just need to get it working with TGEA.
#7
12/23/2007 (10:57 am)
Well I am working on that Chris, just trying to get my Sytem setup for TGEA now since you have setup a bunch of other stuff just to get the basic crap to compile.