ACS DEATH TIMER

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

ACS DEATH TIMER

Post by Beetow Brode »

Listen right. Im not good at this coding stuff. I seriously need to practice my ACS skill since this is the second question today right? anyway back on topic

ACS DEATH TIMER

Sounds neat, I wanted this and I'm like hmm this might work so I copied and pasted the example on ZDoom wiki and I'm like, "Yeah that works." Then I try to implement death and I see complicated things and all I think then is like dang I need some help, so I'm here and this is what I have (copied and pasted) so far.

Code: Select all

script 7 (void)
{
	SetFont("bigfont");
	int t;
	while(TRUE)
	{
		t = Timer() / 35;

		HudMessage(d:t/60, s:":", d:(t%60)/10, d:t%10;
			HUDMSG_PLAIN, 1, CR_YELLOW, 0.95, 0.95, 2.0);

		Delay(35);
	}
}
P.S. Yeah I'm a lazy ass, sorry.
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

I really need help. If someone could help please tell me
User avatar
Tartlman
Posts: 226
Joined: Thu Oct 11, 2018 5:24 am
Location: meme hell
Contact:

Re: ACS DEATH TIMER

Post by Tartlman »

I'd say that all you have to do is change it from "script 7 (void)" to "script 7 DEATH". That should work fine. Also, if the timer is acting weird, rather than using Timer(), then try this:

while(true)
{
t++;
HudMessage(d:(t/35)/60, s:":", d:(((t/35)%60)/10, d:(t/35)%10;
HUDMSG_PLAIN, 1, CR_YELLOW, 0.95, 0.95, 2.0);

Delay(1);
}

or something
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

Seems to be an issue with your coding. it says syntax error but I cant see anything wrong. Also I changed it to Script 7 DEATH and it didn't work. Thanks for the suggestion but Idk how to fix your code.
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

wait i might be stupid hold on
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

Nope. To be honest I have no idea what t++; means. It doesnt auto complete by anything so I think thats where the issue is, that and when i retyped it and when i added d:(((t/35)%60)/10, it fell apart and caused the error and an missing argument..
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: ACS DEATH TIMER

Post by Void Weaver »

Words...
Your request is completely uninformative. There is no abstract "death timer" therm without specification. Who\what is supposed to be script activator? Under which condition it should be performed? Which is specific "time section" should be counted, and what is should be performed after?
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

Hmm, I guess it would make more sense. You have to complete a certain time limit in one area then the script terminates once it has been walked over. Roughly 2 mins would be the max for each area but i only need 1 script for each area
the conditons are you walk over a line. timer starts and once it reaches 2:00 it kills you instantly. otherwise you walk over a line and it ends then once you walk into the next puzzle it starts a new timer roughly the same script then the cycle repeats etc etc.

Edit: Really sorry I wasnt more clear I just needed a base line to go off of but I guess it would be easier if I explained what was going on.
User avatar
22alpha22
Posts: 308
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: ACS DEATH TIMER

Post by 22alpha22 »

Here is a very simple "Death Timer".

Code: Select all

Script "Death_Timer" (Int Seconds) {
Timer = Seconds * 35;

     While (Timer > 0)
     {
          Print(s:"Time left: ", i:Timer / 35);
          Timer--;
          Delay(1);
     }

DamageThing(0,0);
}
Name the script whatever you want or give it a number. Use argument 1 to set however many seconds you want the timer to last. Use ACS_NamedTerminate or ACS_Terminate to stop the script and therefore the timer.

EDIT:
Added a simple print timer so the player can see how much time they have left.
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

f*** it says im missing a bracket where it says

Code: Select all

 Timer = Seconds * 35; 
so like im sitting here like 8-)
User avatar
Tartlman
Posts: 226
Joined: Thu Oct 11, 2018 5:24 am
Location: meme hell
Contact:

Re: ACS DEATH TIMER

Post by Tartlman »

Beetow Brode wrote:f*** it says im missing a bracket where it says

Code: Select all

 Timer = Seconds * 35; 
so like im sitting here like 8-)
it shouldn't be missing a bracket, are you sure that you copied and pasted it properly?
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

User avatar
22alpha22
Posts: 308
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: ACS DEATH TIMER

Post by 22alpha22 »

Oops my fault, I forgot there was already a function named Timer. Here is an even simpler timer that should actually work.

Code: Select all

Script 7 (Int Seconds) {

     While (Seconds > 0)
     {
          Print(s:"Time left: ", i:Seconds);
          Delay(35);
          Seconds--;
     }

DamageThing(0,0);
}
Same as before, use argument 1 to set how many seconds the timer should last and use ACS_Terminate to stop it.
User avatar
Beetow Brode
Posts: 69
Joined: Sat Sep 24, 2016 1:46 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: "We've Got Hostiles"

Re: ACS DEATH TIMER

Post by Beetow Brode »

One last thing. It works, and I thank you so much. But how do you change it to a hud message
Post Reply

Return to “Scripting”