PDA

View Full Version : Breaking Glass



TribalSphereOmni
04-04-2003, 10:57 AM
I know there's a tutorial on making glass break(as well as respawn) on Massassi, but I want glass to break when a player hits it, too. Is this possible? It's for a rolling mod...I think it'd be a nice touch. Thanks.

------------------
-Omni

http://www.tribalspherex.net/

TribalSphereOmni
04-05-2003, 12:53 AM
Er... for a rolling level, actually. Sorry...and also, if it's not much trouble(and if you care enough to, I wouldn't really care either way), could you make it damage health just slightly somehow? Thanks.

SaberMaster
04-05-2003, 01:54 PM
Post the cog you're using.

------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), Scribe (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).

TribalSphereOmni
04-05-2003, 02:02 PM
Er..it's 00_breakingglass.cog, the standard breaking glass one. I'm following the tutorial on here. If you want me to actually post the whole cog, I will, just later. I'm in a bit of a hurry now. Thanks.

TribalSphereOmni
04-05-2003, 07:59 PM
Here it is:


# Jedi Knight Cog Script
#
# 00_BREAKINGGLASS.COG
#
# Generic breaking glass script to be linked to both sides
# of a breakable glass pane.
#
# Note: the template used is shard00, NOT shard0 !
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

symbols
surface glass mask=0x448 desc=glass
surface glass2 mask=0x448 desc=glass_adjoin
int spawnpoints=2 desc=spawn_points
int density=5 desc=density

vector surface_center local
int surface_sector local
int surface_vertices local
vector vertex local
vector where local
int i local
int j local
int k local
int a_shard local
int dummy local

template shard_tpl=shard00 local
sound glass_break=GlassBreak1.WAV local

message damaged
end

code
damaged:
// Add 10 cm along the normal to solve some rounding error or non planar face...
surface_center = VectorAdd(SurfaceCenter(GetSenderRef()), VectorScale(GetSurfaceNormal(GetSenderRef()), 0.01));
surface_sector = GetSurfaceSector(GetSenderRef());
surface_vertices = GetNumSurfaceVertices(GetSenderRef());

dummy = PlaySoundPos(glass_break, surface_center, 1.0, 10.0, 20.0, 0);

// First spawn 'density' shards with random velocities at the center of the face.
for(k=0; k<density; k=k+1)
{
a_shard = CreateThingAtPos(shard_tpl,
surface_sector,
surface_center,
'0.0 0.0 0.0');
SetThingVel(a_shard, VectorSet( 1.4*(Rand()-0.5), 1.4*(Rand()-0.5), 1.4*(Rand()-0.5) + 0.75 ));
SetThingRotVel(a_shard, VectorSet(500*(Rand()-0.5), 500*(Rand()-0.5), 500*(Rand()-0.5) ));
}

// Then spawn 'density' shards with random velocities at 'spawnpoints' points
// between the center of the face and the face's vertices.

for(i=0; i<surface_vertices; i=i+1)
{
vertex = GetSurfaceVertexPos(glass, i);
for(j=1; j<=spawnpoints; j=j+1)
{
where = VectorAdd(surface_center,
VectorScale(VectorSub(surface_center, vertex), j/(spawnpoints+1))
);
for(k=0; k<density; k=k+1)
{
a_shard = CreateThingAtPos(shard_tpl,
surface_sector,
where,
'0.0 0.0 0.0');
SetThingVel(a_shard, VectorSet( 1.4*(Rand()-0.5), 1.4*(Rand()-0.5), 1.4*(Rand()-0.5) + 0.75 ));
SetThingRotVel(a_shard, VectorSet(500*(Rand()-0.5), 500*(Rand()-0.5), 500*(Rand()-0.5) ));
}
}
}

SetFaceGeoMode(glass, 0); // GEOMETRY_NONE
SetFaceGeoMode(glass2, 0);
SetAdjoinFlags(glass, 2); // Set ADJOIN_MOVE (allow passage)
SetAdjoinFlags(glass2, 2);

Return;
end


------------------
-Omni

http://www.tribalspherex.net/

TribalSphereOmni
04-05-2003, 08:05 PM
And I might even wanna make it respawnable....but that dang regenerating glass tutorial doesn't help.

[SF]pjb
04-06-2003, 04:18 AM
well i see it like this, make a cog based on that one, so that when you cross a ajoin just infrount of the glass, it brakes the glass and damages the player, unfortuantly altho i probley could make such a cog, its too mutch bother. i woudl sepend hours in the JK specks and sutch, just to find someone else had posted a better cog first.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

Edward
04-06-2003, 07:22 AM
Try this....
Add a touched message and add the shatter there. If you want the player to get hurt, make sure the glass doesn't have the No Damage From Fall flag on!
About the respawning, ask someone else...

TribalSphereOmni
04-06-2003, 06:11 PM
I should put something in my sig declaring that I'm not a cogger...I just can't make sense of the stuff. But, I got it anyway. Heeb helped me out and modified one a bit. Much thanks to him.

DogSRoOL
04-07-2003, 08:58 PM
If you wan't the shards to cause damage, just open your template, change type to "weapon", and add damage=x.xxx (maximum damage you want). I'm pretty sure that should do it. (don't forget to reload templates before testing!)

------------------
May the forks be with you.
AOL - providing excellent internet connection until you leave their domain.
There is a great disturbance in my shorts...