A functional geiger counter that detects NUKAGE texture

Handy guides on how to do things, written by users for users.
Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

A functional geiger counter that detects NUKAGE texture

Postby crowbars82 » Tue Jan 09, 2018 2:58 pm

Hi,

I've always wanted a geiger counter sound effect for GZDoom so I worked out the following:

Link to download

To use the mod, place the "Crow_Geiger.zip" into your ZDoom/GZDoom folder and add this line under the "Global.Autoload" section in your "gzdoom-YOURPCNAME.ini":

Code: Select allExpand view
[Global.Autoload]
Path=$PROGDIR/Crow_Geiger.zip


Explained:

Inside Crow_Geiger.WAD I have a decorate file with 1 actor:
Code: Select allExpand view
ACTOR WanderingGeiger
{
   +NOTRIGGER
   +NOBLOCKMONST
   +NOBLOCKMAP
   +DONTSPLASH
   +NOCLIP
   +DROPOFF
   +CANPASS
   +JUMPDOWN
   Speed 2
   Radius 10
   Height 10
   RenderStyle None
   States
   {
   Spawn:
      TNT1 AAA 0 A_Wander(CHF_NORANDOMTURN)
      TNT1 A 1 A_Wander(CHF_NORANDOMTURN)
      Loop
   }
}


Then in the SNDINFO file the follow sounds are defined:

Code: Select allExpand view
GEIGER1 GEIGER1
GEIGER2 GEIGER2
GEIGER3 GEIGER3

$pitchshift GEIGER1 0
$pitchshift GEIGER2 0
$pitchshift GEIGER3 0
$pitchshift GEIGER 0

$random GEIGER {GEIGER1 GEIGER2 GEIGER3}


If the "randomise pitches" is enabled in GZDoom/ZDoom sound options then the geiger counter noises get pitch shifted too, which is not what we want, so the "$pitchshift" entries are to stop this by setting the variance to "0" for these sounds only.

Inside the WAD are 3 separate geiger counter sound effects GEIGER1, GEIGER2 and GEIGER3.

Inside the ACS folder is the following script:

Code: Select allExpand view
#library "crowgeiger"
#include "zcommon.acs"

script "Geiger Counter" ENTER
{
        //set up the variables for use in the script
   int x;
   int y;
   int z;
   int UniqueNoClipTIDA;
   int UniqueNoClipTIDB;
   int UniqueNoClipTIDC;
   int UniqueNoClipTIDD;
   int UniqueNoClipTIDE;
   
   while(true)
      {
                //get the player's current coordinates
      x = GetActorX (0);
      y = GetActorY (0);
      z = GetActorZ (0) + 4.0;
      
                //set unique identifier numbers for the TIDs to assign to the wanderers
      UniqueNoClipTIDA = UniqueTID();
      UniqueNoClipTIDB = UniqueTID();
      UniqueNoClipTIDC = UniqueTID();
      UniqueNoClipTIDD = UniqueTID();
      UniqueNoClipTIDE = UniqueTID();
      
                //spawn wanders defined in the DECORATE file where the player is
      Spawn ("WanderingGeiger", x, y, z, UniqueNoClipTIDA);
      Spawn ("WanderingGeiger", x, y, z, UniqueNoClipTIDB);
      Spawn ("WanderingGeiger", x, y, z, UniqueNoClipTIDC);
      Spawn ("WanderingGeiger", x, y, z, UniqueNoClipTIDD);
      Spawn ("WanderingGeiger", x, y, z, UniqueNoClipTIDE);
      
                //this section tells the wanders to look for the NUKAGE1,2 OR  3 textures underneath themselves
      for (int i = 0; i < 5; i++ )
         {
         if (CheckActorFloorTexture(UniqueNoClipTIDA, "NUKAGE1") || CheckActorFloorTexture(UniqueNoClipTIDA, "NUKAGE2") || CheckActorFloorTexture(UniqueNoClipTIDA, "NUKAGE3"))
            {
            LocalAmbientSound("GEIGER", Random(50,127));
            }
         if (CheckActorFloorTexture(UniqueNoClipTIDB, "NUKAGE1") || CheckActorFloorTexture(UniqueNoClipTIDB, "NUKAGE2") || CheckActorFloorTexture(UniqueNoClipTIDB, "NUKAGE3"))
            {
            LocalAmbientSound("GEIGER", Random(50,127));
            }
         if (CheckActorFloorTexture(UniqueNoClipTIDC, "NUKAGE1") || CheckActorFloorTexture(UniqueNoClipTIDC, "NUKAGE2") || CheckActorFloorTexture(UniqueNoClipTIDC, "NUKAGE3"))
            {
            LocalAmbientSound("GEIGER", Random(50,127));
            }
         if (CheckActorFloorTexture(UniqueNoClipTIDD, "NUKAGE1") || CheckActorFloorTexture(UniqueNoClipTIDD, "NUKAGE2") || CheckActorFloorTexture(UniqueNoClipTIDD, "NUKAGE3"))
            {
            LocalAmbientSound("GEIGER", Random(50,127));
            }
         if (CheckActorFloorTexture(UniqueNoClipTIDE, "NUKAGE1") || CheckActorFloorTexture(UniqueNoClipTIDE, "NUKAGE2") || CheckActorFloorTexture(UniqueNoClipTIDE, "NUKAGE3"))
            {
            LocalAmbientSound("GEIGER", Random(50,127));
            }
         delay(5);
         }
      
                //after a very short while, remove the wanderers and the loop starts again
      Thing_Remove(UniqueNoClipTIDA);
      Thing_Remove(UniqueNoClipTIDB);
      Thing_Remove(UniqueNoClipTIDC);
      Thing_Remove(UniqueNoClipTIDD);
      Thing_Remove(UniqueNoClipTIDE);
      }
}


The script will spawn some invisible actors which will fly out of the player in a straight line. They have noclip enabled too. The "wanderers" fly out of the player and exist only for a few seconds and are removed then the process loops constantly.

During the time the wanders are 'alive' they check for the NUKAGE textures underneath them and if they find it then they will play a random geiger counter sound effect.

Image

You can view the wandering entities flying out of the player by typing the map cheat IDDT twice, first to show the map, second time to show all the entities in the map.

Please let me know if there is anything I am able to do that would make this better or more reliable or if the script could be written less copy-pastey!

Much thanks!
crowbars82
 
Joined: 05 Nov 2017

Return to Tutorials

Who is online

Users browsing this forum: Discord [Bot], Linqz [Bot], Lud and 1 guest