Page 1 of 1
Trigger Alarm for Vent
Posted: Fri Mar 27, 2009 4:07 am
by sdlall
Been working sound trigger alarm for vent in V2 Rocket Facility all day and getting no where. Was wondering if someone could help me out already have message to player scripted (I know easy) but can not figure this out. I know sounds like asking for someone to make (guess I am) but really wondering what it looks like. I have the origins ( 1141 960 -607 ).
Note trying to get this to work serverside only. Just basic alarm thats on for lets say 10 seconds then resets.
Thanks
Got to work
Posted: Fri Mar 27, 2009 6:54 am
by sdlall
Well got it to sound but need something to time the loop and sloppy. I hate to post the script on here cause would be very embarrassed of it. Took most of it from alarmer.scr. So if you have simple way of doing it plz post or if you really want to see my way. ask
K after hours and hours and making it harder then what it is. I came up with this but still need more.
Code: Select all
local.master = spawn ScriptMaster
local.master aliascache m2l2_alarm1 sound/mechanics/Mec_Alarm_03.wav soundparms 0.5 0.0 1.0 0.0 1000 20000 auto loaded maps (getcvar mapname)
level waittill prespawn
thread Vent_Trigger
level waittill spawn
Vent_Trigger: //START OF TRIGGER1 IN VENTS
local.trig = spawn trigger_multiple targetname turn_alarm_on
local.trig.origin = ( 1141 960 -607 ) // This is where you place the cords you have.
local.trig setsize ( -30 -30 -30 ) ( 30 30 30 ) //this defines the box size.
local.trig setthread turn_alarm_on //Name of thread.
local.trig message "You set off Vent Alarm" //This is what flashes on the players screen.
local.trig wait 1 // How often the trigger repeats itself.
local.trig delay 0 // How long before trig acts.
end
turn_alarm_on:
$turn_alarm_on waittill trigger
$turn_alarm_on playsound m2l2_alarm1
end
I would like to loop it for 10 seconds. Then have the trigger reset.
Posted: Fri Mar 27, 2009 5:47 pm
by $oldier Of Ra
Embarrassed of what? I just see you do things a little bit more extended than initially required.
First of all "local.mytrigger delay 0" is unwanted and unneeded (for any trigger) since it'll make the trigger respond every split of a split of a second. The default delay is 0.05, which is a frame and that alone is already very fast.
Second, in a setthread of a trigger, self is always the trigger itself. Using targetnames is fine but typing 4 letters is faster.
Code: Select all
Vent_Trigger:
local.trig = spawn trigger_multiple targetname turn_alarm_on
local.trig.origin = ( 1141 960 -607 )
local.trig setsize ( -30 -30 -30 ) ( 30 30 30 )
local.trig setthread turn_alarm_on
local.trig message "You set off Vent Alarm"
local.trig wait 1
end
turn_alarm_on:
self nottriggerable
self loopsound m2l2_alarm1
wait 10
self stoploopsound
self triggerable
end
Posted: Fri Mar 27, 2009 8:50 pm
by sdlall
Tried what you wrote and got the message but did not get any sound from it. Seems to only happen when I loopsound. A little more info. for you incase something I might not have mentioned. I am going to be running this as serverside only mod and also V2 will be tdm.
Wasn't really embarraded at that one but should seen the one I that I copied from alarm.scr. Had to of been 40 lines. It loop fine but could get it to stop. The coding was out of my league on that.
Update: Since can not get loopsound to work messed with the setsize and just increased the north so that when player is going that way keeps going off with playsound. Seems to work. Still would like to get loop to work because player could just sit in that huge area and keep it running but guess that would = DEATH
Posted: Fri Mar 27, 2009 10:42 pm
by jv_map
You may have more luck attaching the sound to a different entity. Triggers aren't really suitable for playing sounds, they aren't even visible (in moh, visible means audible, too) to the client. Try making a script_model in radiant at the position of the sound (place it in the map proper, not inside or behind a wall or something - it will be hidden anyway) and give it 'model' 'fx/dummy.tik' and 'targetname' 'speaker' (example) and just to be sure 'notsolid'. Use sor's script as is but with the following modification:
Code: Select all
turn_alarm_on:
self nottriggerable
$speaker loopsound m2l2_alarm1
wait 10
$speaker stoploopsound
self triggerable
end
k here a question
Posted: Sat Mar 28, 2009 12:45 am
by sdlall
k wrote it like this but 2 problems i have one the print message doesn't show and 2 once i go around the corner in vents while it is sounding it goes away. i would like it to sound levelwide for 10 second. do i use this somewhere in it to do it. local.vol "levelwide"
Code: Select all
Vent_Trigger: //Vent Alarm
local.ent = spawn script_model targetname speaker
local.ent model "fx/dummy.tik"
local.ent.origin = ( 1141 960 -607 )
local.ent scale 3
local.trig = spawn trigger_multiple targetname turn_alarm_on
local.trig.origin = ( 1141 960 -607 )
local.trig setsize ( -30 -30 -30 ) ( 30 30 30 )
local.trig setthread turn_alarm_on
end
turn_alarm_on:
local.player iprint ("You are in Secret Room")
self nottriggerable
$speaker loopsound m2l2_alarm1
wait 10
$speaker stoploopsound
self triggerable
end
Thanks Solider and jv been big help in me trying to learn and if there tutorial that explains all this point me that direction so do not waste anymore of your time. Looked through all of them I believe
Posted: Sat Mar 28, 2009 10:49 am
by Aprop
Man... delete local.player line, and add
" local.trig message "You set off Vent Alarm" to Vent_Trigger thread....
Posted: Sat Mar 28, 2009 12:02 pm
by $oldier Of Ra
Of course it doesn't work, I don't see local.player defined anywhere?
Add this above the "local.player iprint":
There are a number of options you can take to play this sound levelwide. Either set the minimum and maximum distance in your aliascache to 10000 or more:
Code: Select all
local.master = spawn ScriptMaster
local.master aliascache m2l2_alarm1 sound/mechanics/Mec_Alarm_03.wav soundparms 0.5 0.0 1.0 0.0 20000 20000 auto loaded maps (getcvar mapname)
or edit your loopsound command:
Code: Select all
$speaker loopsound m2l2_alarm1 1.0 "levelwide"
Posted: Sat Mar 28, 2009 9:02 pm
by sdlall
B-E-A_utiful! Works like charm did the $speaker loopsound m2l2_alarm1 1.0 "levelwide" because do not really understand the sound parameters. I now know from what you wrote that last 2 are for distance. Guessing the 1.0 is volume. Just sound.txt file in pak doesnt define them like that. Thanks All for taking time out to help.
Posted: Sat Mar 28, 2009 11:34 pm
by $oldier Of Ra
Are you talking about the loopsound command or the aliascache?
In the game module classes you can find out any available command along with it's parameters and syntaxes (syntaxes seem incomprehendable or vague though, especially if you don't know how syntaxes are represented in that list or if you don't know all syntaxes of the scripting language).
Quoted from the game module classes:
Code: Select all
loopsound ( String soundName, [Float volume], [String minimum_distance] )
There's nowhere stated (in the module classes) which values you can use for the [String minimum_distance]. I just found "levelwide" in the weather.scr. But I mainly create levelwide sounds through the aliascache unless I need that sound to be played levelwide on some occasion and locally on another.
You mean the sound0.txt? Frankly, I don't know what it's for but all sounds are defined in ubersound/ubersound.scr and ubersound/uberdialog.scr files; both in pak0.pk3. There the aliascache command is explained quite thuroughtly. But not everything and some things not completely.
Posted: Mon Mar 30, 2009 12:56 am
by sdlall
Yes was talking about aliascach. Didnt seem to work for me. Yeah I also found levelwide in alarm.scr. Anyways sounds good might make adjustment on volume some complaining about to loud. Porbably is with headphones on. Until Next Time...
Posted: Mon Mar 30, 2009 11:03 am
by $oldier Of Ra
Code: Select all
aliascache <your_alias> <snd/path.wav> soundparms <BaseVolume> <RandVolume> <BasePitch> <randPitch> <minDist> <maxDist <Channel> loaded maps <"mapstring1 mapstring2... ">
Whereas mapstring can contain the name of your map(s) (= the bsp name without .bsp) or 'wildcard(s)' like "m" -> the sound will be loaded for all maps whose mapname starts with m. I think you get the picture.
The volume you choose when you cache will 'become' the 1.0 volume (ie the default volume) for your soundalias. So imagine you cached your sound with maxvolume 0.5. If in the loopsound command you place 1.0 as the volume (which is the default by the way) then the sound will be as loud as 0.5.
I don't think you need to know when to use streamed instead of loaded and when to use the alias command instead of the aliascache command.