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

About ThingCountName

Question

I copied this script from a ten year old thread on Zdoom forums and was wondering if this is the best way to still do this.

 

It displays an enemy counter (countdown) on screen and when that certain enemy type are all dead it triggers stuff. It works fine for one enemy type but I would like to have two of these counters stacked on the screen for two enemy types. So I made two scripts (see spoiler) but it bugs out a little. Flashing back and forth between the two counters instead of both just staying solid on the screen.


 

Spoiler

 

script "YUTANIMISSION" OPEN
{
 
 While (ThingCountName("SecurityGuardAT", 0) > 0)
 {
  SetFont ("BIGFONT");
  HudMessage(d:ThingCountName("SecurityGuardAT", 0), s:" COLONISTS LEFT TO ELIMINATE";
   HUDMSG_PLAIN, 1, CR_RED, 0.5, 0.95, 0);
  delay(35);
 }
  SetFont ("BIGFONT");
  HudMessage(s:"ALL COLONISTS ELIMINATED";
  HUDMSG_FADEINOUT|HUDMSG_LOG, 1, CR_RED, 0.5, 0.95, 20.0);
  delay(250);
  SetFont ("BIGFONT");
  HudMessage(s:"ELIMINATE REMAINING MERCENARIES";
  HUDMSG_FADEINOUT|HUDMSG_LOG, 1, CR_GREEN, 0.5, 0.9, 20.0);
  delay(250);
    

}


script "YUTANIMISSION2" OPEN
{
 
 While (ThingCountName("SoldierAT", 0) > 0)
 {
  SetFont ("BIGFONT");
  HudMessage(d:ThingCountName("SoldierAT", 0), s:" MERCS LEFT TO ELIMINATE";
   HUDMSG_PLAIN, 1, CR_RED, 0.5, 0.95, 0);
  delay(35);
 }
  SetFont ("BIGFONT");
  HudMessage(s:"ALL MERCENARIES ELIMINATED";
  HUDMSG_FADEINOUT|HUDMSG_LOG, 1, CR_RED, 0.5, 0.95, 20.0);
  delay(35);
  Door_Open(337, 8, 0);
  delay(250);
  SetFont ("BIGFONT");
  HudMessage(s:"APC DOOR NOW OPEN";
  HUDMSG_FADEINOUT|HUDMSG_LOG, 1, CR_GREEN, 0.5, 0.9, 20.0);
    

}

 

 

I tried combining them in one script, staggering their trigger times, and executing them with linedefs but it has the same results. Thanks in advance!

 

I would post the map here, but it uses the resources from a fairly sizable (customized) mod. But if you don't mind a 170 Mb dl to help with this question, message me:) 

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 1

The problem is that you use id 1 (the parameter after the HUDMSG_* parameter) for both messages. That means that they will keep overwriting each other. Use different values as the id.

 

https://zdoom.org/wiki/HudMessage

 

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
×