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 → cog request
cog request
2002-02-05, 8:52 AM #1
hey can anyne give me a cog which makes my objective complete and then another one shows. also can i have a cog which makes the objetive complete, and then its the end of the level.
sound goalsnd=Accomplish1.wav local
int player local
end

code
entered:
// player has entered the sector!
player = GetLocalPlayerThing();

//complete the first objective
PlaySoundThing(goalsnd, player, 1.0, -1, -1, 0);
SetGoalFlags(player, 0, 2);
Print("Text here")

// now show the second objective
SetGoalFlags(player, 1, 1);
Return;


------------------
§ídíoú§
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-02-06, 5:21 AM #2
This cog makes the first goal show up and when the goalsector is entered, the first goal will be completed and the second goal appears.

Code:
# nextgoal.cog
#
# Show the first objective as completed and make the second appear.
#
# [SM + ?]
#======================================================================#
symbols

sector	goalsector

sound	goalsnd=Accomplish1.wav		local

thing		player		local

int		goal0=0		local
int		goal1=1		local

int		done		local

message	startup
message	entered

end
#======================================================================#
code
#----------------------------------------------------------------
startup:
	player=GetLocalPlayerThing();
	SetGoalFlags(player, goal0, 0x1);	// Show goal0 in the objectives.
	done=0;

Return;
#----------------------------------------------------------------
entered:
	if(done) Return;
	done=1;

	// Complete goal0
	PlaySoundThing(goalsnd, player, 1, -1, -1, 0);
	SetGoalFlags(player, goal0, 0x2);

	Print("Completed goal0");

	// Show goal1
	SetGoalFlags(player, goal1, 0x1);

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


I can't write the code to make the second goal completed until I know what makes it completed. Entry into a sector?

------------------
Each cog better than the next

