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 → Unbreakable Switch
Unbreakable Switch
2004-06-06, 4:37 PM #1
I heavily modified the MotS shootable switch cog for my level, but when I shoot the switch, nothing happens. ParSec catches nothing, and when I removed the return conditional (when it checks if the wallcel is 2), it still didn't work.

Code:
# Jedi Knight Missions Cog Script
#
# S1L2_Exploswitch.COG
#
# Shootable switch cog for level 2
#
# [DB & TL]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#=========================================================
symbols

message	startup
message	damaged
message	timer
message activated                               

surface	panel
surface	other

thing	sparkspot
thing	console
thing	door

thing	edoor0
thing	edoor1

template        spark=+sparks			local

sound	sparksound		
sound   wav0=lvrclik2.wav
sound   wav1=df_door3-3.wav
sound	beep=beep1.wav
sound	neg

flex	minimumDelay=2.0
flex	maximumDelay=4.0
flex    nextSpark=0.5                              local
end

#=========================================================
code
startup:
 SetWallCel(panel , 1);
return;
activated:
        if (GetSenderRef() == console)
        {
		PlaySoundLocal(beep, 1, 0, 0x0);
		MoveToFrame(edoor0, 1, 3);
		MoveToFrame(edoor1, 1, 3);
        }  
        if (GetSenderRef() == door)
        {
                Print("The door is locked AND indestructible.");
                PlaySoundLocal(wav0, 1, 0, 0);
        }    
        if (GetSenderRef()==other)
        {
                Print("The door is locked from the other side.");
                PlaySoundLocal(neg, 1, 0, 0);
        }    
	if (GetSenderRef()==edoor0)
        {
		PlaySoundLocal(wav1, 1, 0, 0x0);
		Print("The elevator is remotely controlled.");
        }
	if (GetSenderRef()==edoor1)
        {
		PlaySoundLocal(wav1, 1, 0, 0x0);
		Print("The elevator is remotely controlled.");
        }
	return; 

damaged:
  	if (GetWallCel(panel) == 2) return;
	
	if (GetSenderRef() == panel) 	
 	{
     		SetWallCel(panel , 1);
     		
     		MoveToFrame(door, 1, 5);	    
     		CreateThing(spark, sparkspot);
     	        PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);
                
                SetTimer(nextspark);	
	}
  	return;

#............................................................
timer:
	CreateThing(spark, sparkspot);
     	PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);

        nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
	SetTimer(nextSpark);
	return;


end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-06-06, 5:03 PM #2
The problem is your SetWallCel()s. Look at the int following then. In startup, its 1, in damaged, its 1. So in effect, it does nothing for it stays on the same cel. Typo mistake I'd imagine. [http://forums.massassi.net/html/tongue.gif]

Also, I do know the GetWallCell doesn't work in JK, I don't know bout MotS.

------------------
Major projects working on:
SATNRT
JK Pistol Mod
Aliens TC

