again sound problem


(Teuthis) #1

sorry for being such a pain.

I want a machiene Sound to be played when the gun Rotation starts. I am trying this now for days and can only get it to work half-decent. The way I put the Sound in the script below was the only way the Sound was played but unfortunately the Sound starts after the gun stops rotating. So I guess the script part that Plays the Sound is executed after the script has finished the faceangles command. I put the Sound command now at various Locations that are connected with the moving of the gun but they are never executed. Strangely the wm_announcement is always executed when I put it after my Sound command. Anyone has an idea?

I even tried to connect a Trigger_always to a target_Speaker and then tried to toogle the Trigger by setstate invisible/Default etc but als this didn’t work. I also tried to Loop the Speaker and then enable/disable Speaker via the script, also didn’t work. There must be something wrong here. I tested the Sound in a place in the script where I use other sounds. The Sound Plays nice, just not at the place where I Need it.

here the script

pak75 // script_mover
{
spawn
{
wait 200
setstate pak75 invisible
setstate gun_flash invisible
setstate pak75_moved invisible
setstate pak75_moved_clip invisible
setstate pak75_move_1 invisible
setstate gun_fire invisible
setstate gun_rotated_toi invisible
setstate fire_ready_toi invisible
setstate rotate_ready_toi invisible
setstate rotate_green1 invisible
setstate rotate_green2 invisible
setstate rotate_gelb invisible
setstate fire_green invisible
}
trigger move
{
faceangles 0 90 0 3000
playsound sound/movers/motors/motor_loop_01.wav
}
}

// here we do checks and control all the gun parts

pak75_dummy_construct // func_constructible
{
spawn
{
wait 200
constructible_class 3 //only dynamite can destroy the gun

    accum 0 set 0 					//state of gun: bit 0 = broken, bit 1 = repaired // bit 2 = ammo box delivered
}
trigger gun_repaired				//before move gun can be repaired and destroyed
{
    accum 0 bitset 1

wait 200
trigger fence_block oeffnen //gun rotation control can be reached now
setstate rotate_green1 default //green light 1 indicating rotation enabled visible
setstate rotate_red1 invisible //red light 1 indicating rotation disabled invisible
}

trigger gun_damaged					//before move gun can be repaired and destroyed
{
    accum 0 bitreset 0

wait 200
trigger fence_block schliessen //gun rotation control not reachable when gun is broken
setstate rotate_red1 default //red light 1 indicating rotation disabled visible
setstate rotate_green1 invisible //green light 1 indicating rotation enabled invisible
}

trigger objective_delivered //ammo box delivered to gun
{
accum 0 bitset 2
setstate rotate_block invisible //gun rotation control panel visible
setstate pak75_move_1 default //gun rotation control enabled
setstate rotate_red2 invisible //red light 2 invisible
setstate rotate_green2 default //green light 2 visible
playsound sound/weapons/fg42/fg42_reload.wav //play charging sound

wait 200
setstate rotate_ready_toi default //toi saying that gun is ready to rotate visible

}

trigger move
{
accum 0 abort_if_not_bitset 2 // it can only move when ammo box was delivered
trigger pak75 move // move that gun

wait 100
wm_announce “^3gun rotation started”

wait 4000 //this is the time the gun rotates and then the scriptmover disappears and is replaced by a non-constructable gun

setstate pak75_moved default //moved gun now visible - gun no longer constructable
setstate pak75_moved_clip default //moved gun clip visible - gun no longer constructable
setstate pak75 invisible //gun scriptmover after move invisible - gun no longer constructable
setstate pak75_dummy_construct invisible //gun scriptmover after move invisible - gun no longer constructable
setstate pak75_toi invisible //gun scriptmover after move invisible - gun no longer constructable
setstate gun_rotated_toi default //toi saying that gun can’t be destroyed anymore visible
setstate rotate_red1 invisible //red light 1 indicating gun can’t be rotated invisible
setstate rotate_red2 invisible //red light 2 indicating gun can’t be rotated invisible
setstate rotate_green1 invisible //green light 1 indicating gun can be rotated invisible
setstate rotate_green2 invisible //green light 2 indicating gun can be rotated invisible
setstate rotate_gelb default //yellow light indicating gun was rotated visible
wm_announce “^2the gun is ready to be fired”

wait 200
setstate fire_block invisible //gun fire control panel visible
setstate gun_fire default //gun fire control enabled

wait 200
setstate fire_ready_toi default //toi saying that gun is ready to fire visible
setstate fire_red invisible //red light indicating firing disabled invisible
setstate fire_green default //green light indicating firing enabled visible
}

built final					
{ 

setstate pak75 default // repaired gun visible-this command handles the repaired and destroyed gun before the move
setstate pak75_broken invisible // broken gun invisible-this command handles the repaired and destroyed gun before the move
setstate pak75_broken_clip invisible
trigger pak75_dummy_construct gun_repaired // trigger dummy_construct-this command handles the repaired and destroyed gun before the move

}
death 
{

setstate pak75 invisible //this command handles the repaired and destroyed gun before the move
setstate pak75_broken default //this command handles the repaired and destroyed gun before the move
setstate pak75_broken_clip default //this command handles the repaired and destroyed gun before the move
trigger pak75_dummy_construct gun_damaged //this command handles the repaired and destroyed gun before the move
}
}