[This message has been edited by SaberMaster (edited February 06, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-06, 6:06 AM #3
yeah, entry into a sector. so what do i do with the cog then?

------------------
§ídíoú§
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-02-06, 12:00 PM #4
Place this cog with JED and give the sectors that you want to trigger the goals. Entry into sector0 will complete goal0 and show goal1; entry into sector1 will complete goal1.

Code:
# nextgoal2.cog
#
# Show the first objective as completed and make the second appear.
#
# [SM + ?]
#======================================================================#
symbols

sector	goalsector0
sector	goalsector1

sound	goalsnd=Accomplish1.wav		local

thing		player		local

int		goal0=0		local
int		goal1=1		local

int		enter0		local
int		enter1		local

message	startup
message	entered

end
#======================================================================#
code
#----------------------------------------------------------------
startup:
	player=GetLocalPlayerThing();
	SetGoalFlags(player, goal0, 0x1);   // Show goal0
	done=0;

Return;
#----------------------------------------------------------------
entered:
	if(GetSenderRef() == goalsector0)
	{
		if(enter0) Return;
		enter0=1;
		PlaySoundThing(goalsnd, player, 1, -1, -1, 0);
		SetGoalFlags(player, goal0, 0x2);   // Complete goal0
		Print("Completed goal0");
		SetGoalFlags(player, goal1, 0x1);   // Show goal1
	}
	else if(GetSenderRef() == goalsector1)
	{
		if(enter1) Return;
		enter1=1;
		PlaySoundThing(goalsnd, player, 1, -1, -1, 0);   // Complete goal1
		SetGoalFlags(player, goal1, 0x2);
		Print("Completed goal1");
		Sleep(1);
		jkEndLevel(1);   // End the level
	}

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


[edit] Added the sleep()


------------------
Each cog better than the next

[This message has been edited by SaberMaster (edited February 08, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-06, 3:49 PM #5
It would be a good idea to put a Sleep(1) right before the JKendlevel(). Otherwise, you wont see the final printed statement.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-02-07, 5:55 AM #6
do you think you could send me the cog (at DJKPhoenix1@al.com) because every time i try to copy it it pastes all dodgy. (by the way can you include the sleep(1) as well)

thanks!

------------------
§ídíoú§
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-02-07, 6:41 AM #7
hope i'm not puttin u on the spot but can you make it so a second objective appears after an entry of a sector for the first one. then you go into a sector and that completes the second. Then can the third objective complete when i kill somebody and if someone dies then can you make the mission fail. (Please include the sleep at the end of level [http://forums.massassi.net/html/biggrin.gif])

Email me that plz [http://forums.massassi.net/html/smile.gif]

Thanks

------------------
§ídíoú§
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-02-08, 9:45 AM #8
You know, you should plan out your level before you ask for someone to make the cogs for it. But it's no problem, I have the time right now. [http://forums.massassi.net/html/wink.gif]

Code:
# goalcog.cog
#
# Manage the level's objectives.
#
# [SM]
#======================================================================#
symbols

sector	goalsector0
sector	goalsector1

sound	goalsnd=Accomplish1.wav		local

thing		player		local
thing		livething
thing		killthing

int		enter0		local
int		enter1		local
int		failed		local

message	startup
message	entered
message	killed

end
#======================================================================#
code
#----------------------------------------------------------------
startup:
	player=GetLocalPlayerThing();
	SetInv(player, 99, 1000);
	SetGoalFlags(player, 0, 0x1);
	failed=0;

Return;
#----------------------------------------------------------------
entered:
	if(GetSenderRef() == goalsector0)
	{
		if(enter0 || failed) Return;
		enter0=1;
		PlaySoundThing(goalsnd, player, 1, -1, -1, 0);
		SetGoalFlags(player, 0, 0x2);
		Print("Completed goal0");
		SetGoalFlags(player, 1, 0x1);
		call checkgoals;
	}
	else if(GetSenderRef() == goalsector1)
	{
		if(enter1 || failed) Return;
		enter1=1;
		PlaySoundThing(goalsnd, player, 1, -1, -1, 0);
		SetGoalFlags(player, 1, 0x2);
		Print("Completed goal1");
		SetGoalFlags(player, 2, 0x1);
		call checkgoals;
	}

Return;
#----------------------------------------------------------------
killed:
	if(GetSenderRef() == livething)
	{
		Print("Failed the mission");
		failed=1;
		Sleep(2);
		SetTypeFlags(player, 0x400000);
	}
	else if(GetSenderRef() == killthing)
	{
		if(failed) Return;
		PlaySoundThing(goalsnd, player, 1, -1, -1, 0);
		SetGoalFlags(player, 2, 0x2);
		Print("Killed the enemy");
		call checkgoals;
	}

Return;
#----------------------------------------------------------------
checkgoals:
	if(GetInv(player, 100) == 3 && GetInv(player, 101) == 3 && GetInv(player, 102) == 3)
	{
		Print("Completed the level");
		Sleep(2);
		if(failed) Return;
		jkEndLevel(1);
	}

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


This line, SetInv(player, 99, 1000);, sets the string offset of the level. The string offset determines the starting goal number that JK looks for. So if the offset is for the level is 1000, JK will look for "GOAL_01000" as the first goal. If the offset is 2000, JK will look for "GOAL_02000". The string offset is typically 1000 times the level number.

If you use JED's startup cog generator, take out the "Initialise Goals" coding. That would make all the goals visible at startup.

[edit] fixed a small bug in the code.

That should do it. [http://forums.massassi.net/html/wink.gif]

[This message has been edited by SaberMaster (edited February 09, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-08, 11:55 PM #9
sorry :|

and thanks [http://forums.massassi.net/html/biggrin.gif]

uv been a great help [http://forums.massassi.net/html/smile.gif]

------------------
§ídíoú§
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-02-09, 10:53 AM #10
You're welcome. [http://forums.massassi.net/html/wink.gif]

Better copy that code again. I fixed a small bug. [http://forums.massassi.net/html/smile.gif]

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!