Jump to content
  • 0

A minimum number of kills to pass a level


chinegun

Question

I see in the first version of "Doom -1" a minimum number of monsters you must kill to be able to pass the level, i tried to see the codes of the wad, but i didn't see any note ("//example") and there are a lot of different functions, so i cant copy the entire script. (Im sorry if my english isnt the best)

I'll so much appreciate the help

 

PD: Also i uploaded the wad in any case

 

GZDoom-1.rar

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0

Easiest way that comes to mind is do a while loop that constantly compares killed monsters to a required amount using GetLevelInfo.

 

Something like this:

script "KillTracker" OPEN
{
   int requiredKills = 50;
   while(GetLevelInfo(LEVELINFO_KILLED_MONSTERS) < requiredKills) Delay(1);

   // Whatever happens after
}

 

You could get even fancier and make it a percentage or something of total kills but this is a basic example, it assumes that you know how many monsters total are on the map and that requiredKills will be less than it.

 

https://zdoom.org/wiki/GetLevelInfo

Edited by Nevander

Share this post


Link to post
  • 0

thanks, so much appreciate :D, but i have one last question, ¿how i do to finish the level with the required kills?

I tried to do it by my self but i couldn´t

Share this post


Link to post
  • 0

That depends on how you want the level to end once the kills are reached. If you want it to end automatically, you can use Exit_Normal. Or you can make a door that is opened in the script after the kills are reached which then has an exit switch behind it.

Share this post


Link to post
  • 0

Im back, i tried it but it doesnt work, i must be wrong in something (sorry if im very noob)

Here is my script:

 

script "KillCount" OPEN
{
   int requiredKills = 50;
   while(GetLevelInfo(LEVELINFO_KILLED_MONSTERS) < requiredKills) Delay(1);

      Exit_Normal(0);
}

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...