pak75_move_1 // func_invisible_user //this thing controls the move of the gun after the ammo box was delivered
{
activate allies //trigger this thing only when activated by allies
{
trigger pak75_dummy_construct move //move the gun

wait 500
setstate pak75_move_1 invisible //we only wanna move once so we let the button disappear
}
}

gun_fire // func_invisible_user //this thing controls firing of the gun after the gun was moved
{
activate allies //can only be activated by allies
{
trigger gun_fire flash //triggers flash and sound that is connected to flash model in map file via target_speaker
}

trigger flash
{
trigger boomtrigger boom_all //triggers gate explosion-taken from goldrush that’s why it’s called bank stuff…
alertentity bank_door1
setstate doorframe invisible
setstate doorframe_damaged default

setstate gun_flash default //controls the gun flash upon firing
wait 100
setstate gun_flash invisible
setstate gun_fire invisible //one shot should be enough so we let the button disappear

wm_announce “^1Allies destroyed the gate to Teuthonia”
}
}


(twt_thunder) #2

Incredible stupid question but have you tried it the other way around?

trigger move
{
playsound sound/movers/motors/motor_loop_01.wav
faceangles 0 90 0 3000
}

(Teuthis) #3

[QUOTE=twt_thunder;519486]Incredible stupid question but have you tried it the other way around?

trigger move
{
playsound sound/movers/motors/motor_loop_01.wav
faceangles 0 90 0 3000
}

[/QUOTE]

It’s Not a stupid question, Rather It’s a logical question but yes, i tried it there and at many Other places of the script that is part of the Moving Event. Strangely i use Other Sounds at Other Parts of the script and they all work, just this one doesn’t.

I’m actually close of giving up this. I now Put the playsound Thing basically in every line connected to the Gun rotation Event without success. I also tried to trigger the Sound Directly by a script command and an entry trigger start_sound.

Need to let this Rest for some days or it drives me nuts…


(Mateos) #4

I’d suggest you to do it like a moving Tank, with an entity ingame connected to the mover, that triggers its start sub-routine, from which you call the looping sound

You can see it I think with “trigger tank sound_move” as a keyword in Gold Rush I believe


(Teuthis) #5

[QUOTE=Mateos;519509]I’d suggest you to do it like a moving Tank, with an entity ingame connected to the mover, that triggers its start sub-routine, from which you call the looping sound

You can see it I think with “trigger tank sound_move” as a keyword in Gold Rush I believe[/QUOTE]

