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 → Detonator cog
Detonator cog
2002-07-01, 12:38 PM #1
I need this cog for MP, when a switch is activated, it drops thermal detonators, with a specifiable frequency, for exactly 1 minute and 20 seconds.

In case you havnt figured it out yet, im adding this to my TIE Bomber so it bombs the level [http://forums.massassi.net/html/wink.gif]

------------------
The Dashmaster
2002-07-01, 12:40 PM #2
Why not let him drop the bombs already included in JK?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-07-01, 12:47 PM #3
Whats the template called?

------------------
The Dashmaster
2002-07-01, 1:10 PM #4
This should have just been added onto your first topic. I took SaberMasters cog form there and add the bombs
Code:
# Another cog for Dash_rendar
#
# Makes the Tie Bomber fly around 21 frames
# when a switch is activated.
# This time, drops bombs.
#
# [DP + SM]
#==============================================================#
symbols

thing     TieBomber

surface   Switch

flex      bombTime
flex      bombInterval
flex      speed

int       numFrames
int       done=0      local

template  bomb=08tiebomb      local

message   Activated
message   Pulse

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done) Return;
	done = 1;
	SetWallCel(Switch, 1);
	MoveToFrame(TieBomber, numFrames - 1, speed);
   SetPulse(bombInterval);
	Sleep(bombTime);
   SetPulse(0);
	WaitForStop(TieBomber);
	SetWallCel(Switch, 0);
	SkipToFrame(TieBomber, 0, speed);
	done = 0;

Return;
#------------------------------------------------------
Pulse:
   CreateThing(bomb, TieBomber);
Return;
#------------------------------------------------------

end
In 08_TieBomber.cog, LEC used CreateThingAtPos. CreateThing should work just as well.

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

Made the changes standout.

