Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → I need a slightly complex SP cog......
I need a slightly complex SP cog......
2002-07-27, 10:45 AM #1
Well, im making a SP level, and i have come to a part where i need a wall to be blown out by a bomb. SO heres the cog i need.

There is a bomb sitting by the wall, i'll call it "thing1" in this description. When thing1 is activated, a 5 second countdown is started, and it outputs the numbers as they pass. YOu activate a thing, and it prints 5..4..3..2..1..

Then after the 5 second countdown, thing1 is deleted, explosions are created at 10 different ghost positions, and a surface is adjoined. (it is unadjoined and when the bomb goes off it adjoins to make it seem like the wall was blown out.) Each explosion damages anythging within a 2 JKU radius.

Im not sure how much this will take, and if it is to much to write, dont worry about it. If you have any questions or need me to clarify somethign go ahead ans say so. Thanks a ton in advance, this one will really spice up my level!

Oh and as a extra if its possible, make some type of template me dropped all around the pleace where the bomb went off as debris.

------------------
Sanctum de la Mort
2002-07-27, 1:01 PM #2
This cog does basically what you want:
Code:
# bombwall.cog
#
# Blow out a wall when a bomb is activated.
#
# [SM]
#==============================================================#
symbols

thing     bomb
thing     expGhost0      nolink
thing     expGhost1      nolink
thing     expGhost2      nolink
thing     expGhost3      nolink
thing     expGhost4      nolink
thing     expGhost5      nolink
thing     expGhost6      nolink
thing     expGhost7      nolink
thing     expGhost8      nolink
thing     expGhost9      nolink
thing     dbrGhost0      nolink
thing     dbrGhost1      nolink
thing     dbrGhost2      nolink
thing     dbrGhost3      nolink
thing     dbrGhost4      nolink
thing     dbrGhost5      nolink
thing     dbrGhost6      nolink
thing     dbrGhost7      nolink
thing     dbrGhost8      nolink
thing     dbrGhost9      nolink

template  explosion
template  debris

surface   wall           nolink

int       numExpGhosts
int       numDbrGhosts
int       done=0         local
int       seconds=5
int       i              local

message   activated
message   pulse

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done) Return;
	done = 1;
	SetPulse(1);

Return;
#------------------------------------------------------
pulse:
	if(seconds > 0)
	{
		jkStringClear();
		jkStringConcatFormattedInt(seconds, "Bomb explodes in %d seconds");
		jkStringOutput(-1, -1);
		seconds = seconds - 1;
	}
	else
	{
		call explode;
		SetPulse(0);
	}

Return;
#------------------------------------------------------
explode:
	for(i = 0; i < numExpGhosts; i = i + 1) CreateThing(explosion, expGhost0);
	for(i = 0; i < numDbrGhosts; i = i + 1) CreateThing(debris, dbrGhost0);
	AddDynamicTint(GetLocalPlayerThing(), 1, 0, 0);
	SlideWall(wall, '0 0 -1', 2.5);
	Sleep(0.3);
	SetAdjoinFlags(wall, 0x7);
	SetFaceGeoMode(wall, 0);

Return;
#------------------------------------------------------
end


I think the cog is fairly self-explanatory. The dbrGhosts are ghosts placed in the level for debris to be created at. And the expGhosts are where explosions will be created. Ask if you have any questions.

Will this cog work for you or do you need anything changed?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-27, 8:14 PM #3
Thank you, now i need one that you must have the red key in order to activate it. If you dont have the key, it outputs a string. Thanks so much. Ill give you lots of credit!

------------------
Sanctum de la Mort
2002-07-27, 9:09 PM #4
Hmm.....it doesnt work. I activate it, the countdown counts down, and the screen has a small red tint for about a second like i was shot, but i recieve no damage, the bomb thing doesnt get deleted, and the wall doest get adjoined.

------------------
Sanctum de la Mort
2002-07-28, 1:46 AM #5
There are 4 variabled you must fill in in order for this cog to work;


explosion
debris
numExpGhosts
numDbrGhosts


Explosion and debris are templates - and they must be weapon proj/explosion templates (or, tankx or similar)


numX are the number of ghosts used. Just put the array number of the last used for each.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-07-28, 4:20 AM #6
Here's with the redkey.
Code:
# bombwall.cog
#
# Blow out a wall when a bomb is activated.
#
# [SM]
#==============================================================#
symbols

thing     bomb
thing     expGhost0      nolink
thing     expGhost1      nolink
thing     expGhost2      nolink
thing     expGhost3      nolink
thing     expGhost4      nolink
thing     expGhost5      nolink
thing     expGhost6      nolink
thing     expGhost7      nolink
thing     expGhost8      nolink
thing     expGhost9      nolink
thing     dbrGhost0      nolink
thing     dbrGhost1      nolink
thing     dbrGhost2      nolink
thing     dbrGhost3      nolink
thing     dbrGhost4      nolink
thing     dbrGhost5      nolink
thing     dbrGhost6      nolink
thing     dbrGhost7      nolink
thing     dbrGhost8      nolink
thing     dbrGhost9      nolink

