Please create an account or Login! Have fun!

C2G: Difference between revisions

Jump to navigation Jump to search
150 bytes added ,  2 June 2021
no edit summary
No edit summary
No edit summary
Line 283: Line 283:
Note that if the first c2g file CC2 reads chains to another script but does not provide a map itself, CC2 will say the levelset is invalid. This is because it specifically checks the first c2g it reads for the use of "map" followed by a valid map. To avoid this, put a valid map ''after'' calling the chain, such that it will never be accessed since the parser will be chained away from the script before reaching it.
Note that if the first c2g file CC2 reads chains to another script but does not provide a map itself, CC2 will say the levelset is invalid. This is because it specifically checks the first c2g it reads for the use of "map" followed by a valid map. To avoid this, put a valid map ''after'' calling the chain, such that it will never be accessed since the parser will be chained away from the script before reaching it.


=== Registers ===
=== Level flags ===
Variables reg1 to reg4 can be used to store arbitrary flags, will be stored between chained scripts, and will be included in the player's save data. Here, a "switch palace" level includes two exits, the second of which sets the lowest bit in reg4 to 1, which the script then detects to swap out a later level for an alternate version:
Variables reg1 to reg4 can be used to store arbitrary flags, will be stored between chained scripts, and will be included in the player's save data. Here, a "switch palace" level includes two exits, the second of which sets the lowest bit in reg4 to 1, which the script then detects to swap out a later level for an alternate version:
  <nowiki>map "SwitchPalace.c2m"
  <nowiki>map "SwitchPalace.c2m"
Line 312: Line 312:


map "OkayLevel.c2m"</nowiki>
map "OkayLevel.c2m"</nowiki>
Unused bits of the "flags" variable itself are also available, but theoretically, future updates to CC2 could add new special flags at any moment.


== Comments box ==
== Comments box ==
trusted-editors
331

edits

Navigation menu