[This message has been edited by Descent_pilot (edited July 01, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-01, 1:26 PM #5
GREAT, it works perfectly (havnt tested in MP yet)

Except one thing, is it possible to make it so it creates the things maybe, .1 or .2 JKU's UNDER The bomber? Im having problems with the bombs actualy exploding on the bomber itself when its turned.

------------------
ph34r
2002-07-01, 2:22 PM #6
Add this to the symbols section.
Code:
vector     tiepos     local
vector     mod        local
vector     newpos     local

and this shall replace the CreateThing(); line
Code:
tiepos=(GetThingPos(TieBomber));
mod=VectorSet(0.0, 0.0, -0.305);
newpos=(VectorAdd(tiepos, modv));
CreateThingAtPos(bomb, GetThingSector(TieBomber), newpos, '0.0, 0.0, 0.0');

Vector offset from 08_tiebomber.cog in JK.

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

[Made vectors local so Dash doesn't get confused (any more then he is)]

[This message has been edited by Descent_pilot (edited July 02, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-01, 3:27 PM #7
I dont understand why you are making the template local. [http://forums.massassi.net/html/confused.gif]

------------------
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-01, 4:40 PM #8
Have habbit, half because it's only going to be a TieBomb and its one less thing that can go wrong. [http://forums.massassi.net/html/smile.gif] Don't wonder, it's just how I do things. [http://forums.massassi.net/html/redface.gif]

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

[This message has been edited by Descent_pilot (edited July 01, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-01, 5:34 PM #9
In that case, I dont like how you do things... [http://forums.massassi.net/html/biggrin.gif]


But dont take that the wrong way... Jon`C has called me every insult the filter will allow, and then some, because of the way I code... [http://forums.massassi.net/html/smile.gif]

------------------
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-02, 3:24 AM #10
As it is, the cog won't work in multiplayer. You'll have to use a trigger system to create the bombs on all computers.

There are also some small typing errors there. Use a syntax checker.

Quote:
<font face="Verdana, Arial" size="2"> Jon`C has called me every insult the filter will allow, and then some, because of the way I code...</font>


Just wait 'til I release my next utility. [http://forums.massassi.net/html/biggrin.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-02, 3:43 AM #11
I kinda noticed you didn't like my way. I sometimes don't like the way you cog. Just like SaberMaster somethimes doesn't like the way we cog and so on. Everybody has their own unique way of cogging. And everybody hates the group of people who can cog well. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 5:28 AM #12
Quote:
<font face="Verdana, Arial" size="2">Originally posted by SaberMaster:
Just wait 'til I release my next utility.
</font>


Let me guess. It will run through a cog and tab and space out the code. [http://forums.massassi.net/html/rolleyes.gif]


I code like I do because I like it. And after all, it is my right... [http://forums.massassi.net/html/smile.gif]

------------------
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-02, 6:16 AM #13
That's what I'm saying GBK. [http://forums.massassi.net/html/smile.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 8:28 AM #14
At last! An ally! Just dont start using 'Stop'...

------------------
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-02, 9:58 AM #15
Stop as is 'stop him!' or 'stop light' or as in 'StopThing()' [http://forums.massassi.net/html/tongue.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 10:22 AM #16
What to the values tiepos, mod, and newpos stand for?

Would i add (0.0/0.0/0.0) for tiepos, (0.0/0.0/-2.0) for mod, and (0.0/0.0/-2.0) for newpos? [http://forums.massassi.net/html/confused.gif]

------------------
ph34r

[This message has been edited by Dash_rendar (edited July 02, 2002).]
2002-07-02, 11:24 AM #17
Why in God's name are you writing out those vectors like that?!? (0/0/0) works just as well, if not better, than (0.0/0.0/0.0).

------------------
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-02, 11:44 AM #18
A little bit of logic goes a long way Dash_rendar.
  • tiepos = Tie Bomber Postion
  • mod = Modifier Vector
  • newpos = Bomb Postion
[http://forums.massassi.net/html/rolleyes.gif] This is so the bombs won't blow up on the Tie Bomber itself. [http://forums.massassi.net/html/rolleyes.gif] Just a little bit of logic can go a long way. [http://forums.massassi.net/html/wink.gif] Oh and I agree with GBK on the vectors.

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

[This message has been edited by Descent_pilot (edited July 02, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 12:08 PM #19
Grr this is frustrating. <noob voice> WHat do i have to put in the 3 values to get the effect i want? You gotta tell me what a modifer vector is befer i know what to put there........i dont even know what any of this has to do with a vector.

And as for the New Tie Bomber position, i dont want to change the position of the bomber, do what does this even do?

------------------
ph34r

[This message has been edited by Dash_rendar (edited July 02, 2002).]
2002-07-02, 12:23 PM #20
How long ago did you start editing? Never mind. Sorry on two accounts, the vectors should be local, and newpos is Bomb Postion (rushed on that one). Postions are represented as vectors in cog. Just do as I said, and it will work in SP. MP, go talk to SaberMaster, I tend to stay out of MP templates.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 12:56 PM #21
Ok, THATS what was confusing me. I did not know that Vectors represented POSITIONS in cogs, i always though vectore were only for directions. Thanks for clearing that up.

Ok, now heres what ive been trying to ask but i could not find the right words to say.

Are we assuming that the bomber is (0/0/0), therefore the bomb droping position would be (0/0/-2)?


------------------
ph34r

[This message has been edited by Dash_rendar (edited July 02, 2002).]
2002-07-02, 1:01 PM #22
It would be at (0/0/-0.305), but you got the general idea. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 1:18 PM #23
What does the Modifier Vecotr do? [http://forums.massassi.net/html/smile.gif] Is that simply the distance between teh TiePos and the newpos?

------------------
ph34r
2002-07-02, 1:41 PM #24
Yep.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-02, 2:50 PM #25
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Dash_rendar:
Ok, THATS what was confusing me. I did not know that Vectors represented POSITIONS in cogs, i always though vectore were only for directions. Thanks for clearing that up.

Ok, now heres what ive been trying to ask but i could not find the right words to say.

Are we assuming that the bomber is (0/0/0), therefore the bomb droping position would be (0/0/-2)?

</font>

A position is actually a vector with the level origin (0/0/0) as starting point.



------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-07-03, 4:20 AM #26
Here's my version of the cog:

Code:
# Another cog for Dash_rendar
#
# Makes a Tie Bomber fly around its frames
# when a switch is activated.
# This time, drops bombs.
#
# [DP + SM]
#==============================================================#
flags=0x40
#==============================================================#
symbols

thing     TieBomber

surface   Switch

flex      bombTime
flex      bombInterval
flex      speed

int       numFrames
int       triggerID
int       done=0           local

template  bomb=08tiebomb

vector    bombOffset       local
vector    lvecOffset       local
vector    rvecOffset       local
vector    newpos           local

message   activated
message   pulse
message   trigger

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done || !IsServer() && IsMulti()) Return;
	done = 1;
	SetWallCel(Switch, 1);
	MoveToFrame(TieBomber, numFrames - 1, speed);
	SetPulse(bombInterval);
	Sleep(bombTime);
	SetPulse(0);
	WaitForStop(TieBomber);
	SetWallCel(Switch, 0);
	SkipToFrame(TieBomber, 0, speed);
	done = 0;

Return;
#------------------------------------------------------
pulse:
	SendTrigger(-1, triggerID, 0, 0, 0, 0);

Return;
#------------------------------------------------------
trigger:
	if(GetSourceRef() != triggerID) Return;
	bombOffset = VectorScale(GetThingUVec(TieBomber), -0.305);
	rvecOffset = VectorScale(GetThingRVec(TieBomber), -0.1);
	lvecOffset = VectorScale(GetThingLVec(TieBomber), -0.1);
	bombOffset = VectorAdd(bombOffset, VectorAdd(rvecOffset, lvecOffset));
	newpos = VectorAdd(GetThingPos(TieBomber), bombOffset);
	CreateThingAtPos(bomb, GetThingSector(TieBomber), newpos, '0 0 0');

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


This cog works fine in SP, and it should work correctly in MP. The vector code I added is to place the bombs just below the TIE and right in front of the launcher. All directions are relative so it will work even if the TIE is not flying level.

Quote:
<font face="Verdana, Arial" size="2">I code like I do because I like it. And after all, it is my right...</font>


Sure, everyone can code the way they want to. My program won't be written to discriminate against some people's preferences, but to keep their organization consistent.

Quote:
<font face="Verdana, Arial" size="2"> I did not know that Vectors represented POSITIONS in cogs, i always though vectore were only for directions.</font>


A vector is any measure that includes both direction and magnitude. A position (AKA displacement vector) is a type of vector. The direction of this vector is a direction looking from the center (0/0/0) towards the position. The magnitude is the distance from the center to the position. But really, it's easier to think of a position as a point in a map.

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.

[This message has been edited by SaberMaster (edited July 03, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-03, 5:36 AM #27
Quote:
<font face="Verdana, Arial" size="2">Originally posted by SaberMaster:
Sure, everyone can code the way they want to. My program won't be written to discriminate against some people's preferences, but to keep their organization consistent.
</font>



Who ever said my organization wasnt consistent? In the hundreds of cogs Ive written for these forums, and TACC, and the thousands Ive written for myself, I have used the EXACT same layout. If some find them dificult to read, I apologize. I write them to be easy to understand the symbols, not the code...

------------------
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-03, 9:39 AM #28
Eh, GBK, you misunderstood what I said. Of course your cogs are organized - I didn't mean to imply that they weren't. I meant that my program would conform any cog to any user's standards. And hey, if the program lacks an option that you want, tell me and I'll add it. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-03, 10:22 AM #29
Ok, ok, sorry... [http://forums.massassi.net/html/frown.gif]

------------------
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.

↑ Up to the top!