View Full Version : Movement Cog
I have a feeling that this would be fairly simplistic to do but I, being one who knows nothing about cogging, must turn to you, the experienced coggers, for help once again. I need a cog for multiplayer that will take a 3do, (designated by me), and make it move when the player steps on it. It will move out to a set destination and once it gets there, it will turn around (stop its forward movement and rotate smoothly 180 degrees) and head back to its starting point. Don't forget that when it gets to its beginning point, it probably has to rotate again to adjust for the angle that it started at. If there is anyone out there that could compile a cog for me that does all that, please let me know! Thanks guys. -Xak
#06/2002 GBK
Symbols
Message Entered
Thing Object
Flex Speed_move=4
Flex Speed_turn=1
Int A=0 Local
End
Code
Entered:
If(A) Stop; A=1;
Movetoframe(Object, 1, Speed_move); Waitforstop(Object);
Movetoframe(Object, 2, Speed_turn); Waitforstop(Object);
Movetoframe(Object, 3, Speed_move); Waitforstop(Object);
Movetoframe(Object, 0, Speed_turn); Waitforstop(Object);
A=0; Stop;
End
In order for this to work correctly;
Frame0 must be its original position.
Frame1 must be the end of the first stretch, just before the turn.
Frame2 will be Frame1, with the turn.
Frame3 is the end of the second trip home.
------------------
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 (http://www.tbns.net/GBK/ol/index.htm).
Thanks GBK. That should do it. Hopefully the object's speed isn't too high. -Xak
SaberMaster
06-26-2002, 06:57 PM
GBK, the problem with that is MoveToFrame() will send the object through every frame on its way to frame 0. And SkipToFrame() won't make the object turn to match the lvec of the frame it sends an object to. My solution would be to add another frame (for a total of five) and use this frame coding:
MoveToFrame(Object, 1, Speed_move);
WaitForStop(Object);
MoveToFrame(Object, 2, Speed_turn);
WaitForStop(Object);
MoveToFrame(Object, 3, Speed_move);
WaitForStop(Object);
MoveToFrame(Object, 4, Speed_turn);
WaitForStop(Object);
SkipToFrame(Object, 0, Speed_move);
WaitForStop(Object);
And the frames are:
frame 0: original position.
frame 1: reached destination.
frame 2: same pos as frame 1, but turned around.
frame 3: reached original pos.
frame 4: turned around again.
frames 0, 3, and 4 should be at the starting position and frames 1 and 2 should be at the destination.
--------------
Sorry to cut in on your thread, GBK, but I was working on this a few hours ago before I had to go somewhere. http://forums.massassi.net/html/redface.gif
------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).
Dont worry about cutting in . . . but you misunderstood the code.
Ive known for a long time about the proper usage of 'Movetoframe'. Hell, Ive argued with n00bs countless times over it... The first frame, frame0, is identical to frame3, cept is has an opposite Y axis. . . . perhaps a pictoral referance?
http://gbk.clanpages.com/misc/frames.gif
I dont understand why you are throwing in the extra frame, when it isnt needed. http://forums.massassi.net/html/confused.gif
Ive used this method before, without problems.
------------------
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 (http://www.tbns.net/GBK/ol/index.htm).
SaberMaster
06-27-2002, 11:16 AM
When the object is on frame 3, and a MoveToFrame() command is used to move it to frame 0, the object will travel to frame 2 and then to frame 1 on it's way to zero.
I put in frame 4 to turn the object around before skipping directly to frame 0. I actually made a small test level to make sure of this.
------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).
Hey guys, uh, sorry to cut in here, but... it doesn't work. I input the correct fields, programmed in all the frames, and the skiff (which is the 3do I am using to move) just... well it doesn't move. Please look over the coding again for it just doesn't seem to function... at all. Thanks. -Xak
PS: Ok. If you without a doubt KNOW that this cog will work, send me the fully compiled cog via email. If it still doesn't work... well then I'll see what I can do from there. My email is Xak@balask.com
[This message has been edited by Xak (edited June 27, 2002).]
Whoops spoke to soon. Yup I just got it to work. Turns out I had the wrong option clicked on in Jed that prevented me from entering in the correct frames. Its all fixed now so thanks a lot guys. I don't know what I'd do without ya! -Xak
SaberMaster
06-27-2002, 12:55 PM
You're welcome. http://forums.massassi.net/html/wink.gif
------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).
Oh my. Why didnt I think of that? http://forums.massassi.net/html/frown.gif
*bangs head on keyboard*
------------------
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 (http://www.tbns.net/GBK/ol/index.htm).
Descent_pilot
06-27-2002, 05:44 PM
Think Wolfy. Think about how I felt. Or go to Dash_Rendar's most recent topic. That will make you feel much better.
------------------
The Sniper Missions. Current project, The Sniper Missions
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.