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 A Simple Elevator Cog ASAP, Please! :-0
I Need A Simple Elevator Cog ASAP, Please! :-0
2005-08-20, 6:55 PM #1
Yes, I need it before tomorrow - so early in the morning. I have a contest deadline which I have planned badly for. :(

Anyway, I just need a simple cog for a flat, open elevator (no doors) which has three levels (frames) and starts at he bottom frame by default. It has 7 switches (surfaces) like so:

1st Level - 1 call button and 1 button to drive the elevator UP to the 2nd level
2nd Level - 1 call button, 1 button to drive the elevator up to the 3rd level, and 1 button to drive the elevator down to the first level
3rd Level - 1 call button and 1 button to drive the elevator down to the 2nd level

So 7 button surfaces total, 1 elevator, 3 frames, starts at bottom frame and preferably plays a sound while moving!

THanks! PLEASE HURRY!

- Daft
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-08-20, 8:28 PM #2
I'm on the job!
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2005-08-20, 8:42 PM #3
Code:
# trivator.cog
# They still have JK mapping contests?!
# [by GREEEESMATH, Cogifex Maximus]
#==============================================================#
symbols
message		activated
message		timer
thing		lift

surface		call0
surface		call1
surface		call2

surface		up0
surface		up1

surface		down1
surface		down2
float		moveSpeed
float		switchDelay
int		dest=-1		local
int		i		local
sound		switchSound
end
#==============================================================#
code
#------------------------------------------------------
activated:
if(GetSenderType()==6 && dest<0) {	// check to see if it's a surface
	for(i=0; i<3; i=i+1) {
		if(GetSenderRef()==call0) {
			dest=i;
			SetWallCel(call0, 1);
		}
	}
	if(GetSenderRef()==up0) {
		dest=1;
		SetWallCel(up0, 1);
	}
	if(GetSenderRef()==up1) {
		dest=2;
		SetWallCel(up1, 1);
	}
	if(GetSenderRef()==down1) {
		dest=0;
		SetWallCel(down1, 1);
	}
	if(GetSenderRef()==down2) {
		dest=1;
		SetWallCel(down2, 1);
	}
}
if(dest>=0) {
	PlaySoundLocal(switchSound, 1, 0, 0x0);
	SetTimer(switchDelay);
}
return;
#------------------------------------------------------
timer:
	MoveToFrame(lift, dest, moveSpeed);
	WaitForStop(lift);
	dest=-1;
	SetWallCel(call0, 0);
	SetWallCel(call1, 0);
	SetWallCel(call2, 0);
	SetWallCel(up0, 0);
	SetWallCel(up1, 0);
	SetWallCel(down1, 0);
	SetWallCel(down2, 0);
return;
#------------------------------------------------------
end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2005-08-20, 9:26 PM #4
The following cog is untested, but it has passed successfully in Parsec. I had already started this before Grismath posted, and I thought this cog would make for good comparison. (By the way, I see one bug in Grismath's cog so that it will never move the lift.)
Code:
# elevator_switches
# 
# flat, open elevator (no doors) which has three levels (frames) 
# starts at he bottom frame by default. 
# It has 7 switches (surfaces) like so:
# 1st Level - 1 call button and 1 button to drive the elevator UP to the 2nd level
# 2nd Level - 1 call button, 1 button to drive the elevator up to the 3rd level, and 1 button to drive the elevator down to the first level
# 3rd Level - 1 call button and 1 button to drive the elevator down to the 2nd level
# plays a sound while moving
#
# Based on 00_elevcall.cog.
#
# ZeqMacaw 21-Aug-2005
#
# THIS LEVEL IS NOT MADE, DISTRIBUTED, OR SUPPORTED BY LUCASARTS ENTERTAINMENT 
# COMPANY.  ELEMENTS TM & (C) LUCASARTS ENTERTAINMENT COMPANY.

symbols
	thing           elevator
	flex            elevator_speed=4.0
	sound			call_button_sound=beep2.wav
	sound			updown_button_sound=beep1.wav

	surface     call_button_1     linkid=11
	surface     call_button_2     linkid=12
	surface     call_button_3     linkid=13

	surface     up_button_1       linkid=21
	surface     up_button_2       linkid=22

	surface     down_button_2     linkid=32
	surface     down_button_3     linkid=33

	surface     button_pressed    local
	int         button_id         local
	int         call_button_is_active=0     local

	message         activated
end

code

activated:
	if (GetSenderRef() == elevator)
	{
		return;
	}

	button_pressed = GetSenderRef();
	button_id = GetSenderID();
	if (button_id < 20)
	{
		button_id = button_id - 11;
		if (GetCurFrame(elevator) == button_id)
		{
			SetWallCel(call_button_1[button_id], 1);
			SetWallCel(call_button_1[button_id], 0);
		}
		else 
		if (!call_button_is_active)
		{
			call_button_is_active = 1;
			PlaySoundPos(call_button_sound, SurfaceCenter(button_pressed), 1, -1, -1, 0);
			SetWallCel(call_button_1[button_id], 1);
			MoveToFrame(elevator, button_id, elevator_speed);
			WaitForStop(elevator);
			call_button_is_active = 0;
			SetWallCel(call_button_1[button_id], 0);
		}
	}
	else 
	if (button_id < 30)
	{
		button_id = button_id - 21;
		PlaySoundPos(updown_button_sound, SurfaceCenter(button_pressed), 1, -1, -1, 0);
		SetWallCel(up_button_1[button_id], 1);
		MoveToFrame(elevator, button_id + 1, elevator_speed);
		WaitForStop(elevator);
		SetWallCel(up_button_1[button_id], 0);
	}
	else
	{
		button_id = button_id - 31;
		PlaySoundPos(updown_button_sound, SurfaceCenter(button_pressed), 1, -1, -1, 0);
		SetWallCel(down_button_2[button_id], 1);
		MoveToFrame(elevator, button_id - 1, elevator_speed);
		WaitForStop(elevator);
		SetWallCel(down_button_2[button_id], 0);
	}

	return;

end
:)
2005-08-20, 9:31 PM #5
Thankyou, both! I have been off-line for a while due to my internet cutting off, but it's working now! THank you again, your work is much appreciated! :)
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-08-21, 7:56 AM #6
OOOOOH! You make me mad. I hereby demote myself to Cogifex Minimus... especially at midnight.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2005-08-21, 9:53 AM #7
FYI guys, there's a cog that does that already in JK. YOu just need one per level

00_elevcall.cog. Its in res2.gob
I've got a website. It's at Geocities because I'm too cheap to get my own site.
2005-08-21, 12:16 PM #8
LEC cogs are teh sux0r... speak not to the Cogifex Maximus about them.

If it doesn't have concatenation and esoteric heap commands, I don't want to hear about it.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2005-08-21, 9:26 PM #9
I rarely use LEC cogs -- I use my own....
Then again, I mostly make mods, not levels, so that may have something to do with it ;) :p
May the mass times acceleration be with you.

↑ Up to the top!