Page 1 of 1

Time Freezer and ACS Scripts

Posted: Sun Nov 30, 2008 15:47
by Tormentor667
I just found a problem with the Time Freezer powerup type and ACS scripts. I have the following script running in one of my Stronghold maps:

Code: Select all

//Sparkling Lights
script 2 OPEN
{
	thing_activate(2);
	thing_deactivate(1);
	Light_ChangeToValue(7, 112);
	delay(random(10,200));
	thing_activate(2);
	thing_activate(1);
	Light_ChangeToValue(7, 255);
	delay(random(10,200));

	restart;
}
This is what the actor looks like:

Code: Select all

Actor ParticleSpawnerWhite
{
	Height 0
	Radius 0
	Speed 1
	PROJECTILE
	+NoBlockMap +NoGravity +NoSector +NoInteraction +NoClip -Solid +CLIENTSIDEONLY
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
 		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1
		TNT1 A 0 A_Jump(224, 2)
		TNT1 A 1 A_SpawnItem("WhiteParticleA1", 0, 0, 0)
		Stop
		TNT1 A 0 A_Jump(192, 2)
		TNT1 A 1 A_SpawnItem("WhiteParticleB1", 0, 0, 0)
		Stop
		TNT1 A 0 A_Jump(160, 2)
		TNT1 A 1 A_SpawnItem("WhiteParticleA2", 0, 0, 0)
		Stop
		TNT1 A 0 A_Jump(128, 2)
		TNT1 A 1 A_SpawnItem("WhiteParticleB2", 0, 0, 0)
		Stop
		TNT1 A 0 A_Jump(96, 2)
		TNT1 A 1 A_SpawnItem("WhiteParticleA3", 0, 0, 0)
		Stop
		TNT1 A 1 A_SpawnItem("WhiteParticleB3", 0, 0, 0)
		Stop
	}
}
It activates several particle spawners that produce sparks. As soon as the time freezer is activated, the script should normally stop but it keeps running. Therefore, more and more particle actors get spawned and the map keeps getting slower and slower in cause of the sheer amount of actors (1 FPS and less). Normally it should also pause the acs script instead of keeping it producing more and more actors while the freezer is activated

Posted: Sun Nov 30, 2008 16:41
by Graf Zahl
I can't halt ACS scripts when the time freezer is on because it whould whack the entire game. I think the only thing that can be done is to prevent particles from being spawned when time is frozen.

Posted: Sun Nov 30, 2008 18:02
by Enjay
Looking at it, in this case the particles are not built in but DECORATE based ones. Obviously, in that case, changing the engine based particles will have no impact and, given that their numbers are limited anyway, I don't see that as a huge saving.


@Tormentor, although it may spoil the freezing effect slightly, what I have done with my own actors where a similar problem has manifested is to use the +NOTIMEFREEZE flag. If you put that on the appropriate actors, they will not freeze and therefore not build up. Like I said, perhaps it spoils the timefreeze effect slightly, but I personally would rather have that than my computer really freezing. ;)

Posted: Mon Dec 01, 2008 19:36
by Tormentor667
@Enjay - Thanks for that tip, but I will hold back this solution as long as I have the hope to get somethinh better :)

@Graf Zahl - Is there nothing you can do about at least the particle generators? It's not only ACS that makes the problem, it's the same for actors that are some kind of "particle generator special effects". They keep spawning particles although the time freeze is activated. So, I'd suggest doing what you've suggested in the second sentence: prevent particles from being spawned when time is frozen.

Posted: Mon Dec 01, 2008 20:06
by Enjay
I'm confused. Are these actually engine based particles (like the particle fountains, built in sparks, railgun trail etc), or are they particles of the kind SolarSnowFall etc have made for various special effects using DECORATE?

Posted: Mon Dec 01, 2008 22:08
by Tormentor667
Exactly, they are DECORATE coded

Posted: Mon Dec 01, 2008 22:31
by Enjay
Hmmm, then I'm confused as to why they keep on spawning particles when the freeze is active. Any such items that I have made have been stopped by the freezer powerup (and I just checked again, they froze).

As you identified, the freezer doesn't stop scripts, so if a script is spawning an item directly, then they can build up but even a DECORATE particle spawner activated/deactivated by a script didn't seem to be building up particles whilst the powerup was active in my map (albeit that my timefreezer isn't active for very long).

What happens if you just place an active particle spawner actor in your map (not affected by a script at all) and activate a timefreeze? Does the particle spawner freeze as expected?

Posted: Fri Dec 05, 2008 8:10
by Tormentor667
Yeah, that works fine, it freezes perfect, it just doesn't work if the spawners are being activated/deactivated by the script. In this case they indeed do build up

Posted: Fri Dec 05, 2008 13:33
by Gez
What about an ACS command to check whether the time is currently frozen or not? Then your scripts could have something like this pseudocode:

Code: Select all

if ( Timefrozen == false )
{
   Spawn(particles, like crazy)
}
else
{
   don't
}
There could be three value it returns, depending on whether it's frozen, unfrozen, or that odd half-speed thing it does when transitioning from frozen to unfrozen. You could use 0 (unfrozen), 1 (unfreezing) and 2 (frozen), or 0 (unfrozen), -1 (unfreezing), 1 (frozen). Something like this.

Posted: Wed Dec 10, 2008 9:39
by Tormentor667
Doing this in the engine itself might make more sense I think, isn't something like this possible?

Posted: Thu Dec 11, 2008 0:03
by Gez
It might make more sense, but then it'd possibly require new script types... I'm sure that some scripts would be broken if they were suspended during a timefreeze.

Posted: Thu Dec 11, 2008 1:08
by Graf Zahl
Actually, upon examining the code this is indeed a bug.

Actors with NOINTERACTION are unaffected by the time freezer. This was certainly not intentional so consider this fixed.

Posted: Thu Dec 11, 2008 1:15
by Enjay
And with my own spawner actors not having the nointeration flag, that would explain why I wasn't getting the same effect.

Posted: Thu Dec 11, 2008 8:21
by Tormentor667
Yay ;)