Please create an account or Login! Have fun!

C2G: Difference between revisions

Jump to navigation Jump to search
1,411 bytes added ,  7 February 2019
Documenting checkpoints
mNo edit summary
(Documenting checkpoints)
Line 116: Line 116:
Note that tool codes > 16 will be reduced to a value <= 16, and key counts > 9 will be reduced to 9. These limits do not apply when either inventory is carried over from the previous level.
Note that tool codes > 16 will be reduced to a value <= 16, and key counts > 9 will be reduced to 9. These limits do not apply when either inventory is carried over from the previous level.


=== Time levelset ===
=== Timed levelset ===
C2G files make it possible to set a time limit for the entire levelset, rather than individual levels. In order to do this, the following code must be added to the beginning of the file, after the "game" directive:
C2G files make it possible to set a time limit for the entire levelset, rather than individual levels. In order to do this, the following code must be added to the beginning of the file, after the "game" directive:
  <nowiki>ktime flags | flags =</nowiki>
  <nowiki>ktime flags | flags =</nowiki>
Line 122: Line 122:
  <nowiki><#> tleft =</nowiki>
  <nowiki><#> tleft =</nowiki>
Replace "<#>" with the desired time limit for the set. This will ignore any time limits set for individual levels. Time limits will be carried over from one level to the next, and restarting the level does not reset the time limit. [[Time bonus]]es and [[time penalty|time penalties]] can still be used. After the time limit reaches 0, or if a level is skipped, all future levels will be untimed.
Replace "<#>" with the desired time limit for the set. This will ignore any time limits set for individual levels. Time limits will be carried over from one level to the next, and restarting the level does not reset the time limit. [[Time bonus]]es and [[time penalty|time penalties]] can still be used. After the time limit reaches 0, or if a level is skipped, all future levels will be untimed.
=== Exit choices ===
If a level has several [[exit]]s, C2G scripting can be used to send the player to different levels depending on what exit is entered.
In order to do this, each level must be given a label starting with a pound (#) character. For example:
<nowiki>#bonuslevel
script
"Congratulations!"
"You have reached"
"the secret level!"
map "BonusLevel.c2m"</nowiki>
In the example above, the level BonusLevel.c2m as well as the preceding text are given the label "bonuslevel".
Exits are numbered in reading order, starting at 1; it is unknown if there is a limit. In order to use the feature, after calling the "map" of the level containing the exits, a line similar to this will be required:
<nowiki> <#> exit == do goto #label</nowiki>
Replace <#> with the exit number, and #label with the label name (including the #). For example:
<nowiki>map "ChooseYourFuture.c2m"
1 exit == do goto #end
2 exit == do goto #secret
#secret
map "SuperSecretFinalLevel.c2m"
#end
script
"This is the end."</nowiki>
In the example above, the game will load the level stored in the file ChooseYourFuture.c2m; if the player exits using the first exit in reading order, the game will then display the THIS IS THE END. message. If the player exits using the second exit, however, the game will load the level in the file SuperSecretFinalLevel.c2m instead.
<!-- what if there are more exits than entries though? -->


=== Editor ===
=== Editor ===

Navigation menu