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

Tying a door to dead enemies.

Recommended Posts

Give tag 3 to the door and TID 2 to each of the monsters. Also set Action of each of the monsters to ACS_ExecuteAlways with first parameter 1. Now put this script to SCRIPTS window:

#include "zcommon.acs"

script 1 (void) {
    if(ThingCount(T_NONE,2)==0) { Door_Open(3,16,0); }
}
Of course, the numbers 1, 2 and 3 in my example are arbitrary numbers, replace them with whatever numbers you want. They can even match each other, because sector tags, thing TIDs and script numbers are separate properties.

Reference to used functions:
http://zdoom.org/wiki/ACS_ExecuteAlways
http://zdoom.org/wiki/ThingCount
http://zdoom.org/wiki/Door_Open

Share this post


Link to post

This is just the way I learnt to do stuff like this, I learned it from Chubzdoomer's Doom RPG explanation video and it's a neat way of letting me change the music or activate some other script in my wad. This might be a little over-complicated but I really like this method, here's what I wrote in a text file to help me remember how to use these sorts of scripts. You can also use this in conjunction with things like "Check_Inventory" and such, here's something I wrote in a text document to help me remember how to use these scripts.



Spoiler

variable scripts require a variable before any script is written

e.g:
(

#include zcommon.acs

int quest1active = 1;
int quest1kills - 0;

script 1
{

)

We can change the variables through using a linedef, killing a monster, etc. etc. if we set it's action to script execute (set to action 226, scrip execute always for
monster death activated scripts).
This script changes the music if a death count reaches its goal and reverts the variable to 0. Here's how we change 
the variables:

e.g:
(

script 1 (void)
{
	if(quest1active==1)
	{
		quest1kills++;
		
		if (quest1kills>=GOAL)
		{
			setmusic("MUSIC",0,0);

			quest1kills = quest1kills - GOAL;
		}
	}
}


)



If you were wondering about why I had the "quest1active" at the start, for some reason the scripts don't work if I don't do have that there. For now I'm just going to stick to that until I can find out the problem, but maybe you can find a workaround.

Share this post


Link to post
AwesomeO-789 said:

Edit: The script doesn't look right on this forum,

Use [code] tags like I did (quote my previous post to see the usage).

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
×