<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://chronocrash.com/openbor/wiki/index.php?action=history&amp;feed=atom&amp;title=End_Level_Scripts</id>
	<title>End Level Scripts - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://chronocrash.com/openbor/wiki/index.php?action=history&amp;feed=atom&amp;title=End_Level_Scripts"/>
	<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=End_Level_Scripts&amp;action=history"/>
	<updated>2026-09-19T07:50:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://chronocrash.com/openbor/wiki/index.php?title=End_Level_Scripts&amp;diff=1038&amp;oldid=prev</id>
		<title>Dcurrent at 01:38, 21 August 2026</title>
		<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=End_Level_Scripts&amp;diff=1038&amp;oldid=prev"/>
		<updated>2026-08-21T01:38:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:38, 20 August 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Level]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Level]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Script]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Script]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Script Events]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;endlevelscript&amp;#039;&amp;#039;&amp;#039; is a level-finish event hook. OpenBOR provides two forms: the automatic project-wide &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; script and an &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; declared by an individual level. Both execute once after the active level loop ends, while the level and its remaining entities are still loaded, but before fade-out and level unloading.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;endlevelscript&amp;#039;&amp;#039;&amp;#039; is a level-finish event hook. OpenBOR provides two forms: the automatic project-wide &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; script and an &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; declared by an individual level. Both execute once after the active level loop ends, while the level and its remaining entities are still loaded, but before fade-out and level unloading.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l191&quot;&gt;Line 191:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 189:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Variables]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Variables]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Script Overview]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Script Overview]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Openbor]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dcurrent</name></author>
	</entry>
	<entry>
		<id>https://chronocrash.com/openbor/wiki/index.php?title=End_Level_Scripts&amp;diff=1016&amp;oldid=prev</id>
		<title>Dcurrent: Created page with &quot;Category:Level Category:Script Category:Script Events  &#039;&#039;&#039;endlevelscript&#039;&#039;&#039; is a level-finish event hook. OpenBOR provides two forms: the automatic project-wide &lt;code&gt;data/scripts/endlevel.c&lt;/code&gt; script and an &lt;code&gt;endlevelscript&lt;/code&gt; declared by an individual level. Both execute once after the active level loop ends, while the level and its remaining entities are still loaded, but before fade-out and level unloading.  This timing makes endlevel scripts...&quot;</title>
		<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=End_Level_Scripts&amp;diff=1016&amp;oldid=prev"/>
		<updated>2026-08-20T22:12:22Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/openbor/wiki/index.php/Category:Level&quot; title=&quot;Category:Level&quot;&gt;Category:Level&lt;/a&gt; &lt;a href=&quot;/openbor/wiki/index.php/Category:Script&quot; title=&quot;Category:Script&quot;&gt;Category:Script&lt;/a&gt; &lt;a href=&quot;/openbor/wiki/index.php/Category:Script_Events&quot; title=&quot;Category:Script Events&quot;&gt;Category:Script Events&lt;/a&gt;  &amp;#039;&amp;#039;&amp;#039;endlevelscript&amp;#039;&amp;#039;&amp;#039; is a level-finish event hook. OpenBOR provides two forms: the automatic project-wide &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; script and an &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; declared by an individual level. Both execute once after the active level loop ends, while the level and its remaining entities are still loaded, but before fade-out and level unloading.  This timing makes endlevel scripts...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Level]]&lt;br /&gt;
