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 → err Level end cog - whats wrong here?
err Level end cog - whats wrong here?
2002-12-02, 4:50 AM #1
posted December 02, 2002 05:02 AM
--------------------------------------------------------------------------------
Code:
# Jedi Knight Cog Script
#
# endlevel.COG
#
# 
# [EH_AceCSF] 02/12/2002
#
# This COG is NOT supported by LucasArts Entertainment Company
symbols

message user0 
message entered 
message startup 
message crossed 

int numgoalscomplete=0 local 
int numtotalgoals 
int goal1comp=0 local 
int goal2comp=0 local 
int goal3comp=0 local 
int player local 
int exited=0 local 

sector trigger 

surface exitfort 


end 

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

code

startup:

player = jkGetLocalPlayer();
Return;

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

crossed:

if(GetSenderRef() == exitfort)
{
exited = 1;
Return;
}
else
{
Return;
}

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

entered:

if(GetSenderRef() != trigger) Return;

if ((numgoalscomplete == numtotalgoals) && (exited == 1))
{
JKendlevel(0)
Return;
}
else
{
if (exited == 0) Return;
print("Objective Incomplete:");
if (goal1comp == 0) { print("Disable Corvete hangar system."); }
if (goal2comp == 0) { print("Retract the Planetary Shield into the maintenance shelter."); }
if (goal3comp == 0) { print("Shut down the power in main Guns."); }
Return;
}

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

user0:

if(GetParam(0) == 1)
{
numgoalscomplete = (numgoalscomplete + 1);
goal1comp = 1;
Return;
}

if(GetParam(0) == 2)
{
numgoalscomplete = (numgoalscomplete + 1);
goal2comp = 1;
Return;
}

if(GetParam(0) == 3)
{
numgoalscomplete = (numgoalscomplete + 1);
goal3comp = 1;
Return;
}

end


whats wrong here?


[edit- Please, Im begging you, use Code tags.]

[This message has been edited by GBK (edited December 02, 2002).]
2002-12-02, 5:35 AM #2
Code:
# [EH_AceCSF] 02/12/2002, GBK 12/2002
#==============================================================#
symbols

message   user0
message   entered
message   crossed

int       numgoalscomplete=0   local
int       numtotalgoals
int       goal1comp=0          local
int       goal2comp=0          local
int       goal3comp=0          local
int       exited=0             local

sector    trigger

surface   exitfort

end
#==============================================================#
code
#------------------------------------------------------
crossed:
	if(GetSenderRef() == exitfort) exited = 1;

Return;
#------------------------------------------------------
entered:
	if(GetSenderRef() != trigger) Return;
	if(numgoalscomplete == numtotalgoals && exited == 1) jkEndLevel(0);
	else
	{
		if(exited == 0) Return;
		Print("Objective Incomplete:");
		if(goal1comp == 0) Print("Disable Corvete hangar system.");
		if(goal2comp == 0) Print("Retract the Planetary Shield into the maintenance shelter.");
		if(goal3comp == 0) Print("Shut down the power in main Guns.");
	}

Return;
#------------------------------------------------------
user0:
	if(GetParam(0) == 1)
	{
		numgoalscomplete = numgoalscomplete + 1;
		goal1comp = 1;
	}
	if(GetParam(0) == 2)
	{
		numgoalscomplete = numgoalscomplete + 1;
		goal2comp = 1;
	}
	if(GetParam(0) == 3)
	{
		numgoalscomplete = numgoalscomplete + 1;
		goal3comp = 1;
	}

Return;
#------------------------------------------------------
end



Compare your cog with my modified version.


A few notes:

JKendlevel(); MUST have a semicolon after it.

If a conditional statement has only one command after it, you dont need brackets.

Try to refrain from placing Returns; inside of conditional statements.

It lookes to me like you cut-and-pasted a few different cogs together. That rarely works.

Do yourself a favor, download Parsec. It caught most of these errors.
And when the moment is right, I'm gonna fly a kite.
2002-12-02, 6:25 AM #3
thanks for help GBK, yes, there should be ; after Endlevel(0)

↑ Up to the top!