Damage Per Second Map v2

New maps, and other projects whose primary focus is new maps, belong here.

Note: This forum, and all forums below it, are not for questions or troubleshooting! Threads created here are for active projects only! If you have questions please feel free to use the Editing subforums or General forum.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
DTDsphere
Posts: 133
Joined: Wed Jun 16, 2010 1:19 pm

Damage Per Second Map v2

Post by DTDsphere »

OLD THREAD: viewtopic.php?f=42&t=54317

Hello, I've been learning code at Uni and I decided to give this project another go. This time it actually tells you the damage per second.
This is great for when making gameplay mods as you can see how powerful your weapons and items actually are!

Download Here

Screenshots: (links not embeds because some dickhead admin thought it would be a good idea to disable the [img] tag)
https://i.imgur.com/Se7qTV0.png
https://i.imgur.com/yVGIobr.png

Code: Select all

#include "zcommon.acs"
int tic = 0; //Clock for displaying DPS
int second = 0; //Internal clock for Average DPS(Damage Per 10 Seconds)
int dmgDealt = 0; //Value for Damage Dealt each tic (realtime)
int dmgSecond = 0; //Value for Damage Dealt each second
int dmgTenSeconds = 0; //Value for Damage Dealt each 10 seconds
int xtextbox = 1.0; //xPosition for text e.g. "title: timer, damage"
int ytextbox = 0.15; //yPosition for text e.g. "title: timer, damage"

////////////////
//Total Damage//
////////////////
Script 1 OPEN
{
	SetFont("CONFONT");
	
	//Damage dealt is the difference between the Cyberdemon's max health (999999) and current health.
	dmgDealt = 999999 - GetActorProperty(1,APROP_Health);
	
	/*1 Total Damage Title*/ HUDMessageBold (s:"Total damage:           ";HUDMSG_PLAIN,1,CR_RED,xtextbox,ytextbox,0,1);
	/*2 Total Damage Value*/ HUDMessageBold (d:dmgDealt;HUDMSG_PLAIN,2,CR_RED,xtextbox,ytextbox,0,1);
	
	//Check every tic
	Delay (1);
	Restart;
}

///////
//DPS//
///////
Script 2 OPEN
{
	SetFont("CONFONT");

	//If Cyberdemon isn't at Max Health (999999), don't activate timer and initalise everything
	If (GetActorProperty(1,APROP_Health) == 999999)
	{
		/*3 DPS Title & init Timer*/ 	HUDMessageBold (s:"\nDPS: 70", s:"        ";HUDMSG_PLAIN,3,CR_ORANGE,xtextbox,ytextbox,0,1);
		/*4 Init DPS Value*/ 			HUDMessageBold (s:"\n0";HUDMSG_PLAIN,4,CR_ORANGE,xtextbox,ytextbox,0,1);
	
		//Check every tic
		Delay(1);
		Restart;
	}
	
	//Update every two seconds
	If (tic <= 0)
		{
		//Reset timer back to 70
		tic = tic + 70;
		
		//DPS equals half the value of the total difference between real-time damage and the damage from 2 seconds ago
		/*4 True DPS Value*/ HUDMessageBold(s:"\n", d:(dmgDealt-dmgSecond)/2;HUDMSG_PLAIN,4,CR_ORANGE,xtextbox,ytextbox,0,1);
		
		//Damage from 2 seconds ago is now refreshed with the current real-time damage value to be compared again in 2 seconds from now
		dmgSecond = dmgDealt;
		}
	
	//If Else statement to keep timer value 2 digits long e.g. display 09 instead of 9
	/*3 DPS Title & true Timer*/ If (tic < 10)	{ HUDMessageBold (s:"\nDPS: 0", d:tic, s:"        ";HUDMSG_PLAIN,3,CR_ORANGE,xtextbox,ytextbox,0,1); }
	/*3 DPS Title & true Timer*/ Else 			{ HUDMessageBold (s:"\nDPS: ",  d:tic, s:"        ";HUDMSG_PLAIN,3,CR_ORANGE,xtextbox,ytextbox,0,1); }
	
	//Check every tic while taking 1 from timer
	Delay(1);
	tic = tic - 1;
	Restart;
}

