ResetMap: Difference between revisions

From Zandronum Wiki
(Created page with "{{Template:ACSWarning}} int '''ResetMap ''' (void) ==Usage== Resets the map like in Survival after a mission start or fail. Everything will be restored as it was when the ma...")
 
No edit summary
Tag: Source edit
Line 1: Line 1:
{{Template:ACSWarning}}
{{Template:ACSWarning}}
int '''ResetMap ''' (void)
bool '''ResetMap ''' (void)


==Usage==
== Usage ==
Resets the map, akin to [[Game Modes#Survival|Survival]] after a mission start or fail. Everything will be restored as it was when the map first started. The map will be reset after the tic ends, any commands stated immediately after ResetMap will be executed before the map actually is reset.


Resets the map like in Survival after a mission start or fail. Everything will be restored as it was when the map first started. The map will be reset after the tic ends, any commands stated immediately after ResetMap will be executed before the map actually is reset.
In order to use this function, the MapResets flag must be set for the gamemode in question. It is set by default in Survival, (T)LMS, Invasion and Duel. For other modes, including possession which actually does not do map resets, the flag must be set via the [[GAMEMODE]] lump. This is because storing the original state for actors uses additional memory on the server.
 
'''Note:''' In order to use this function, the MapResets flag must be set for the gamemode in question. It is set by default in Survival, (T)LMS, Invasion and Duel. For other modes, including possession which actually does not do map resets, the flag must be set via the GAMEMODE lump. This is because storing original stats for actors requires extra memory and CPU cycles from the server.


Example GAMEMODE lump:
Example GAMEMODE lump:
Line 16: Line 15:
</syntaxhighlight>
</syntaxhighlight>


==Examples==
=== Return value ===
Returns true if the map reset was requested successfully; otherwise returns false and prints a message to the server console.


== Examples ==
<syntaxhighlight lang="c" line="1">
<syntaxhighlight lang="c" line="1">
Script 5 DEATH
Script 5 DEATH
Line 27: Line 28:
</syntaxhighlight>
</syntaxhighlight>


 
[[category:ACS functions]]
[[category:ACS Functions]]

Revision as of 01:40, 3 July 2022

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

bool ResetMap (void)

Usage

Resets the map, akin to Survival after a mission start or fail. Everything will be restored as it was when the map first started. The map will be reset after the tic ends, any commands stated immediately after ResetMap will be executed before the map actually is reset.

In order to use this function, the MapResets flag must be set for the gamemode in question. It is set by default in Survival, (T)LMS, Invasion and Duel. For other modes, including possession which actually does not do map resets, the flag must be set via the GAMEMODE lump. This is because storing the original state for actors uses additional memory on the server.

Example GAMEMODE lump:

Cooperative 
{
    addflag MAPRESETS
}

Return value

Returns true if the map reset was requested successfully; otherwise returns false and prints a message to the server console.

Examples

Script 5 DEATH
{
    PrintBold(s: "You've died! Restarting map.");
    Delay(90);
    ResetMap();
}