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 → Elevator cog
Elevator cog
2002-12-15, 5:02 PM #1
This probably isn't too hard, but I can barely modify JK cogs, let alone make them from scratch.

I basically want an object(s) to move up and down between 2 frames continuously, and wait for a random amount of time at each stop. That's it. No buttons or adjoins or anything.

Any help would be greatly appreciated, and given credit in my level's readme, and my children named after you.

OK, maybe not the last thing. Maybe.
2002-12-15, 5:43 PM #2
Umm, ok. My real name is "Ugly SOB". Keep you promise!

Code:
#12/2002 GBK
Symbols
Message Startup
Message Arrived
Thing Elev
Flex Rand_multiplyer=5
Flex Speed=4
End
Code
Startup:
Sleep(0.5);
Movetoframe(Elev, 1, Speed);
Stop;
Arrived:
Sleep(Rand()*Rand_multiplyer);
Movetoframe(Elev, 1 - Getcurframe(Elev), Speed);
Stop;
End


That should do the trick. "Rand_multiplyer" is a flex that defines how long to wait, or rather, what to multiply the random number by. At 5, the wait would be anywhere from 5 seconds to nothing.

[This message has been edited by GBK (edited December 17, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-12-16, 8:42 PM #3
Hey! I have an uncle named Ugly SOB! What a coinkydink!

Thanks for the cog. I have a few questions now [http://forums.massassi.net/html/smile.gif]

I have 4 of these elevators running alongside a building. It seems like all 4 are on the same timer--each stops and starts at the same time. It also looks like they always pause for the same duration in each cycle.

Is there any way to make each elevator use an independant timer, and have each wait for a different random amount of time at every stop?
2002-12-17, 3:35 AM #4
Oops, sorry, had a symbol error in the cog . . . . try it now. [http://forums.massassi.net/html/frown.gif]
And when the moment is right, I'm gonna fly a kite.
2002-12-18, 6:47 PM #5
Ahh, works perfect! Thanksabunch.
2002-12-18, 6:50 PM #6
[http://forums.massassi.net/html/smile.gif]
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!