Please create an account or Login! Have fun!

C2G: Difference between revisions

Jump to navigation Jump to search
340 bytes added ,  7 February 2019
(Documenting checkpoints)
Line 126: Line 126:
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.
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:
In order to do this, each level must be given a label starting with a pound (#) character. All labels must also contain the text "1 level =" (without the quotes) For example:
  <nowiki>#bonuslevel
  <nowiki>#bonuslevel
1 level =
script
script
"Congratulations!"
"Congratulations!"
Line 135: Line 136:
In the example above, the level BonusLevel.c2m as well as the preceding text are given the label "bonuslevel".
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:
Exits are numbered in reading order, starting at 1; there does not appear to be any 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>
  <nowiki> <#> exit == do goto #label</nowiki>
Replace <#> with the exit number, and #label with the label name (including the #). For example:
Replace <#> with the exit number, and #label with the label name (including the #). For example:
Line 143: Line 144:


#secret
#secret
1 level =
map "SuperSecretFinalLevel.c2m"
map "SuperSecretFinalLevel.c2m"


#end
#end
1 level =
script
script
"This is the end."</nowiki>
"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.
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? -->
 
If there are several players in the level, the exit used by the last player to finish the level will be the one used by the C2G script. If an invalid label is called, or no label is assigned for the exit that was used, the game will continue to work through the C2G file as it would normally.


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

Navigation menu