Re: Putting objectives into single player levels


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]

Posted by CogKing on January 10, 1998 at 20:41:40:

In Reply to: Putting objectives into single player levels posted by Raptor [JiB] on January 10, 1998 at 18:33:40:

> I understand that a "translated" version is set in cogstrings.uni, but I have no idea how to link that to the level, either through a cog, or the jkl file. Say I wanted the objective "go home" to be acheived when entering a sector, how would I go about this? Thanks.

Look at any nn_endlevel.cog in the original levels.
This should be done in startup:

// Setup the goals first string in cogStrings.uni so the UI knows about it.
SetInv(player, 99, 1000);

// Setup the first goal as DISPLAYED
SetGoalFlags(player, 0, 1);

Change 1000 to whatever the string for your first goal is (see GOAL_01000 in cogStrings.uni).
When your goal is completed :

// Setup the first goal as COMPLETED
SetGoalFlags(player, 0, 2);

Just call the last one from the entered: handler when you know that you entered your sector. Easy isn't it ? Note that these are flags (goal flags) so 1 means displayed and two means completed. Doing both verbs do set the goal flags to 3, not to 2.

It is actually a bit more complex in LEC's levels because they use a MasterCog so the cog reference of the endlevel cog is know by every other cog and they send messages when each goal is completed. This is a cleaner approach because it puts the goal handling in the "puzzles" where they belong and leave the endlevel cog clear and easily understandable.

Anyway, just get a look at 01_endlevel.cog and 01_goal0.cog and you'll get it immediately.

Hope this helps.
-CogKing


Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]