ChangeLevel (ZScript)
Jump to navigation
Jump to search
Note: This feature is for ZScript only. |
struct LevelLocals
void ChangeLevel(string LevelName, int Position, int Flags, int Skill)
Usage
Changes the level the player is in, similar to the ChangeLevel ACS function.
Parameters
- String LevelName
- The name of the level to change to.
- int Position
- The player start spot to start the new level at.
- int Flags
- The flags to use for the level change. Multiple flags can be combined with
|
:- CHANGELEVEL_KEEPFACING: The player spawns in the new level retaining the same, pitch, angle, and roll they had before the function was called.
- CHANGELEVEL_RESETINVENTORY: Reset the players' inventory to the defaults for their player class.
- CHANGELEVEL_NOMONSTERS: Remove all the monsters from the level the player enters.
- CHANGELEVEL_CHANGESKILL: Change the skill level of the level.
- CHANGELEVEL_NOINTERMISSION: Don't show the intermission screens between the previous level and the one being entered.
- CHANGELEVEL_RESETHEALTH: Reset the players' health to the default for their player class.
- CHANGELEVEL_PRERAISEWEAPON: Start the level with the players' weapon already raised.
- int Skill
- Changes the skill level of the map that will be entered. Possible values: (Verification needed)
- SKILL_VERY_EASY
- SKILL_EASY
- SKILL_NORMAL
- SKILL_HARD
- SKILL_VERY_HARD
Examples
Below is the code for a Cyberdemon that when killed, changes the current level to a level with the name of "FinalMap", and resets the players' inventory and health.
class SuperDuperCyberdemon : Cyberdemon { Default { Health 10000; DamageMultiply 2.0; Scale 2.0; Radius 80; Height 220; PainChance 10; Speed 6; } bool BeginLevelExitTimer; //If set to true, the timer below will increment every tick. int ExitTimer; //The timer used to give a delay to the Cyberdemon changing the level. override void Die (Actor Source, Actor Inflictor, int DmgFlags, Name MeansOfDeath) { Super.Die (Source, Inflictor, DmgFlags, MeansOfDeath); BeginLevelExitTimer = True; Return Super.Die (Source, Inflictor, DmgFlags, MeansOfDeath); } override void Tick() { Super.Tick(); if (BeginLevelExitTimer) { ExitTimer++; //Increment the timer. } if (ExitTimer >= 35*5) { Level.ChangeLevel("FinalMap",0,CHANGELEVEL_RESETINVENTORY|CHANGELEVEL_RESETHEALTH|CHANGELEVEL_CHANGESKILL); //Change level. } } }