Script mover Problem


(AKE) #1

Hello,

i’m new to this site but i have mapped for a bit yet.

Here my problem.
I’ve written the following script.(its supposed to open 2 Gates and close them after a defined time)

tor_RL		
{
	spawn
	{
		accum 2 set 0
	}

	
	trigger move_R
	{
		accum 2 abort_if_not_equal 0
		trigger tor_RL open_RL
	}
	
	trigger open_RL
	{
		
		accum 2 set 1
		trigger	button_RU button_RU_in
		trigger tor_RR open_RR
		wait 500
		playsound sound\movers\misc\big_gate1.wav volume 127
		wait 350
		playsound sound\movers\misc\big_gate2.wav volume 127 LOOPING
		gotomarker door_RL_opened 15 wait
		stopsound
		wm_announce "The right Securitydoor has been opended"
		playsound sound\movers\misc\big_gate3.wav volume 127
		wait 30000
		wm_announce "The right securitydoor will close in 30 seconds"
		wait 15000
		wm_announce "The right securitydoor will close in 15 seconds"
		wait 10000
		wm_announce "The right securitydoor will close in 5 seconds"
		wait 5000
		playsound sound\movers\misc\big_gate1.wav volume 127
		wait 350
		playsound sound\movers\misc\big_gate2.wav volume 127 LOOPING 		
		gotomarker door_RL_closed 15 wait
		stopsound
		wm_announce "The right Securitydoor has been closed"
		playsound sound\movers\misc\big_gate3.wav volume 127
		wait 500
		trigger	button_RU button_RU_out
		accum 2 set 0
		resetscript
	}
}


tor_RR		
{
	spawn
	{
	}
	
	trigger open_RR
	{
		wait 850
		gotomarker door_RR_opened 15 wait
		wait 60350
		gotomarker door_RR_closed 15 wait
		resetscript
	}
}

button_RU		
{
	trigger button_RU_in
	{
		gotomarker button_in_RU 100
		playsound sound\movers\switches\switch_02.wav 
	}

	trigger button_RU_out
	{
		gotomarker button_out_RU 100
		playsound sound\movers\switches\switch_02.wav 
	}
}

It runs verry well but the lopped sound play 3 times short after another and after 20-25 seconds it starts a second time.
Ive tried to set a “accum check” at the beginning that it can’t be executed
if its allready running but it dosn’t work.

Can someone help?

Thanks

AKE


(Erik-Ftn) #2

Hmm, I can offer two different possible solutions to this:

  1. Simple error/ mistakes

I’m no sound expert but that’s seem to be what u scripted.

First u start a looped sound and then wait for gotomarker to be finished, during that wait the looping sound will… loop. (The script will not leave the gotomarker and reach the stopsound until the entity has reached it’s target, this due to the ‘wait’.) Then u have the door waiting for approx 60 secs, close it and play the sound exactly like that again.

Also you have three different sounds and u say it plays three times, you have the sound files right?

(why you need to loop it if u just want it to play once?)

  1. More complex error, easy to fix though

Assuming u timed the looped sound length with the door movement time correctly so u get it desired number of times the sound plays and have the three separate sounds correctly adjusted I can see no problem scriptwise, apart from why you loop it at all.

One thing I found to be the cause of strange problems similar to this is if I had several enteties with the same script-/ and or targetnames. I thought I had grouped them all into one entity but I hadn’t -> this probably causes several entities running the same script parallell / at the same time causing major strangeness and multiple execution of scripting events.

Erik


(AKE) #3

Thx for the answer.

I’ve tried it and splitted it into open/close but it still repeats.
The loop is because th sound is to short the duration of the movement.

Here again the script again with a little “log”.

tor_RL		
{
	spawn
	{
		accum 2 set 0
	}

	trigger move_R
	{
		accum 2 abort_if_not_equal 0
		accum 2 set 1
		trigger tor_RL open_RL

	}
	
	trigger open_RL
	{

		trigger tor_RR open_RR
		wm_announce "Button in"
		trigger	button_RU button_RU_in
		wait 500
		wm_announce "sound open 1"
		playsound sound\movers\misc\big_gate1.wav volume 127
		wait 350
		wm_announce "sound open 2"
		playsound sound\movers\misc\big_gate2.wav volume 127 LOOPING
		gotomarker door_RL_opened 15 
		wait 4000
		stopsound
		wm_announce "The right Securitydoor has been opened"
                                wm_announce "sound open 3"
		playsound sound\movers\misc\big_gate3.wav volume 127
		trigger tor_RL close_RL

	}

	trigger close_RL
	{
		//wait 30000
		//wm_announce "The right securitydoor will close in 30 seconds"
		//wait 15000
		//wm_announce "The right securitydoor will close in 15 seconds"
		//wait 10000
		//wm_announce "The right securitydoor will close in 5 seconds"
		wait 500	//wait 5000
		wm_announce "sound close 1 "
		playsound sound\movers\misc\big_gate1.wav volume 127
		wait 350
		wm_announce "sound close 2"
		playsound sound\movers\misc\big_gate2.wav volume 127 LOOPING 		
		gotomarker door_RL_closed 15 
		wait 4000
		stopsound
		wm_announce "The right Securitydoor has been closed"
		wm_announce "sound close 3"
		playsound sound\movers\misc\big_gate3.wav volume 127
		wm_announce "button out"
		trigger	button_RU button_RU_out
		accum 2 set 0
	}
}

tor_RR
{
	spawn
	{
	}	

	trigger open_RR
	{
		wait 850
		gotomarker door_RR_opened 15 wait
		trigger tor_RR close_RR
	}

	trigger close_RR
	{
		wait 3350	//	wait 60350
		gotomarker door_RR_closed 15 wait
	}
}

button_RU		
{
	trigger button_RU_in
	{
		gotomarker button_in_RU 100
		playsound sound\movers\switches\switch_02.wav 
	}

	trigger button_RU_out
	{
		gotomarker button_out_RU 100
		playsound sound\movers\switches\switch_02.wav 
	}
}

That is what it does: :???:

Button in
Button in
Sound open 1
Sound open 1
Sound open 2
Sound open 2
Sound open 3
The right Securitydoor has been opened
Sound close 1
Sound close 1
Sound close 2
Sound close 2
Sound close 3
The right Securitydoor has been closed
Button out
Sound close 3
The right Securitydoor has been closed
Button out


(Erik-Ftn) #4

Well, I haven’t looked through your script in detail, but it now definitely sound like a problem under pt 2 in my first reply.

(eg some origin or some old button/ door brush u used etc isn’t grouped correctly into it’s entity)

I would go through the entities with the entity-list function (I mean the L-key) in Radiant, and/ or do a free-text search on the scriptnames on the .map in a texteditor to check that all brushes are grouped right.


(Moonkey) #5

This might be the problem


      trigger tor_RR open_RR 

It’s calling a trigger which has a wait in it, so it could be messing up your sequences (maybe :???: )

Try taking it out of your open_RL block and putting it in move_R.