[This message has been edited by Descent_pilot (edited June 06, 2004).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2004-06-06, 5:53 PM #3
Ok, but the door still doesn't move.

------------------
Rites of Xanthus

The TC that exacted a terrible toll on my time and eyesight.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-06-06, 6:55 PM #4
Does anything else in that block work? Put a print statement to see, if you haven't already.
If that doesn't print, try commenting out "if(GsR() == panel)" and "if(Getwallcel() == 2) return;". If it still doesn't run, maybe the door doesn't have the frames set up right or is already at frame 1 (as in, frame 1 is at the position of frame 0 or something)

------------------
for(i = 0; i < 00; i = i + 1) Print("massassi is good");
PrintInt(i); //print the integer value of infinity (if we ever get there)
May the mass times acceleration be with you.
2004-06-07, 1:57 AM #5
Well the one thing that immediately leaps out at me is the timer message block - you shouldn't be using the Rand() verb in conjuction with setting a new timer, due to program threads geting caught up amongst themselves whilst executing. Incidentally, you should be using the "SetTimerEx(params)" verb if you're implementing several timers [http://forums.massassi.net/html/wink.gif]

What would work more efficiently, if it's for SP, would be a pulse message cycle instead. Granted you'd lose some of that "random" factor, but it'd be where you draw the line in terms of trade-offs... [http://forums.massassi.net/html/redface.gif]

As far as debugging goes, you've heard the drill about using "Print()" statements - hop to it [http://forums.massassi.net/html/tongue.gif]. The only other thing I can think of has been touched upon by Slaw - are you sure that the frame movements have been set-up correctly? Other than that - please sort out that code indenting [http://forums.massassi.net/html/tongue.gif] [http://forums.massassi.net/html/wink.gif]

Hope at least some of this advice helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-07, 3:34 AM #6
Quote:
<font face="Verdana, Arial" size="2">Originally posted by lucky_jackpot:
Well the one thing that immediately leaps out at me is the timer message block - you shouldn't be using the Rand() verb in conjuction with setting a new timer, due to program threads geting caught up amongst themselves whilst executing. Incidentally, you should be using the "SetTimerEx(params)" verb if you're implementing several timers [http://forums.massassi.net/html/wink.gif]
</font>


WTFH are you talking about? You use SetTimer() when you only want one timer running. Rand() will NOT make the system get caught up in itself for when you set a timer before the time runs out, then it has that delay left to go. That goes for SetTimer(), and the IDs of SetTimerEx(). And even if that weren't true, it still wouldn't apply to this case (considering the If(GetWallCel() works properly), since only timer is started then repeats within itself. In addition, timer is better for the random factor, since you could do pulse, and change the pulse time at the end using the same formula, but that would seem odd.

For the doors not opening, check to see the frames of the doors. I dunno whats in the level, but in here, your frames are 3 and 5.

------------------
Major projects working on:
SATNRT
JK Pistol Mod
Aliens TC
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2004-06-07, 4:44 AM #7
Well forgive me for even bothering to try and help, DP [http://forums.massassi.net/html/frown.gif]. Fair enough, you have a point that if the "if" condition returns true then the rest isn't executed but with regard to using "SetTimerEx()", I never said that he was using "SetTimer()" verb incorrectly and to use "SetTimerEx()" verb instead - you'll note it was more an information based post, hence the use of the word incidentally [http://forums.massassi.net/html/wink.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-07, 7:45 AM #8
:S Everything works except the actual shotoing of the switch.

Code:
# Jedi Knight Missions Cog Script
#
# S1L2_Exploswitch.COG
#
# Shootable switch cog for level 2
#
# [DB & TL]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#=========================================================
symbols

message	startup
message	damaged
#message	timer
message activated                               

surface	panel
surface	other

thing	sparkspot
thing	console
thing	door

thing	edoor0
thing	edoor1

template        spark=+sparks			local

sound	sparksound		
sound   wav0=lvrclik2.wav
sound   wav1=df_door3-3.wav
sound	beep=beep1.wav
sound	neg

flex	minimumDelay=2.0
flex	maximumDelay=4.0
flex    nextSpark=0.5                              local
sound	check
end

#=========================================================
code
startup:
 SetWallCel(panel , 1);
return;
activated:
if (GetSenderRef() == console) {
 PlaySoundLocal(beep, 1, 0, 0x0);
 MoveToFrame(edoor0, 1, 3);
 MoveToFrame(edoor1, 1, 3);
 Print("Checkpoint!");
 PlaySoundLocal(check, 1, 0, 0x0);
 AutoSaveGame();
}  
if (GetSenderRef() == door) {
 Print("The door is locked AND indestructible.");
 PlaySoundLocal(wav0, 1, 0, 0);
}    
if (GetSenderRef()==other) {
 Print("The door is locked from the other side.");
 PlaySoundLocal(neg, 1, 0, 0);
}    
if (GetSenderRef()==edoor0) {
 PlaySoundLocal(wav1, 1, 0, 0x0);
 Print("The elevator is remotely controlled.");
}
if (GetSenderRef()==edoor1) {
 PlaySoundLocal(wav1, 1, 0, 0x0);
 Print("The elevator is remotely controlled.");
}
return; 

damaged:
//if (GetWallCel(panel) == 2) return;
	
if (GetSenderRef() == panel) {
 SetWallCel(panel , 2);
 MoveToFrame(door, 1, 5);	    
 CreateThing(spark, sparkspot);
 PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);
// SetTimer(nextspark);	
}
return;

#............................................................
//timer:
//CreateThing(spark, sparkspot);
//PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);
//nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
//SetTimer(nextSpark);
//return;


end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-06-07, 8:59 AM #9
Try giving the switch that is shootable the mask flags of 0x408 in the symbols section - I've got a similar cog that moves a door when the switch is shot and it works quite nicely using this technique... [http://forums.massassi.net/html/smile.gif]

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-07, 9:11 AM #10
YAY!

Thank you lucky_jackpot, it works perfectly.

------------------
Rites of Xanthus

The TC that exacted a terrible toll on my time and eyesight.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-06-07, 9:18 AM #11
Your welcome [http://forums.massassi.net/html/biggrin.gif] Glad to have helped [http://forums.massassi.net/html/biggrin.gif]

I was viewing the cog before at work (without the datamaster [http://forums.massassi.net/html/redface.gif]), but I knew that I'd done the exact same thing you wanted before, in one of my cogs, and I couldn't remember for the life of me what the solution was. I thought it may have been something in the symbols section, but alas - my memory's failing - it's this "old age" thing, once you hit the twenties and all... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-07, 9:35 AM #12
[http://forums.massassi.net/html/redface.gif] Sorry for being grouching, too many late nights, too many tests and projects. [http://forums.massassi.net/html/frown.gif] I misinterpreted your response and yea. [http://forums.massassi.net/html/tongue.gif] Anyways, I'm gunna go now seeing your at least 5 years my elder. [http://forums.massassi.net/html/redface.gif] [http://forums.massassi.net/html/tongue.gif]

------------------
Major projects working on:
SATNRT
JK Pistol Mod
Aliens TC
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2004-06-07, 11:27 AM #13
In that case, I'll forgive you DP [http://forums.massassi.net/html/tongue.gif] - but be on with you, you young whipper-snapper, before I plant my walking stick squarely on your a$$, for "being cheeky to your elders"... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot [http://forums.massassi.net/html/biggrin.gif]

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-07, 6:20 PM #14
lol, rotfl, lmao (so you can't put that cane in it [http://forums.massassi.net/html/tongue.gif]) but I useually feel about 70 [http://forums.massassi.net/html/tongue.gif] [http://forums.massassi.net/html/wink.gif]

------------------
Major projects working on:
SATNRT
JK Pistol Mod
Aliens TC
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!