template  explosion
template  debris

surface   wall           nolink

int       numExpGhosts
int       numDbrGhosts
int       done=0         local
int       seconds=5
int       i              local

message   activated
message   pulse

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done) Return;
	done = 1;
	If(GetInv(GetLocalPlayerThing(), 46))	SetPulse(1);
	Else jkPrintUNIString(-1, 00262);
Return;
#------------------------------------------------------
pulse:
	if(seconds > 0)
	{
		jkStringClear();
		jkStringConcatFormattedInt(seconds, "Bomb explodes in %d seconds");
		jkStringOutput(-1, -1);
		seconds = seconds - 1;
	}
	else
	{
		call explode;
		SetPulse(0);
	}

Return;
#------------------------------------------------------
explode:
	for(i = 0; i < numExpGhosts; i = i + 1) CreateThing(explosion, expGhost0);
	for(i = 0; i < numDbrGhosts; i = i + 1) CreateThing(debris, dbrGhost0);
	AddDynamicTint(GetLocalPlayerThing(), 1, 0, 0);
	SlideWall(wall, '0 0 -1', 2.5);
	Sleep(0.3);
	SetAdjoinFlags(wall, 0x7);
	SetFaceGeoMode(wall, 0);

Return;
#------------------------------------------------------
end
That wasn't too hard. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-28, 9:55 AM #7
Ok, it works a little bit better now, except when it blows up, the wall just HOMS and the bomb doesnt delete.


And there is a slight problem with the red key one. If i red the red key before i try to activate it, then activate it, it blows up fine (with the exception of the HOM and not being deleted) but if i try to activate it before i nab the key, it outputs the string, then i go grab they key, but nothign happens.
So the red key thing only works if i do not try to activate it first. Follow me?
------------
Sanctum de la Mort

[This message has been edited by Dash_rendar (edited July 28, 2002).]
2002-07-28, 10:51 AM #8
This will work:
Code:
# bombwall.cog
#
# Blow out a wall when a bomb is activated.
#
# [SM]
#==============================================================#
symbols

thing     bomb
thing     expGhost0      nolink
thing     expGhost1      nolink
thing     expGhost2      nolink
thing     expGhost3      nolink
thing     expGhost4      nolink
thing     expGhost5      nolink
thing     expGhost6      nolink
thing     expGhost7      nolink
thing     expGhost8      nolink
thing     expGhost9      nolink
thing     dbrGhost0      nolink
thing     dbrGhost1      nolink
thing     dbrGhost2      nolink
thing     dbrGhost3      nolink
thing     dbrGhost4      nolink
thing     dbrGhost5      nolink
thing     dbrGhost6      nolink
thing     dbrGhost7      nolink
thing     dbrGhost8      nolink
thing     dbrGhost9      nolink

template  explosion
template  debris

surface   wall           nolink

int       numExpGhosts
int       numDbrGhosts
int       done=0         local
int       seconds=5
int       i              local
int       keyBin=46
int       uniString=262

message   activated
message   pulse

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done) Return;
	if(GetInv(GetLocalPlayerThing(), keyBin) < 1)
	{
		jkPrintUniString(-1, uniString);
		Return;
	}
	done = 1;
	SetPulse(1);

Return;
#------------------------------------------------------
pulse:
	if(seconds > 0)
	{
		jkStringClear();
		jkStringConcatFormattedInt(seconds, "Bomb explodes in %d seconds");
		jkStringOutput(-1, -1);
		seconds = seconds - 1;
	}
	else
	{
		call explode;
		SetPulse(0);
	}

Return;
#------------------------------------------------------
explode:
	DestroyThing(bomb);
	for(i = 0; i < numExpGhosts; i = i + 1) CreateThing(explosion, expGhost0);
	for(i = 0; i < numDbrGhosts; i = i + 1) CreateThing(debris, dbrGhost0);
	AddDynamicTint(GetLocalPlayerThing(), 1, 0, 0);
	SlideWall(wall, '0 0 -1', 2.5);
	Sleep(0.3);
	SetAdjoinFlags(wall, 0x7);
	SetFaceGeoMode(wall, 0);

Return;
#------------------------------------------------------
end


That wasn't too hard. [http://forums.massassi.net/html/tongue.gif]

Dash, it causes HOM because you didn't adjoin the sectors on either side of the wall surface - you can't do that with cogscript. Once you have the sectors adjoined, uncheck the first three adjoin flags for the wall surface and set it's geo to 4. This will make the adjoin surface visible and impassible, but the sectors will still be adjoined.

When the explode message runs, it will add those three adjoin flags and set the geo mode to 0. Then the player can see and walk through the adjoin.

Should have explained that before; my bad. [http://forums.massassi.net/html/redface.gif]

See how that works. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-28, 11:22 AM #9
Thanks a ton you guys, it works great!

------------------
Sanctum de la Mort

↑ Up to the top!