Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
stickguy5000

Whats the code for???

Recommended Posts

for a doom in hexen map, click scripts and paste:

#include "zcommon.acs"

script 1 OPEN {
 while(1){
  if(ThingCountName("doomimp", 0) == 0
  && thingcountname("archvile",0) == 0){
   Exit_Normal(0);
  }
  delay(1);
 }
}
Only add additional similar '&&' lines for every single monster type in your map listed here:
http://zdoom.org/wiki/Category:Monster

Share this post


Link to post

It's all ways been mysterious to me how almost every wad I've ever played, map07 is the only map to ever be finished when all enemies are killed. Was wondering if people knew how to make this available to any level and were just sticking to the Dead Simple tradition, or if no body had figured it out yet. I can't remember the last wad I've played (aside from map07 wannabes) that requires you to kill all the baddies to finish (map 30ish wads excluded too).

For this alone, I'm interested in whatever it is you're doing, hope you figure it out.

Share this post


Link to post

The "triggers" attached to the Mancunus and Aracnotron mobjs, that are used on Map07 are hardcoded to that map in the original Dos engine.

However, the "trigger" attached to the Keen mobj that opens a door can work on any map.

Using Dehacked, it is possible to move the "triggers" to other bad guys. But then Dehacked patches were much more difficult to apply to the Dos engine than source ports these days.

Share this post


Link to post
gggmork said:

for a doom in hexen map, click scripts and paste:

#include "zcommon.acs"

script 1 OPEN {
 while(1){
  if(ThingCountName("doomimp", 0) == 0
  && thingcountname("archvile",0) == 0){
   Exit_Normal(0);
  }
  delay(1);
 }
}
Only add additional similar '&&' lines for every single monster type in your map listed here:
http://zdoom.org/wiki/Category:Monster

Would it be okay to have the monsters trigger the check? I tried that the other day and it seemed to work.

Share this post


Link to post

They sort of do in that code I guess (when the total number of imps (and all other monster types) becomes 0, then the 'if' condition is met to exit the level, so the monsters kinda triggered it by dying unless you meant something else). But there might be some other way to do it (using 'thingcount' instead of 'thingcountname' should work. I'm not really familiar with any other easy method/built in function if there is another).

Share this post


Link to post

I think DuckReconMajor means you can give the monsters a certain special and TID, and the script will only run each time one of them dies (instead of running all the time).

Also, thingCountName() may be an expensive function to call (especially if the map has huge numbers of things in it), so it may be better to use a delay longer than 1 tic.

Share this post


Link to post

That sounds a lot better/more efficient.

First I gave all monsters thing action 80 (script execute) with script parameter = 1
(so any monster death triggers the script)

Then:

#include "zcommon.acs"

script 1(void) {
 print(d: thingcountname("doomimp",0), s: " imps left\n", d:thingcountname("archvile",0), s: "viles left");
 if(ThingCountName("doomimp", 0) == 0
 && thingcountname("archvile",0) == 0){
  delay(100);
  Exit_Normal(0);
  terminate;
 }
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×