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

Execute script when room is clear, how?

Recommended Posts

Hey all!


Basically I have this room with 4 doors. One door opens, 5 monsters come out, next door opens, repeat process. The script works, however, when multiple monsters are killed simultaneously, the script doesn't seem to register every kill. It only registers one.

 

Here is how I did it:

 

Every monster executes the "processingKills" script when killed (Using action 80).

 

The script:

script "processingKills" (void) 
{
	int doorDelay = 80;
	trapRoomKills++;
	print(i: trapRoomKills);
	if (trapRoomKills == 4) {
		delay(doorDelay);
		Door_Open(30, 64);
	}
	if (trapRoomKills == 9) {
		delay(doorDelay);
		door_open(31, 64);
	}

How can I make it so that simultanious kills are registered properly? When I kill 3 monsters with a rocket, it should count as 3 kills rather than just 1.

 

I have a history in programming. No need to hold back in terms of code languages.

Share this post


Link to post
6 minutes ago, DoomeDx said:

The script works, however, when multiple monsters are killed simultaneously, the script doesn't seem to register every kill. It only registers one.

 

How can I make it so that simultanious kills are registered properly?

Use ACS_ExecuteAlways on the monsters instead of ACS_Execute.

Share this post


Link to post
2 minutes ago, scifista42 said:

Use ACS_ExecuteAlways on the monsters instead of ACS_Execute.

Done, that did the trick. Thank you

Share this post


Link to post
2 minutes ago, scifista42 said:

Use ACS_ExecuteAlways on the monsters instead of ACS_Execute.

It works in this case, but it's not good practice as you could end up with thousands of scripts running at the same time if you use it carelessly.

 

I'm not speaking from experience, oh no sir. I have never managed to grind ZDoom to a halt doing that.

Share this post


Link to post
22 minutes ago, Albertoni said:

It works in this case, but it's not good practice

I disagree. It's usually helpful and harmless. The problem of "thousands of scripts running" should be prevented by not using such design that calls so many scripts in the first place, and even that would be OK if said scripts terminated more or less immediately (instead of staying in infinite/indefinite loops).

Edited by scifista42

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
×