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'm not gay, but I'll learn.
I'm not gay, but I'll learn.
2002-05-21, 6:49 AM #1
Ok, I've been editing jk for 1,5 years now, and frankly I still suck with cogging...

This time is the first time I tried making a if, else statement, so that's probably where I went wrong.

The idea:
Teleport, but after a button is shot it teleports to a different location.

The preperation:
We take s5l4_teleport.cog as a base.

The work:
We *try to make it do the things we want it to do*. I came up with this, which *obviously [http://forums.massassi.net/html/smile.gif]* doesn't work. (I'm surprisingly good in making non functional cogs [http://forums.massassi.net/html/smile.gif]) (Syntax checker keeps silent, as usual...)
Code:
# Jedi Knight Missions Cog
#
# [TL]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#============================================================================

symbols
message entered
message startup        
message damaged
sector	enter0			                linkid=1					
sector	enter1			                linkid=1
sector	enter2			                linkid=1
sector	enter3			                linkid=1
sector	enter4			                linkid=1
sector	enter5			                linkid=1
                                
int 	player  		                local
int     dummy                                   local
surface	button
sound   teleportsnd=sithtmplloop.wav
thing newspot2
thing	newspot

end

#============================================================================

code
entered:
	player=GetLocalPlayerThing();
	StopThing(player);	
	
	AddDynamicAdd(player, .612, .439, .98);
        If (GetWallCel(button)= 0)
        Sleep(0.25);
        AddDynamicAdd(player, 255, 255, 255);
        dummy = PlaySoundLocal(teleportsnd, 1.0, 0, 0);
        
        TeleportThing(player, newspot);
	Else TeleportThing(player, newspot2);
	return;
damaged:
	if (GetSenderRef() == button);
	SetWallCel(button, 1);
end
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-05-21, 7:34 AM #2
Code:
symbols
Message Startup
message entered
message damaged
sector 	enter0			                linkid=1
sector 	enter1			                linkid=1
sector 	enter2			                linkid=1
sector 	enter3			                linkid=1
sector 	enter4			                linkid=1
sector 	enter5			                linkid=1
                                
int 	player  		                local
surface 	button      Mask=0x448
sound 	teleportsnd=sithtmplloop.wav
thing 	newspot2
thing 	newspot
end
code

Startup: Setwallcel(button, 0); Stop;
entered: player=GetLocalPlayerThing();
StopThing(player);	
AddDynamicAdd(player, .612, .439, .98);
If (GetWallCel(button) == 0) {
Sleep(0.25);
AddDynamicAdd(player, 255, 255, 255);
PlaySoundLocal(teleportsnd, 1.0, 0, 0);
TeleportThing(player, newspot); }
Else TeleportThing(player, newspot2);
return;

damaged:
if (GetSenderRef() == button) SetWallCel(button, 1);
Stop;
end



 

IT SHOULD WORK NOW.

 


[This message has been edited by GBK (edited May 23, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-05-21, 7:36 AM #3
And BTW, what is this about being gay?!? Are you suggesting coggers are gay?!?!? [http://forums.massassi.net/html/mad.gif]

Ive never ben so insulted in my life!

------------------
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.
And when the moment is right, I'm gonna fly a kite.
2002-05-21, 10:15 AM #4
It's a quote from homer simpson, I just needed a funny thread title, no offence intented.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-05-21, 10:17 AM #5
Oh I'll try the cog In a minute...

[edit: one minute later] Hmm, does alot more then my cog but doesn't quite do it yet.
1) Somehow in both cases it teleports to newspot2. Weird, perhaps I should add a startup and do a SetWallCell(button, 0); first?
2) The button seems to only take damage from the lightsaber, how could I make sure a simple blasterbolt does the trick?



[This message has been edited by ZOOIkes (edited May 21, 2002).]
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-05-21, 1:04 PM #6
Oops, try it now.

------------------
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.
And when the moment is right, I'm gonna fly a kite.
2002-05-22, 6:44 AM #7
Thanks alot (again)!

It still had problem 1, though I don't see why, but I solved it by changing, GetWallCel(button) == 0 into != 1, and then it worked. Weird.
Thanks alot.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-05-23, 7:44 AM #8
The problem I see is that in symbols there is:
surface button Mask=0x448
But in the code there is:
Startup: Setwallcel(Switch, 0); Stop;

The surface name needs to be the same in both places (either "button" or "Switch").
Then the function: Setwallcel(Switch, 0); will work properly.

------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton

[This message has been edited by Sylvicolus (edited May 23, 2002).]
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2002-05-23, 8:01 AM #9
Oops, my fault.

But its strange. It has been my expiriance, that any of the 'wallcel' verbs will crash if the specified variable is incorrect or nonexistant.... [http://forums.massassi.net/html/confused.gif]

------------------
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.
And when the moment is right, I'm gonna fly a kite.
2002-05-23, 10:05 AM #10
The thing I had trouble with before was that a cog can't check a wallcel, getwallcel(switch), unless you use the setwallcel() function in the startup.

------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2002-05-23, 4:16 PM #11
Ive noticed that too.... su><bad!

------------------
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.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!