/////////////////////////////////////////////
//Average DPS (Damage dealt per 10 seconds)//
/////////////////////////////////////////////
Script 3 OPEN
{
	SetFont("CONFONT");
	
	//If Cyberdemon isn't at Max Health, don't activate timer
	If (GetActorProperty(1,APROP_Health) == 999999)
	{
		/*6 Avg DPS Title & init Timer*/ 	HUDMessageBold (s:"\n\nAverage DPS: 10        ";HUDMSG_PLAIN,6,CR_GOLD,xtextbox,ytextbox,0,1);
		/*5 Init Avg DPS Value*/ 			HUDMessageBold (s:"\n\n0";HUDMSG_PLAIN,5,CR_GOLD,xtextbox,ytextbox,0,1);
		Delay(1);
		Restart;
	}
	
	//Update every 10 seconds
	If (second <= 0)
	{
		//Reset timer back to 10
		second = second + 10;
		
		/*5 True Avg DPS Value*/ HUDMessageBold (s:"\n\n", d:(dmgDealt-dmgTenSeconds)/10;HUDMSG_PLAIN,5,CR_GOLD,xtextbox,ytextbox,0,1); //The difference between current damage and damage from 10 seconds ago
		
		//Damage from 10 seconds ago is now refreshed with the current real-time damage value to be compared again in 10 seconds from now
		dmgTenSeconds = dmgDealt;
	}
	
	//Keep timer value 2 digits long e.g. display 09 instead of 9.
	/*3 Avg DPS Title & true Timer*/ If (second < 10) { HUDMessageBold (s:"\n\nAverage DPS: 0", d:second, s:"        ";HUDMSG_PLAIN,6,CR_GOLD,xtextbox,ytextbox,0,1); } //Title and true timer
	/*3 Avg DPS Title & true Timer*/ Else { 			HUDMessageBold (s:"\n\nAverage DPS: " , d:second, s:"        ";HUDMSG_PLAIN,6,CR_GOLD,xtextbox,ytextbox,0,1); } //Title and true timer
	
	//Check every second (35 tics) while taking 1 from timer
	Delay(35);
	second = second - 1;
	Restart;
}

////////////////
//Reset button//
////////////////
Script 4 (void)
{
	SetFont("CONFONT");
	
	//Kill and replace Cyberdemon
	Thing_Damage (1, 999999);
	Spawn ("CyberdemonDPS", 0, 0, 0, 1, 192);
	Spawn ("TeleportFog", 0, 0, 0, 0, 0);
	
	//Reset internal timer and damage values
	tic = 70;
	second = 10;
	dmgSecond = 0;
	dmgTenSeconds = 0;
	
	//Terminate and restart Script 2 and 3 to keep them in sync
	ACS_Terminate (2,0);
	ACS_Terminate (3,0);
	Delay (1);
	ACS_Execute (2,0,0,0,0);
	ACS_Execute (3,0,0,0,0);
	
	//Reset external damage value to 0
	HUDMessageBold (s:"\n0";HUDMSG_PLAIN,4,CR_ORANGE,xtextbox,ytextbox,0,1);
	HUDMessageBold (s:"\n\n0";HUDMSG_PLAIN,5,CR_GOLD,xtextbox,ytextbox,0,1);
}
Last edited by DTDsphere on Mon Feb 04, 2019 11:41 am, edited 2 times in total.
User avatar
DTDsphere
Posts: 133
Joined: Wed Jun 16, 2010 1:19 pm

Re: Damage Per Second Map v2

Post by DTDsphere »

Heya,
I've updated this WAD file since the creation of this thread. If you managed to download it early on, please redownload. Thanks!

There will be no more updates.

EDIT:
I just have to do a simple fix to the text overlapping each other when using something other than the default message scaling.
User avatar
kinker31
Posts: 43
Joined: Mon Feb 05, 2018 12:18 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Does anyone actually put anything serious here?
Contact:

Re: Damage Per Second Map v2

Post by kinker31 »

So, I decided to test the map on Russian Overkill...
And let's just say some of the weapons were able to breach the 1M hitpoint limit and kill the cyberdemon.
Especially with the Minelobber's 'Nuclear Disco'.
Like I said, it was a great map.
User avatar
DTDsphere
Posts: 133
Joined: Wed Jun 16, 2010 1:19 pm

Re: Damage Per Second Map v2

Post by DTDsphere »

kinker31 wrote:So, I decided to test the map on Russian Overkill...
And let's just say some of the weapons were able to breach the 1M hitpoint limit and kill the cyberdemon.
Especially with the Minelobber's 'Nuclear Disco'.
Like I said, it was a great map.
I think breaking the 1M hitpoint limit speaks for itself.

EDIT: Updated from today. Functionally identical but added a bit of polish.
User avatar
GeneralDelphox
Posts: 45
Joined: Sat Sep 30, 2017 1:17 am
Graphics Processor: nVidia with Vulkan support

Re: Damage Per Second Map v2

Post by GeneralDelphox »

This is nice. I hope someone could implement it as a HUD addon.
popguy12
Posts: 42
Joined: Fri Jan 19, 2018 1:44 pm
Location: Planet SOPHIA

Re: Damage Per Second Map v2

Post by popguy12 »

GeneralDelphox wrote:This is nice. I hope someone could implement it as a HUD addon.
That would be cool.

also, isnt there a way to make the cyberdemon invincible? or would that break the dps counter?
User avatar
Tango
Posts: 183
Joined: Mon Jul 31, 2006 6:39 pm
Contact:

Re: Damage Per Second Map v2

Post by Tango »

this seems extremely useful, can't wait to try this out on my own mod. thanks so much for making and sharing :D
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Damage Per Second Map v2

Post by ramon.dexter »

Great, this really eases up testing of custom damage in wepons and projectiles!
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: Damage Per Second Map v2

Post by m8f »

Thanks for making this! One more tool to modder's development kit.
GeneralDelphox wrote:This is nice. I hope someone could implement it as a HUD addon.
damage-log.pk3
(1.51 KiB) Downloaded 73 times
Three CVars to control:
dl_x, dl_y: text position on the screen.
dl_log: if set to true, all damage events are logged to console in CSV format: Source,Target,Value (off by default).
Post Reply

Return to “Levels”