Weird script mover problem


(damocles) #1

I have a very simple script mover door setup in my map - basically a big door is opened and closed via button. It all works as expected, except for one thing. On some occasions (seemingly upredictably) when the mover starts to move, it completely vanishes and all players become “stuck”. It’s as if the mover suddenly envelops the whole level.

As I said, it works fine most of the time, but every so often, this happens. Anyone have any idea what the cause is or whether it’s a known bug?


(d3coy) #2

post your script for better results


(damocles) #3

Pretty straightforward script. And ther garage door mover is a simple brush entity, usual fare with two path_corners used for the up and down positions.

garagedoor
{
	spawn
	{
		wait 250
		accum 1 set 0 // accum 1 is the "in motion" flag
	}
	death
	{
	}
	trigger up
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		alertentity gdoor_opensound
		gotomarker gdoor_top 16 deccel wait
		alertentity gdoor_opensound
		alertentity gdoor_finishsound
		wait 1250
		trigger garagedoorbutton ready
		trigger garagedoorbutton2 ready
		accum 1 set 0
	}
	trigger down
	{
		accum 1 abort_if_equal 1
		accum 1 set 1	
		alertentity gdoor_opensound
		gotomarker gdoor_bottom 16 deccel wait
		alertentity gdoor_opensound
		alertentity gdoor_finishsound
		wait 1250
		trigger garagedoorbutton ready
		trigger garagedoorbutton2 ready
		accum 1 set 0
	}
}

garagedoorbutton
{
	spawn
	{
		wait 250
		accum 4 set 0
		accum 1 set 0 // active flag - 1 means its already moving
	}
	trigger ready
	{
		accum 1 set 0
	}
	trigger unready
	{
		accum 1 set 1
	}
	trigger pressed
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		trigger garagedoorbutton2 unready
		// tbd: play some kind of error sound if not able to move
		accum 4 trigger_if_equal 0 garagedoor up
		accum 4 trigger_if_equal 1 garagedoor down
		accum 4 inc 1
		accum 4 abort_if_less_than 2
		accum 4 set 0
	}
}
garagedoorbutton2
{
	spawn
	{
		wait 250
		accum 4 set 0
		accum 1 set 0 // active flag - 1 means its already moving
	}
	trigger ready
	{
		accum 1 set 0
	}
	trigger unready
	{
		accum 1 set 1
	}
	trigger pressed
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		trigger garagedoorbutton unready
		// tbd: play some kind of error sound if not able to move
		accum 4 trigger_if_equal 0 garagedoor up
		accum 4 trigger_if_equal 1 garagedoor down
		accum 4 inc 1
		accum 4 abort_if_less_than 2
		accum 4 set 0
	}
}

(LaggingTom) #4

Do you have origin brushes in your script_movers?


(damocles) #5

yep. Like I said, the door works perfectly most of the time, but one in every ten or so times it will do the weird bug.


(LaggingTom) #6

Setstate the button entities to invisible when it’s unready and try it. It might just be a random pressing that it’s letting by the accum.


(damocles) #7

nope :frowning: hiding the buttons hasn’t fixed it either. One thing worth noting, as it might shed some light - the error only occurs when the door is trying to move to the down position.


(damocles) #8

ah…found it. And it warrants a D’OH! because I’m an idiot. When one button moved the door up or down, I forgot to inc the accum in the other buttion that tracked the door position. The error was occuring when the door was being told to move to the location it was already at.