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 COG help, please
I need COG help, please
2002-12-09, 10:37 AM #1
Okay, I'm working on a Courscant level for MOTS. And I want to make those lanes of flying ships, as seen in the movie. BUT, I don't know "exactly" how to do it...

I need a COG to loop a ship from frame to frame to frame, etc. Just like the enemy patrol cog. I don't think it'll work for strutures though.

I know 0% about COG writing, that's why I need help from guys that have COG writing experience.

Well, it should be a simple cog...

thing
thingflags
speed
numframes
frame
frame
frame...

Basically, it'll start at frame 1, then just go frame to frame until it reaches the last frame, then it'll go back to the first one, and reapeat this process forever.

I don't want to mess around with Keys and stuff cause I know nothing about that either...lol

So, if anyway has any time, I would greatly appreciate some help with this...

thanks in advanced
2002-12-09, 1:11 PM #2
Try this...

Code:
#12/2002 GBK
Symbols
Message Startup
Message Arrived
Thing Ship
Template Gh=ghost	Local
Thing G			Local
Int Num_frames	#Whatever JED reports as your number of frames, put that here.
Flex Speed=4
End
Code
Startup:
Sleep(0.5);
G = Creatething(Gh, Ship);
Movetoframe(Ship, Num_frames-1, Speed);
Stop;
Arrived:
If(Getcurframe(Ship) != Num_frames-1) Stop;
Teleportthing(Ship, G);
Movetoframe(Ship, Num_frames-1, Speed);
Stop;
End



Im at UNI, so I cant test it . . . [http://forums.massassi.net/html/frown.gif]
And when the moment is right, I'm gonna fly a kite.
2002-12-09, 7:16 PM #3
You might as well have a few choices...

Code:
# Yet another generic frame-based flying ship cog.
# But this one has error correction!!
#
# 11/2002 GBK
Symbols
Message Startup
Message Crossed
Message Arrived
Message Timer
Thing Ghost
Template Ship_type
Thing Ship		Local
Int Num_frames	#Whatever JED reports as your number of frames, put it here. (count from 1)
Flex Speed=4
Sound Hum
Flex Hum_dist=10	#It is now in JKUs
Int Ch=0		Local
Int Destroy_end=1	#Destroy the ship when it reaches the end?
Int Recreate_end=1	#Recreate it?  This is unused if the above is 0.
Int Mode=0		#0 - on startup, start ship
			#1 - on crossing "Adjoin", start ship.
Surface Adjoin	#If your using mode 0, you dont need this.
Int C=0		Local
Int I=0		Local
End
Code
Startup:
Sleep(0.5);
Num_frames = Num_frames - 1;
If(Mode) Stop;
Call Go;
Stop;
Crossed:
If(!Mode) Stop;
Call Go;
Stop;
Go:
Ship = Creatething(Ship_type, Ghost);
If(Ship == -1) { Call Failure; Stop; }
Movetoframe(Ship, Num_frames, Speed);
Capturething(Ship);
Ch = Playsoundthing(Hum, Ship, 1, 0, Hum_dist*10.5, 0x81);
Stop;
Arrived:
If(Getcurframe(Ship) != Num_frames) Stop;
Stopsound(Ch, 0.1); 
If(Destroy_end) { Destroything(Ship);  Ship = -1;
If(Recreate_end) Call Go; } Stop;
Failure:
For(I=0;I<=640;I=I+1) If(Getthingsignature(I) != -1) C = C + 1;
JKstringclear(); If(Getthingcount() - C <= 10)
JKstringconcatformattedint(Getselfcog(), "Ship creation failure, cog %d. Likely cause:  Thing limit.");
Else JKstringconcatformattedint(Getselfcog(), "Ship creation failure, cog %d.  Likely cause:  Bad template.");
JKstringoutput(-1, -1);
Settimer(0.1);
Stop;
Timer: Call Go; Stop;
End


Thats one I did for Pagewizard awhile back. It works on a slightly different principle, but I think you can figure it out. [http://forums.massassi.net/html/tongue.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.

GBK oNline. Cogs, tuts, and total w00tage.

[This message has been edited by GBK (edited December 09, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-12-14, 12:51 PM #4
hmmm, doesn't seem to work. I don't know if i saved/templated it correctly, but it is in JED. I filled in the stuff, made the frames, etc. and when i run the level, the ship just sits there...
2002-12-14, 1:06 PM #5
Which cog?
And when the moment is right, I'm gonna fly a kite.
2002-12-14, 2:49 PM #6
I tried both Cogs...

Well, how bout another question...

How bout just re-write the AIPatrol cog so that walkstructures could move, instead of just AIs?

↑ Up to the top!