Prevent the exit

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

Prevent the exit

Post by DOOMERO-21 »

Is possible prevent the exit when you press a switch or line? i want something like exit the map when only you killed all the monsters, but this not apply for a special map , my mod not use any map , i need something general and affect all the maps of doom/doom2 including pwads.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Prevent the exit

Post by Blue Shadow »

You can pull it off with a [wiki]map translator[/wiki] and an ACS script that [wiki=GetLevelInfo]checks[/wiki] to see if all monsters in the level have died.

You basically replace all the exit specials in the translator with [wiki]ACS_Execute[/wiki] or [wiki]ACS_ExecuteAlways[/wiki], so when you activate the exit switches/lines in game, you execute the script instead.

The translator could be something like this:

Code: Select all

include "xlat/doom.txt"

11 = USE|REP, ACS_ExecuteAlways(500, 0, 0, 0, 0) //Exit_Normal (0)
51 = USE|REP, ACS_ExecuteAlways(500, 0, 1, 0, 0) //Exit_Secret (0)
52 = WALK|REP, ACS_ExecuteAlways(500, 0, 0, 0, 0)  //Exit_Normal (0)
124 = WALK|REP, ACS_ExecuteAlways(500, 0, 1, 0, 0) //Exit_Secret (0)
And the script could be something like this:

Code: Select all

Script 500 (int secret)
{
  int kills = GetLevelInfo(LEVELINFO_KILLED_MONSTERS);
  int total_mons = GetLevelInfo(LEVELINFO_TOTAL_MONSTERS);

  If(kills == total_mons)
  {
    If(!secret) Exit_Normal(0);
    Else Exit_Secret(0);
  }

  Else Print(s:"You have not killed all of the monsters in the map!");
}
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

Re: Prevent the exit

Post by DOOMERO-21 »

Ohh nice, thanks i will check!!

Return to “Editing (Archive)”