Script doesn't want to be terminated

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Script doesn't want to be terminated

Post by XutaWoo »

Code: Select all

#include "zcommon.acs"

script 1 OPEN
{
  delay(random(595, 3920));
  Radius_Quake(9, 280, 0, 50, 1);
  delay(280);
  Floor_MoveToValue(1, 560, 88, 1);
  ChangeFloor(1, "LAVA1");
  ACS_ExecuteAlways(37, 0, 0, 0, 0);
  delay(random(875, 4200));
  Floor_MoveToValue(1, 560, 48, 1);
  ChangeFloor(1, "FLOOR6_2");
  ACS_Terminate(37, 0);
  restart;
}


script 37 (void)
{
  SectorDamage(1, 50, "Annihilate", "null", DAMAGE_PLAYERS | DAMAGE_NONPLAYERS);
  delay(1);
  restart;
}
The first script is supposed to start the second, which it does, then terminate it. Either it doesn't do that or the effects of the script lingers for no reason. What's wrong with it?
DoomerMr_T
Posts: 54
Joined: Fri Nov 09, 2007 7:25 am
Location: Budapest,Hungary
Contact:

Re: Script doesn't want to be terminated

Post by DoomerMr_T »

You gave a restart command in your Script 37. You cannot terminate looped scripts.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Script doesn't want to be terminated

Post by XutaWoo »

Yeah that doesn't help me at all. I need a solution if that's the problem.
Blzut3
 
 
Posts: 3211
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: Script doesn't want to be terminated

Post by Blzut3 »

Is there a reason your using ACS_ExecuteAlways to execute script 37? That's the reason ACS_Terminate won't work on it.
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: Script doesn't want to be terminated

Post by Project Shadowcat »

DoomerMr_T wrote:You gave a restart command in your Script 37. You cannot terminate looped scripts.
Yes, you can, it's ideal for things like displayed timers and other HUDs. Using such a thing right now in many places and it works.

Blzut3 is correct. It's likely the ExecuteAlways.
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Re: Script doesn't want to be terminated

Post by Captain Ventris »

I'm sorry, Xuta. You're script has become self-aware.

Destroy it! CAST IT INTO THE FIRE!!!
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Script doesn't want to be terminated

Post by HotWax »

ACS_ExecuteAlways is allowed to call multiple instances of the same script, whereas ACS_Execute is not. Therefore, scripts started with ACS_ExecuteAlways cannot be terminated using ACS_Terminate, because the game doesn't know which copy needs to die.

You have a couple choices. Either find a way to call the script using the normal ACS_Execute, or find a way for the script to terminate itself when the conditions are met. Given that this appears to be a one-time action being performed on a single sector, I don't see any reason for script 37 to need to run concurrently with itself, so I'd suggest the former method in this case.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Script doesn't want to be terminated

Post by XutaWoo »

I just replaced ACS_ExecuteAlways with ACS_Execute. Thanks guys!
Locked

Return to “Editing (Archive)”