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 → My First [unsuccessful] Attmept at Cog...
My First [unsuccessful] Attmept at Cog...
2003-08-13, 4:50 PM #1
Well, I tried modifying the JK cog "00_doubledoor.cog" so that it will play the particular sound file I fancy for it when it opens ("door01.wav" to be precise).

Well, just take a look at the cog and I'm sure you experts will have no problem at seeing where I went wrong! Thanks, and please excuse the newbie-ishness of this, the only text language I really know much about is HTML... [http://forums.massassi.net/html/redface.gif]
Code:
# Jedi Knight Cog Script
# Door Script
#
#
# [SXC]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

symbols
message		startup		
message		activate	
message		arrived		
message		blocked		

thing		door0		linkid=0
thing		door1		linkid=1

flex		movespeed=8.0
flex		sleeptime=2.0
flex		lightvalue=0.5
sector		doorsector	local
int		numdoors	local
int		doorstatus	local
int		movestatus	local
sector		doorsector2	local
sound	wav0=doo01.wav  local[/i]
end

## Code Section

code

# .................................................................................................

startup:
	if (door0 >= 0)	numdoors = numdoors + 1;
	if (door1 >= 0) numdoors = numdoors + 1;

	doorsector = getthingsector(door0);
	doorsector2 = getthingsector(door1);

	sectoradjoins(doorsector, 0);
	sectoradjoins(doorsector2, 0);

	sectorlight(doorsector, lightvalue, 0.0);      		// add some light to door sector
	sectorlight(doorsector2, lightvalue, 0.0);
	return;

# .................................................................................................

activate:
	call checkstatus;
	if (movestatus) return;
	if (doorstatus == 0) {					// all pieces are at frame 0
		sectoradjoins(doorsector, 1);
		sectoradjoins(doorsector2, 1);
		call open_doors;
	}
	return;

# .................................................................................................

arrived:
	call checkstatus;
	if (movestatus) return;
	if (doorstatus == numdoors) {				// all pieces are at frame 1
		sleep(sleeptime);
		call close_doors;
	} else if (doorstatus == 0) {				// all pieces are at frame 0
		sectoradjoins(doorsector, 0);
		sectoradjoins(doorsector2, 0);
	}
	return;

# .................................................................................................

blocked:
	call open_doors;
	return;

# .................................................................................................

open_doors:
	movetoframe(door0, 1, movespeed);
	if (door1 >= 0) movetoframe(door1, 1, movespeed);
	return;

# .................................................................................................

close_doors:
	movetoframe(door0, 0, movespeed);
	if (door1 >= 0) movetoframe(door1, 0, movespeed);
	return;

# .................................................................................................

checkstatus:
	movestatus = ismoving(door0);
	if (door1 >= 0) movestatus = movestatus + ismoving(door1);

	doorstatus = getcurframe(door0);
	if (door1 >= 0) doorstatus = doorstatus + getcurframe(door1);
	return;

end



[This message has been edited by SaberMaster (edited August 13, 2003).]
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2003-08-13, 5:09 PM #2
You do have door01.wav in your cog, right? But aside from that symbol, what did you change in the cog? What do you expect to play the sound? You should have PlaySoundThing() or an equivalent in open_doors to play the sound.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!