I was already Looking for an entity in Game that can be activated by the mover and that then Target the speaker. However, the trigger_always didn’t work and there was Not really anything Else That jumped to my mind. I also tried to Target the speaker Directly by the func_invisible user which activates the mover but also this didn’t work. Actually strangely the Hand you see when you are in front of the func_invisible user disappears when i Directly Target the speaker by the func_invisible user.

As I Said I also tried to let the speaker Loop all the Time and then just tried to enable the speaker only for the Time the Gun rotates. Didn’t work either. Will Check Goldrush as you Said, Maybe i can manage.

Thanks


(twt_thunder) #6

or maybe something like the doors in battery? you know the double door you can open with a button… there is some sound activating in script there…


(Teuthis) #7

Yes, i know and use the Same in my prefab to lower the dropzone Fence via a button, which then activates a sound. This Works Perfect, however the Same command placed in the script Where the Gun is moved doesn’t work (but strangely the wm_announcement is executed correctly).

The radiant can be your best Friend and your worst enemy…


(twt_thunder) #8

ok, lets attack it otherwize… I just had a look at your script and for me it seems there is to much things there really…
instead of the faceangle stuff, isnt it possible to use something else like

setrotation <pitchspeed> <yawspeed> <rollspeed>
Sets the rotational velocity of an entity.
??

EDIT:
For as I understand you want a model turned when a user press a button?


(twt_thunder) #9

if you have a look at my old (terrible bridge) and drop one of the buttons I am sure you get my idea

movable_bridge.zip (2.73 KB)


(Teuthis) #10

[QUOTE=twt_thunder;519520]ok, lets attack it otherwize… I just had a look at your script and for me it seems there is to much things there really…
instead of the faceangle stuff, isnt it possible to use something else like

setrotation <pitchspeed> <yawspeed> <rollspeed>
Sets the rotational velocity of an entity.
??

EDIT:
For as I understand you want a model turned when a user press a button?[/QUOTE]

Correct, the Thing is supposed to move Once a button is pushed. Note That there are lots of entities triggered in this script (78 entities), the Moving is just a Tiny Part. Actually the Moving Part of the script (faceangles Part) was done by Acqu so I believe this is ok. The Rest of the script was added step by step by me until I got what I needed. Happy to Share the prefab of Course.

In Detail what the script does:

  • button 1 Lowers the dropzone Fence
  • Gun Can be repaired which turns on the First Green light on the Gun Control Panel
  • Ammo delivered to the Gun plays a changing Sound and puts on a Second Green light on the Gun Control Panel.
  • if the Gun is repaired and loaded (so when two Green lights are on at the Gun Control Panel), a Fence Lowers that finally enables Gun Rotation
  • Once rotated, a yellow light Goes on and the Gun can’t be destroyed/repaired anymore. This is also indivücated by a Special TOI that appears After the Rotation. Then a Green light Goes on on the Fire Control Panel indicating Gun can be fired. Everything is Supporten by wm announcements too.

You need to understand that the Gun comprises of three Models, broken, repaired and One non destroyable After the Rotation. Since every Model Comes with Clip Brushes the script is quite intense ( plus Those 4 light entities derzeitig the player as to what needs to be done next).

  • everything is connected to TOIs to make it Clear what needs to be done next (for example if you repaired the Gun but didn’t load the Gun and then you go to the Gun Control Panel there is a TOI Saying That Gun has to be loaded First). So to Guide the player in the right Direction Those intense script was Necessary.

I think the script is appropriately sitzend I think but who knows…


(twt_thunder) #11

ok here is a moving gun, very fast and badly but working with sound

turninggun.zip (2.38 KB)

you ofc have to rename a lot but you get my point…


(twt_thunder) #12

Once rotated, a yellow light Goes on and the Gun can’t be destroyed/repaired anymore.

Isnt this a little wierd? the gun gets dynamiteproof once turned??