[[Category:Script]]&lt;br /&gt;
[[Category:Script Events]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;endlevelscript&amp;#039;&amp;#039;&amp;#039; is a level-finish event hook. OpenBOR provides two forms: the automatic project-wide &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; script and an &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; declared by an individual level. Both execute once after the active level loop ends, while the level and its remaining entities are still loaded, but before fade-out and level unloading.&lt;br /&gt;
&lt;br /&gt;
This timing makes endlevel scripts useful for finalizing stage results, recording statistics, awarding conditional bonuses, committing custom progression, synchronizing player state, and cleaning up shared systems. The event is the closing counterpart to [[Levelscript|levelscript]].&lt;br /&gt;
&lt;br /&gt;
== Forms ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Form&lt;br /&gt;
! Scope&lt;br /&gt;
! Setup&lt;br /&gt;
! Execution order&lt;br /&gt;
|-&lt;br /&gt;
| Global endlevel script&lt;br /&gt;
| Every level in the project&lt;br /&gt;
| Create &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt;&lt;br /&gt;
| First&lt;br /&gt;
|-&lt;br /&gt;
| Level-specific endlevel script&lt;br /&gt;
| Level containing the command&lt;br /&gt;
| Add &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; to the level definition&lt;br /&gt;
| Second&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Both forms use a &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; entry point and receive no automatic event variables.&lt;br /&gt;
&lt;br /&gt;
== Global Endlevel Script ==&lt;br /&gt;
&lt;br /&gt;
OpenBOR automatically loads &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; when the file is present. No command is required in a level definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    // Perform project-wide level finalization here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The global script executes whenever an active level ends. Use it for finalization shared throughout the project, such as collecting stage statistics, closing objective systems, storing custom player results, or preparing information consumed by later menus and levels.&lt;br /&gt;
&lt;br /&gt;
== Level-Specific Endlevel Script ==&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; to a level definition and provide the path to the script file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
endlevelscript data/scripts/levels/storm_docks_end.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The referenced script uses the same entry point as the global form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    // Finalize this level&amp;#039;s unique systems here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The level-specific script executes only when OpenBOR ends the level containing the command. It is well suited to recording unique objectives, resolving branching state, awarding stage-specific bonuses, closing custom encounters, or preserving results that have meaning only within that level.&lt;br /&gt;
&lt;br /&gt;
Only one &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; command is available to a level. Multiple finalization tasks may be organized into functions and called from the script&amp;#039;s &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; when needed.&lt;br /&gt;
&lt;br /&gt;
== Execution ==&lt;br /&gt;
&lt;br /&gt;
The relevant level-end sequence is:&lt;br /&gt;
&lt;br /&gt;
# OpenBOR exits the active level update loop.&lt;br /&gt;
# &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt; executes when present.&lt;br /&gt;
# The level-specific &amp;lt;code&amp;gt;endlevelscript&amp;lt;/code&amp;gt; executes when declared.&lt;br /&gt;
# OpenBOR performs the normal fade-out unless fade-out is disabled.&lt;br /&gt;
# Player health, MP, and rush maximum are captured from remaining player entities.&lt;br /&gt;
# Level audio is stopped according to the project&amp;#039;s music-overlap settings.&lt;br /&gt;
# OpenBOR unloads the level and its entities.&lt;br /&gt;
# Game flow continues to the completion screen, game-over sequence, next level, or other applicable destination.&lt;br /&gt;
&lt;br /&gt;
The level and its remaining entities are therefore available to both scripts. Their properties, entity variables, level state, and project variables can still be inspected or modified before teardown.&lt;br /&gt;
&lt;br /&gt;
The level-specific script executes after the global script, so it can build on or replace state established by &amp;lt;code&amp;gt;endlevel.c&amp;lt;/code&amp;gt;. This supports the same division of responsibility as level-start scripts: apply project-wide finalization first, then specialize it for the level that just ended.&lt;br /&gt;
&lt;br /&gt;
Endlevel scripts execute after recurring level updates have stopped. Changes intended to be captured, stored, or consumed by later game flow take effect normally. Multi-step victory sequences, animated exits, or other behavior requiring continued updates should complete before the level is allowed to end, with the endlevel hook used to finalize the result.&lt;br /&gt;
&lt;br /&gt;
== Completion and Other End Conditions ==&lt;br /&gt;
&lt;br /&gt;
Despite the name, an endlevel script is not limited to successful completion. It executes whenever the active level loop terminates, including ordinary completion, loss of all players, forced completion, forced game over, and other paths that end the level.&lt;br /&gt;
&lt;br /&gt;
Projects that need to distinguish outcomes can maintain an objective or result value during gameplay, then inspect that value in the endlevel script. This arrangement allows the same hook to finalize successful clears, failed objectives, alternate exits, and custom victory conditions without hard-coding a single interpretation of &amp;quot;level ended.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Example: Preserve Stage Results ==&lt;br /&gt;
&lt;br /&gt;
The following global script copies custom stage counters into values that later menus, levels, or scripts can read:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    setglobalvar(&lt;br /&gt;
        &amp;quot;previous_stage_hits&amp;quot;,&lt;br /&gt;
        getglobalvar(&amp;quot;stage_hit_count&amp;quot;)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    setglobalvar(&lt;br /&gt;
        &amp;quot;previous_stage_damage&amp;quot;,&lt;br /&gt;
        getglobalvar(&amp;quot;stage_damage_total&amp;quot;)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    setglobalvar(&lt;br /&gt;
        &amp;quot;previous_stage_objective&amp;quot;,&lt;br /&gt;
        getglobalvar(&amp;quot;stage_objective_complete&amp;quot;)&lt;br /&gt;
    );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example assumes other scripts maintain the stage counters during gameplay. The endlevel hook provides one reliable point to close the record before the current level is unloaded.&lt;br /&gt;
&lt;br /&gt;
== Example: Build a Level Result ==&lt;br /&gt;
&lt;br /&gt;
This level-specific script converts several values maintained during gameplay into a compact rank and unlock result:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int stage_cleared = getglobalvar(&amp;quot;stage_was_cleared&amp;quot;);&lt;br /&gt;
    int objective_complete =&lt;br /&gt;
        getglobalvar(&amp;quot;stage_objective_complete&amp;quot;);&lt;br /&gt;
    int damage_total = getglobalvar(&amp;quot;stage_damage_total&amp;quot;);&lt;br /&gt;
    int rank = 0;&lt;br /&gt;
&lt;br /&gt;
    if (stage_cleared)&lt;br /&gt;
    {&lt;br /&gt;
        rank = 1;&lt;br /&gt;
&lt;br /&gt;
        if (objective_complete)&lt;br /&gt;
        {&lt;br /&gt;
            rank++;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (damage_total &amp;lt; 500)&lt;br /&gt;
        {&lt;br /&gt;
            rank++;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    setglobalvar(&amp;quot;storm_docks_rank&amp;quot;, rank);&lt;br /&gt;
    setglobalvar(&lt;br /&gt;
        &amp;quot;storm_docks_bonus_unlocked&amp;quot;,&lt;br /&gt;
        stage_cleared &amp;amp;&amp;amp; objective_complete&lt;br /&gt;
    );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other scripts establish the clear, objective, and damage values while the level is active. The endlevel hook converts them into a final result after gameplay ends but before the level data is discarded. Completion screens, later levels, menus, or save logic can consume the stored rank and unlock flag.&lt;br /&gt;
&lt;br /&gt;
== Other Uses ==&lt;br /&gt;
&lt;br /&gt;
Quick applications include:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Stage statistics&amp;#039;&amp;#039;&amp;#039; - Store hit counts, damage totals, elapsed time, defeats, collectibles, or challenge performance before teardown.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Objective resolution&amp;#039;&amp;#039;&amp;#039; - Commit success, failure, optional goals, rank, medals, or alternate outcome flags.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Player rewards&amp;#039;&amp;#039;&amp;#039; - Award score, resources, unlocks, equipment, lives, or custom progression according to player or team performance.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Branch preparation&amp;#039;&amp;#039;&amp;#039; - Preserve choices and encounter results for later level-order, menu, dialogue, or selection logic.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;State synchronization&amp;#039;&amp;#039;&amp;#039; - Copy temporary level or entity data into project variables that remain available after the level is unloaded.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;System cleanup&amp;#039;&amp;#039;&amp;#039; - Close custom controllers, clear temporary references, and return shared subsystems to their neutral state.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Result presentation&amp;#039;&amp;#039;&amp;#039; - Prepare values consumed by completion screens, custom HUDs, scenes, reports, or post-level menus.&lt;br /&gt;
&lt;br /&gt;
== Related Scripts ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Script&lt;br /&gt;
! Relationship&lt;br /&gt;
|-&lt;br /&gt;
| [[Levelscript|level scripts]]&lt;br /&gt;
| Execute when a level begins. They are the opening counterparts to endlevel scripts.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;data/scripts/endlevel.c&amp;lt;/code&amp;gt;&lt;br /&gt;
| Global level-end hook that executes first for every level.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;endlevelscript&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Level-specific level-end hook that executes after the global hook.&lt;br /&gt;
|-&lt;br /&gt;
| [[Update|update]] and [[Updated|updated]] scripts&lt;br /&gt;
| Recurring hooks used while the level&amp;#039;s active update loop is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Level]]&lt;br /&gt;
* [[Levelscript]]&lt;br /&gt;
* [[Update]]&lt;br /&gt;
* [[Updated]]&lt;br /&gt;
* [[Player]]&lt;br /&gt;
* [[Variables]]&lt;br /&gt;
* [[Script Overview]]&lt;/div&gt;</summary>
		<author><name>Dcurrent</name></author>
	</entry>
</feed>