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 → need 'nother cog please........
need 'nother cog please........
2002-06-28, 8:58 PM #1
I have a TIE bomber sitting in hangar. That sitting position is frame one. When a switch is activated, it needs to run through a series of 21 frames. In those 21 frames, the last frame (21) is the sitting position, the same as frame one, so it basically is making a loop.

Taking off, flying around, and going back to original position.

Thanks a ton in advance.

------------------
The Dashmaster
2002-06-29, 4:04 AM #2
Here.
Code:
# Another cog for Dash_rendar
#
# Makes the Tie Bomber fly around 21 frames
# when a switch is activated, only does it once
#
# [DP]
#
# Demo Cog
Symbols

Thing     TieBomber
Surface   Switch
int       speed
int       done = 0                local

Message   Activated

end
# ...........................................
code
Activated:
   If(done) Return;     // So it won't loop again
   SetWallCell(switch, 1);     // activates the seitch
   MoveToFrame(TieBomber, 21, speed);     // Moves the TIE
   done = 1;
   Return;
end

If you want something else added, ex looping or cameras, say so, and I'll do it. (and most likey be corrected by GBK or SaberMaster [http://forums.massassi.net/html/frown.gif] )

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

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

Completed
Judgement Day (HLP), My level pack
2002-06-29, 4:16 AM #3
SetWallCell() should be SetWallCel(). But other than that, it looks ok. [http://forums.massassi.net/html/smile.gif]

Did that last cog work correctly, Dash?

------------------
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-06-29, 7:13 PM #4
It wont work [http://forums.massassi.net/html/frown.gif] I switch sets to the next frame, but it doesnt go back and nothing moves.

------------------
The Dashmaster
2002-06-29, 7:16 PM #5
Whoops, my mistake. There is 22 frames, and the first frame is the same spot as the last one. The cog still wont work though [http://forums.massassi.net/html/frown.gif]

------------------
The Dashmaster

[This message has been edited by Dash_rendar (edited June 29, 2002).]

[This message has been edited by Dash_rendar (edited June 29, 2002).]
2002-06-30, 8:16 AM #6
What exactly won't work? You're description is confusing.

I just tested the cog, and it works. The only mistake was with SetWallCel(). There are 22 frames, but the last frame is frame 21, so the MoveToFrame() command is right.

Make sure your template uses path movement, and check the level's frame settings.

------------------
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-06-30, 11:14 AM #7
ok let me clear this up.

Just look at it this way. The TE Bomber is sitting there not moving. Frame 1. When the switch is activated, it flies out of frame one, and through another series of 21 frames, for a total of 22 frames inclucing the first one. Frame 22 is the same as frame one, because the TIE Bomber makes a loop, and ends up right where it started at the end of the loop.

Whats not working is when i activate the switch, it goes to cell #2 but doesnt go back to cell 1 and the tie bomber doesnt move.

------------------
The Dashmaster


[This message has been edited by Dash_rendar (edited June 30, 2002).]
2002-06-30, 12:51 PM #8
Here are some pics if they help at all, i know they are confusing.

[http://www.geocities.com/darkdashrendar/frames.txt]

[http://www.geocities.com/darkdashrendar/frames2.txt]

------------------
The Dashmaster
2002-06-30, 12:55 PM #9
The first frame is frame 0. And if there are 22 frames, the last frame will be frame 21. If the TIE doesn't move, the problem is in the level.

To make the switch turn back to cel 0, add this code after done=1; :
Code:
Sleep(flexTime);
SetWallCel(switch, 0);


Where flexTime is however many seconds you want to wait before the switch changes back. Or you could use WaitForStop(TieBomber); to wait until the TIE reaches frame 21.

Did you want the cog to make the TIE run through the frames more than once? As it is, it only allows the switch to be used once.

If you can't get it to work, email me the level and I'll look through it. [http://forums.massassi.net/html/wink.gif]

[edit]Just saw your last post. It looks alright, but it's hard to tell from the pictures.

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

[This message has been edited by SaberMaster (edited June 30, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-06-30, 6:45 PM #10
Well, yeah it needs to be used more than once.


BTW, did i do this right?

I know little about COG, so was i suposed to add "int flexTime" in symbols as well?

Code:
# Another cog for Dash_rendar
#
# Makes the Tie Bomber fly around 21 frames
# when a switch is activated, only does it once
#
# [DP]
#
# Demo Cog
Symbols

Thing     TieBomber
Surface   Switch
int       flexTime
int       speed
int       done = 0                local

Message   Activated

end
# ...........................................
code
Activated:
   If(done) Return;     // So it won't loop again
   SetWallCell(switch, 1);     // activates the seitch
   MoveToFrame(TieBomber, 21, speed);     // Moves the TIE
   done = 1;
   Sleep(flexTime);
   SetWallCel(switch, 0);
   Return;
end


[This message has been edited by Dash_rendar (edited June 30, 2002).]
2002-07-01, 3:42 AM #11
That's right. One thing (yes, there's a catch) change

int flexTime
to
flex flexTime

That way you can have 8.536321 or 9.52 instead of just 8 or 9. Personally I'd use WaitForStop(); but thats me. [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-01, 11:28 AM #12
YAY it works! Except one thing. It only works once. The switch resets and all, bit i can only use the Bomber switch once.
2002-07-01, 11:38 AM #13
Since you mention it, Pilot, when you assign a flex value to an integer, the integer will be changed to a flex to accomodate the new value.

Here's a new version of the cog:
Code:
# Another cog for Dash_rendar
#
# Makes the Tie Bomber fly around 21 frames
# when a switch is activated.
#
# [DP + SM]
#==============================================================#
symbols

thing     TieBomber

surface   Switch

flex      flexTime
flex      speed

int       numFrames
int       done=0      local

message   Activated

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

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


It can be used multiple times. If it doesn't work for you, email the level to me and I'll test it.

[edit] Just saw that last post. [http://forums.massassi.net/html/smile.gif] What was the problem?

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

[This message has been edited by SaberMaster (edited July 01, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-01, 12:02 PM #14
[http://forums.massassi.net/html/biggrin.gif] I like it. I would have added the Arrived message.

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

↑ Up to the top!