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 → A COG that crahses the game!
A COG that crahses the game!
2003-07-22, 10:32 PM #1
Hi!
This COG crashes my game the moment I have any picture of the level!
Code:
# Open detention door and someone will run out
#
# By Edward
symbols

message		activated
message		pulse

thing		door

surface		light

thing		prisoner

material	free

int		out=0	local
int		pos=0	local

sound		thanks0
sound		thanks1
sound		thanks2
sound		thanks3
sound		thanks4
sound		thanks5
sound		thanks6
sound		thanks7

end
#
code
activated:
	If(GetSenderRef()!=door) return;
	If(out==1) return;
	MoveToFrame(door,1,8);
	WaitForStop(door);
	SetSurfaceMat(light,free);
	PlaySoundThing(thanks0[rand()*7],prisoner,1,-1,10,0xC0);
	out=1;
	pos=pos+1;
	AISetMoveFrame(prisoner,pos);
	AISetLookFrame(prisoner,pos);
	SetPulse(1);
return;
pulse:
	If(out==0) return;
	If(IsThingMoving(prisoner)==1) return;
	If(pos==4)
	{
		sleep(1);
		DestroyThing(prisoner);
	}
	else
	{
		pos=pos+1;
		AISetMoveFrame(prisoner,pos);
		AISetLookFrame(prisoner,pos);
	}
return;
end

It didn't crash before I changed something... I changed from arrived to pulse, took away If(GetSenderRef()!=prisoner) return; and added If(out==0) return; and the IsThingMoving. Please help!
If you wonder what crashes, then create one big room, a door leading to a Command deck, and from there, a door leading to a detention center. Make 8 small crowded rooms with a different prisoner in each one that has 5 walk frames (first frame is origin). And don't forget to have different thank yous and give the correct voice to the correct creature...

/Edward


[This message has been edited by Edward (edited July 23, 2003).]
Edward's Cognative Hazards
2003-07-23, 3:12 AM #2
I would shut the pulse off, once you destroy the prisoner. Something like:

If(pos == 4)
{
sleep(1);
DestroyThing(prisoner);
SetPulse(0);
Return;
}
else

You have to be careful with DestroyThing(), you should always check that the thing you want to destroy exists. Also it's probably not a problem but it could be: I never like using Sleep() in a pulse, especially one as long as 1 sec. I would try to do without it or use a timer.

You should probably add an if() statement to prevent the the cog from trying to run if they activate the cog more than 4 times also.
------------------
- Wisdom is 99% experience, 1% knowledge. -



[This message has been edited by The_New_Guy (edited July 23, 2003).]
- Wisdom is 99% experience, 1% knowledge. -
2003-07-23, 4:49 AM #3
No change!
Update:
Code:
# Open detention door and someone will run out
#
# By Edward
symbols

message		activated
message		pulse
message		timer

thing		door

surface		light

thing		prisoner

material	free

int		out=0	local
int		pos=0	local

sound		thanks0
sound		thanks1
sound		thanks2
sound		thanks3
sound		thanks4
sound		thanks5
sound		thanks6
sound		thanks7

end
#
code
activated:
	If(GetSenderRef()!=door) return;
	If(out==1) return;
	out=1;
	MoveToFrame(door,1,8);
	WaitForStop(door);
	SetSurfaceMat(light,free);
	PlaySoundThing(thanks0[rand()*7],prisoner,1,-1,10,0xC0);
	pos=pos+1;
	AISetMoveFrame(prisoner,pos);
	AISetLookFrame(prisoner,pos);
	SetPulse(1);
return;
pulse:
	If(out==0) return;
	If(IsThingMoving(prisoner)==1) return;
	If(pos==4)
	{
		SetTimer(1);
		SetPulse(0);
		Return;
	}
	else
	{
		pos=pos+1;
		AISetMoveFrame(prisoner,pos);
		AISetLookFrame(prisoner,pos);
	}
return;
timer:
	DestroyThing(prisoner);
return;
end
Edward's Cognative Hazards
2003-07-23, 5:01 AM #4
You're sure it's this cog? You don't have anything running on startup, I don't see how it could. Try taking the cog out and loading a level.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-07-23, 6:26 AM #5
Well what do you know! I wasn't this COG! I first tried to add # by each message and same thing... So I took them away and same thing...
So... What did I do before I changed the Arrived to Pulse...

/Edward
Edward's Cognative Hazards
2003-07-23, 6:40 AM #6
I've looked but can't find anything wrong!
Tell me... What would cause a crash like this:
The level loads... Loads to full, then my level shows on the screen for 0.1 seconds and then quits.

[edit] I think it is something I'm seeing that the game doesn't like seeing...

/Edward


[This message has been edited by Edward (edited July 23, 2003).]
Edward's Cognative Hazards
2003-07-23, 7:52 AM #7
For some reason you can't be sure what's actually being destroyed by DestroyThing() and you might end up destroying the player, so I would put
Code:
if(prisoner != -1)
{
   DestroyThing(prisoner);
} 


[This message has been edited by Ace1 (edited July 23, 2003).]
I am _ Ace_1 _ , and I approve this message.
2003-07-23, 8:14 AM #8
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Ace1:
For some reason you can't be sure what's actually being destroyed by DestroyThing() and you might end up destroying the player, so I would put
Code:
if(prisoner != -1)
{
   DestroyThing(prisoner);
} 

</font>

I said that it wasn't this COG!
Humph...
Who can I trust with my LIFE to send it to without them Blurting out what I'm making...

/Edward


[This message has been edited by Edward (edited July 23, 2003).]
Edward's Cognative Hazards
2003-07-23, 8:15 AM #9
He just said this cog wasn't the problem, Ace, but destroying -1 will not hurt. But if you have any doubt about the thing you're destroying, check to make sure it's not the player, or check to make sure its signature matches an older signature.

Edward, did you make any changes to the items.dat? Usually crashes caused by the items.dat cause the level to crash just before you actually see anything, but it's worth checking. If cogs are getting the chance to run, then perhaps it's in another cog from your level.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-07-23, 8:18 AM #10
Haven't changed any items.dat...

/Edward
Edward's Cognative Hazards
2003-07-23, 12:20 PM #11
well, i dident manage that spning whell thing..
but you can trust me i will find any errors, and instantly destroy them... without blurting a thing

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-07-23, 1:37 PM #12
Edward, I'd suggest; make a big backup first. Then start taking out one by one all custom cogs, 3do's, etc. Until it works. last thing you took out is the trouble maker. Simple, dreadful, annoying, time consuming but effective.

------------------
Call me Vedder.
Author of: A Pirate's Tale (Mots SP)
APT homepage
----
<phantom> You're always going to be aloser if you attempt to aspire to massassi standards.
<phantom> They're a bunch of socially inadequate <beep> whores who have little or no lives.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com

↑ Up to the top!