some questions

Post your scripting questions / solutions here

Moderator: Moderators

Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

some questions

Post by Barttje »

hi all

im making an map but i want on a trigger a sound (mohaa/main/mechanics/Mec_Alarm_10.wav) that if you press the use key this sound will play...
And how do i say that if you use the trigger then you must wait 120 seconds and then you can use it again...
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post by At0miC »

Make in your map a trigger:

make a brush with the green trigger texture (under textures/common).
Hit N and give it a key: classname and value: trigger_use and also key: targetname and value: trigger

Now you got the trigger in your map.

You also need a speaker somewhere from wheere the sound is coming:
Rightclick > sound/speaker, and hit N and give it a key: targetname and value: speaker.


In your .scr file:

Under main:

local.master aliascache alarm sound/mechanics/Mec_Alarm_10.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps "m dm moh obj "

and

thread alarmtrigger

-------

alarmtrigger:

$trigger waittill trigger // when u hit 'use'at the trigger, the script will start
$speaker playsound alarm // the speaker will play the sound, "alarm" is the link to local.master aliascache (see above)
wait 120
thread alarmtrigger

end

-------

This should work fine, you can change the targetnames or threadname etc ofcourse. Also you might have to change the value's of the soundparms, it depends in what you want. Anyway, the speaker can also be something else, like the trigger itself ($trigger playsound alarm) so it doesn't have to be a speaker model.
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

?

Post by Barttje »

what does 1.0 0.0 1.0 0.0 1024 6000 means in
local.master aliascache alarm sound/mechanics/Mec_Alarm_10.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps???
User avatar
Cobra
Colour Sergeant
Posts: 93
Joined: Sun Jul 17, 2005 9:22 am
Location: The Netherlands
Contact:

Post by Cobra »

Soundparms are for BaseVolume, RandVolume, BasePitch, randPitch, minDist , maxDist , Channel codes etc.
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post by At0miC »

It's all explained here:
http://dynamic.gamespy.com/%7Emap/mohaa/t.php?id=11

I forgot to say u also need to put "local.master = spawn ScriptMaster" above:
local.master aliascache alarm sound/mechanics/Mec_Alarm_10.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps "m dm moh obj "
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

my trigger still doesn't work.... :cry: :?:
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Trigger can't play sound, use something that has a TIKI model.
Image
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

can you say me how by a radio...?
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post by At0miC »

Give the model a key: targetname and a value: speaker (or whatever you want)

then in the script (see above):
$speaker playsound alarm

Trigger can't play sound
It is possible to use brushes as a speaker, I've done it myself once =)
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

can you say me how to place a sound on a object...?

like

by a phone rings the phone sound....
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

???
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

In Radiant,
-make a speaker entity near the phone: (Rightclick -> sound > speaker),
-press N and set a targetname of phone_speaker (or anything you like).

key: targetname
value: phone_speaker


In your script file,
under 'main' write the next (only the yellow parts):

----------
main:

local.master = spawn ScriptMaster
local.master aliascache telephone sound/mechanics/Mec_PhoneRing_01.wav soundparms 1.0 0.0 1.0 0.0 200 1200 auto loaded maps "m dm moh obj "
//this is for the phone sound
local.master aliascache alarm sound/mechanics/Mec_Alarm_10.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps "m dm moh obj "" //this is for the alarm sound

level waittill prespawn
exec global/DMprecache.scr
level.script=maps/dm/yourmapname.scr

level waittill spawn

wait 1
$phone_speaker loopsound telephone


end
----------


Extra info:
To make sounds work in mohaa you first need to know which sounds will work in custom maps and which won't. Most of the cool sounds only work in the Singleplayer maps because of the Ubersound.scr. Okay, let's say you're looking in Pak3.pk3 and you find a cool sound. Write down the name of the .wav file. For example Mec_PhoneRing_01.wav

Now open Pak0.pk3 and look for the file ubersound.scr and extract it. (it can be found in the Ubersound/ directory)
The next step is important. Once you have opened the ubersound.scr (in Wordpad), press Ctrl+f to get a searchwindow; type the name of the wav and Search. I searched for Mec_PhoneRing_01.wav

Wordpad found this line in the Ubersound script:

local.master aliascache telephone sound/mechanics/Mec_PhoneRing_01.wav soundparms 1.0 0.0 1.0 0.0 200 1200 auto loaded maps "m1l2b "

This means that the phone sound only works in the map m1l2b.
But if you look for a sound and you see something like this -> "dm moh obj train" at the end, then the sound will work in your DM map.

Now, because you want to use that telephone sound which only works in m1l2b, you need to make a new alias (the yellow parts) for the sound in your own script file.
----------
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

tanks, but it still doens't work... :cry:
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post by At0miC »

-make a speaker entity near the phone: (Rightclick -> sound > speaker),
-press N and set a targetname of phone_speaker (or anything you like).
Be sure the speaker has to be highlighted before you hit N.

Anyway, can we see your .scr file?
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

i'm writing in notepad. i don't get:

In Radiant,
-make a speaker entity near the phone: (Rightclick -> sound > speaker),
-press N and set a targetname of phone_speaker (or anything you like).


what are you talking about.... :?
Post Reply