EDIT:
BTW it also works as a script_mover if you change it , something that is more useable for you as you need it repairable :smiley:


(Teuthis) #13

Yes and no. It was technically very challanging to script this. Initiale i Wanted this always destroyable and After the rotated Gun was destroyed i Wanted the Gun to Show up like before the Rotation. However, it Turned out that when the rotated Gun was destroyed and then rebuild, the rebuild Gun was also then already rotated, so you Could only rotate Once which was a bit Strange. Therefore I decide to make the rotated Gun non-destructable anymore. At this point of the Game (After rotation) the battlefield will move away from the Gun and will concentrate on the Gun Fire Control Panel, which i think is Not bad.

Had to make this compromises, the alternative was Not That nice.

You wanna Test the prefab upfront? Happy to Share and Would like to get you thoughts on it before I Put it in a Map.


(twt_thunder) #14

You wanna Test the prefab upfront?

No, I will try tomorrow evening to make you a prefab after the steps you have written in the other post :smiley:
Now I will find the shower and bed :slight_smile: early raise tomorrow


(Teuthis) #15

[QUOTE=twt_thunder;519526]ok here is a moving gun, very fast and badly but working with sound

turninggun.zip (2.38 KB)

you ofc have to rename a lot but you get my point…[/QUOTE]

Thunder, in your map file you have the same Problem. You put a Sound command before and after the Rotation. The Sound before the Rotation doesn’t Play (same as for my prefab) and the Sound after the Rotation Plays after the Rotation is finished. The reason why you hear the Sound almost simultaneously as the Rotation is because your model moves in 18ms as compared to 3sec in my prefab.


(twt_thunder) #16

Ok TEUTHIS, I’ll post it here so others also benefit of it.
It seems I have solved your problem.

first script:

add in gamemanager before your wait:

game_manager
{
	spawn
	{
	    disablespeaker move// so speaker wont turn on before it should

and then lower down in your pak75 script:

trigger move
    	{
		enablespeaker move //put on speaker
		faceangles 0 90 0 3000 
		disablespeaker move //turn it off when we're done
	}

then you save, load your map as bsp

when match started go to where the pak is and take down console
then write:
\editspeakers

\dumpspeaker

\modifyspeaker

now, on noise I would suggest:

sound/movers/misc/garage_door_loop_01.wav

target: move
looped: off
Broadcast: nopvs

press ok

console down again,

\editspeakers
\map_restart

go do your thing :slight_smile:


(Mateos) #17

Nice. More docs about speakers: http://wiki.splashdamage.com/index.php/Speaker_Editor


(twt_thunder) #18

Nice docs :smiley:


(Teuthis) #19

[QUOTE=twt_thunder;519708]Ok TEUTHIS, I’ll post it here so others also benefit of it.
It seems I have solved your problem.

first script:

add in gamemanager before your wait:

game_manager
{
	spawn
	{
	    disablespeaker move// so speaker wont turn on before it should

and then lower down in your pak75 script:

trigger move
    	{
		enablespeaker move //put on speaker
		faceangles 0 90 0 3000 
		disablespeaker move //turn it off when we're done
	}

then you save, load your map as bsp

when match started go to where the pak is and take down console
then write:
\editspeakers

\dumpspeaker

\modifyspeaker

now, on noise I would suggest:

sound/movers/misc/garage_door_loop_01.wav

target: move
looped: off
Broadcast: nopvs

press ok

console down again,

\editspeakers
\map_restart

go do your thing :)[/QUOTE]

Omg, this Sounds too great to be real. You fixed Here something Short notice Where I scratched my Head over for days. And then you want to Tell me something about pro Mapping brother? Thanks so much. Seriously we need to do something together very soon. If Necessary i take a Little Trip to northern Europe to convince your wife that this is Not obligatory :slight_smile:


(twt_thunder) #20

Dude… This is not something awesome, I just was thinking… and then “comandpost” came poping to my head… the sound works the same way there really :slight_smile: