Page 1 of 1

[FINAL] Damage Per Second Map

Posted: Thu Apr 05, 2018 9:24 pm
by DTDsphere
Damage Per Second Map
This map is a tool to learn how powerful each weapon is. This is useful for testing custom weapons. Have fun with it.

Download: https://goo.gl/XLfXFK

Screenshots
Image

Image

Source Code

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);
}

[FINAL] Re: Damage Per Second Map

Posted: Fri Apr 06, 2018 12:22 am
by Ænima
Great idea. 💡

Now somebody should make DPS charts for the weapons of all popular mods. :p

[FINAL] Re: Damage Per Second Map

Posted: Tue Apr 10, 2018 7:21 pm
by DTDsphere
Feel free to post a big DPS chart into this thread!

[FINAL] Re: Damage Per Second Map

Posted: Fri Apr 13, 2018 7:59 pm
by De-M-oN
That will sure help modders to balance their weapons in their mods, especially on big mods like AOW and so on.