PDA

View Full Version : I'm not gay, but I'll learn.



ZOOIkes
05-21-2002, 09:49 AM
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...)

# 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

gbk
05-21-2002, 10:34 AM
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).]

gbk
05-21-2002, 10:36 AM
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 (http://www.tbns.net/GBK/ol/index.htm).

ZOOIkes
05-21-2002, 01:15 PM
It's a quote from homer simpson, I just needed a funny thread title, no offence intented.

ZOOIkes
05-21-2002, 01:17 PM
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).]

gbk
05-21-2002, 04:04 PM
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 (http://www.tbns.net/GBK/ol/index.htm).

ZOOIkes
05-22-2002, 09:44 AM
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.

Sylvicolus
05-23-2002, 10:44 AM
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 (http://www.lactarius.com/sylvicolus/jk/)
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).]

gbk
05-23-2002, 11:01 AM
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 (http://www.tbns.net/GBK/ol/index.htm).

Sylvicolus
05-23-2002, 01:05 PM
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 (http://www.lactarius.com/sylvicolus/jk/)
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton

gbk
05-23-2002, 07:16 PM
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 (http://www.tbns.net/GBK/ol/index.htm).