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 → moving troop transports
moving troop transports
2001-10-11, 1:24 AM #1
I am making a multiplayer co-op level and want a transportation system in it.

There are 3 transports that move along three different paths continuously, There shouldn't be a trigger - they just move and keep moving once the level is started.

Is there a cog I can use for this? Any suggestions on the best way to implement this?

Thanks!
2001-10-11, 1:35 AM #2
You could use a elevator cog.
2001-10-11, 2:00 AM #3
Which elevator cog?

As far as I can tell all the elevator cogs all are operated by a switch or crossing an adjoin or some trigger. I want something that just keeps going round on its path.

Am I missing something?
2001-10-11, 6:22 AM #4
Hmm, if the transport has more than 2 frames, an elevator cog wont work. Try this:

Symbols
Message Startup
Message Arrived
Thing Trans0
Thing Trans1
Thing Trans2
Int Numframes0
Int Numframes1
Int Numframes2
Flex Movespeed0
Flex Movespeed1
Flex Movespeed2
Sector Transs0 Local
Sector Transs1 Local
Sector Transs2 Local
Int I=0 Local
End
Code
Startup: Sleep(1.0);
For(I=0;I<4;I=I+1) { Transs0 = Getthingsector(Trans0); }
For(I=0;I<4;I=I+1) { Movetoframe(Trans0, Numframes0, Movespeed0); } Return;
Arrived: For(I=0;I<4;I=I+1) { If((Getsenderref() == Trans0) && (Getcurframe(Trans0) == Numframes)) {
Jumptoframe(Trans0, 0, Transs0); Movetoframe(Trans0, Numframes0, Movespeed0); } } Return;
End


Havent tried it, but it should work.


------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-10-11, 10:12 AM #5
Modified a couple things (changed 4 to 3, etc)... this cog should work. The last frame should end in the same position as the first frame. (otherwise you'll have a wierd jump).

Code:
symbols

message startup
message arrived

thing trans0
thing trans1
thing trans2

int numframes0
int numframes1
int numframes2

flex movespeed0
flex movespeed1
flex movespeed2

sector transs0				local
sector transs1				local
sector transs2				local
int i=0					local

end

code

startup:
   sleep(1.0);
   for(i=0;i<3;i=i+1)
   {
     transs0 = GetThingSector(Trans0);
     MoveToFrame(trans0, numframes0, movespeed0);
   }
   return;

arrived:
   for(i=0;i<3;i=i+1)
   {
     if((GetSenderRef() == trans0) && (GetCurFrame(Trans0) == numframes0))
        JumpToFrame(trans0, 0, transs0);
     MoveToFrame(trans0, numframes0, movespeed0);
   }

   return;

end

2001-10-11, 5:03 PM #6
My mistake...

Must have been the coffee...



------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-10-13, 3:38 PM #7
Thanks for this! You guys are great.

I have tried your code Rishka & it doesn't appear to work. [http://forums.massassi.net/html/frown.gif]

The transports just sit there not moving. Can you think of a reason why this is happening? Maye I've not implemented the cog properly (although I have 3 transports, have referenced them into the cog with the correct numbers of frames and given them all a movespeed of 5).

Is it ok for the transports to move between different sectors?

Thanks for your help.

Kharm.
2001-10-13, 4:35 PM #8
Naa, different sectors dont matter. I tried the cog, worked fine for me. One thing though, the 'numframes' int has to be your objects number of frames, minus one. IE- If in your jed objects editor you put 10 frames, place 9 here.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-10-15, 1:14 AM #9
Grrrrr! I just can't get it to work and have no idea what else to try.

GBK, is it at all possible for you to zip your project directory & email it to me?

night_kharm@email.com

Perhaps then I could work out where I'm going wrong. Otherwise, are there any other suggestions why this isn't working for me?

↑ Up to the top!