Page 1 of 4
How to make a Alarm
Posted: Sun Jan 02, 2005 6:59 pm
by ravage
how to make a alarm ?? i got a check and there in a switch and i got a alarm placed on the wall. if i press on the switch nothing happening i use:
// mymap
// ARCHITECTURE:
// SCRIPTING:
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""
end
local.master = spawn ScriptMaster
local.master aliascache train_whistle sound/mechanics/Mec_Alarm_03.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps "m dm moh obj "
level waittill spawn
thread alarmthread
alarmthread:
$alarmtrigger waittill trigger
$speaker loopsound alarm
$alarmtrigger waittill trigger
$speaker stoploopsound
thread alarmthread
end
sombody plz help ?

Re: How to make a Alarm
Posted: Sun Jan 02, 2005 7:43 pm
by Rookie One.pl
ravage wrote:local.master aliascache train_whistle sound/mechanics/Mec_Alarm_03.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded maps "m dm moh obj "
What train_whistle??? Apart from that, looks OK.
<EDIT>I don't like this 'nested' thread loop. Try a while loop instead:
Code: Select all
alarmthread:
while(1) {
$alarmtrigger waittill trigger
$speaker loopsound alarm
$alarmtrigger waittill trigger
$speaker stoploopsound
end
}
</EDIT>
Posted: Sun Jan 02, 2005 8:49 pm
by Green Beret
Hows this?
Code: Select all
// mymap
// ARCHITECTURE:
// SCRIPTING:
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""
level waittill prespawn
thread alarmthread
exec global/DMprecache.scr
local.master = spawn ScriptMaster
local.master aliascache train_whistle sound/mechanics/Mec_Alarm_03.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded
maps "m dm moh obj "
level waittill spawn
end
alarmthread:
$alarmtrigger waittill trigger
$speaker loopsound train_whistle
wait 1
$alarmtrigger waittill trigger
$speaker stoploopsound
goto alarmthread
end
Posted: Sun Jan 02, 2005 9:13 pm
by At0miC
It should be:
Code: Select all
local.master aliascache alarm sound/mechanics/Mec_Alarm_03.wav soundparms 1.0 0.0 1.0
and you can change it back to:
Posted: Mon Jan 03, 2005 1:48 pm
by ravage
it still doesnt work...
i got a alarm switch and a trigger_use
on the trigger_use i got :
classname trigger_use
targetname alarmtrigger
on my speaker i got :
classname static_miscobj_alarmbell
model static/alarmbell.tik
origin 8.00 48.00 80.00
scale 1.0
targetname speaker
testanim idle
and i use :
// 1234
// ARCHITECTURE:
// SCRIPTING:
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""
level waittill prespawn
thread alarmthread
exec global/1234.scr
local.master aliascache alarm sound/mechanics/Mec_Alarm_03.wav
soundparms 1.0 0.0 1.0 1024 6000 auto loaded
maps "dm moh obj "
level waittill spawn
end
alarmthread:
$alarmtrigger waittill trigger
$speaker loopsound alarm
wait 1
$alarmtrigger waittill trigger
$speaker stoploopsound
goto alarmthread
end
if i press e on the switch nothing happens ... i hear no sound i dont know what i did wrong sombody plz look ?
Posted: Mon Jan 03, 2005 5:23 pm
by Green Beret
your missing this line.put it after
waittill prespawn
level.script = maps/dm/mapname.scr
make sure your .scr and the .bsp(mapname)are the same
like
level.script = maps/dm/mymap.scr
and when u save your map,save it as
mymap
so the BSP and the SCR are named the same

Posted: Mon Jan 03, 2005 6:24 pm
by lizardkid
level.script is sorta not needed, i think. if it's reading the script it knows where it is.
Posted: Mon Jan 03, 2005 6:36 pm
by ravage

it still doenst work what i do wrong???
i choosed the alarm switch i put by that a trigger in it and gave them the things and the script... can someone test the script or ??? if i press e the switch doesnt animate and i hear no sound
and i got 2 errors:
cant find models/static/alarmbell.mao
couldn't read c:/mygame~1/main/maps/dm/alarmbell.prt
Posted: Mon Jan 03, 2005 7:02 pm
by Green Beret
check your paths and make sure they are correct.
like make sure the .scr is in the maps/dm folder(if TDM)
Code: Select all
// mymap
// ARCHITECTURE:
// SCRIPTING:
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""
level waittill prespawn
thread alarmthread
exec global/DMprecache.scr
local.master = spawn ScriptMaster
local.master aliascache train_whistle sound/mechanics/Mec_Alarm_03.wav soundparms 1.0 0.0 1.0 0.0 1024 6000 auto loaded
maps "m dm moh obj "
level waittill spawn
end
alarmthread:
$alarmtrigger triggerable
$alarmtrigger waittill trigger
$speaker anim start//or turn
$speaker loopsound train_whistle
$alarmtrigger nottriggerable
wait 1
goto alarm_off
end
alarm_off:
$alarmtrigger triggerable
$alarmtrigger waittill trigger
$speaker anim stop//or off
$speaker stoploopsound
$alarmtrigger nottriggerable
wait 1
goto alarmthread
end
this is what worked for me,but i still couldnt get the switch to flip up and down,but it did make a sound.
make sure your speaker is a script_object.
to do this,drag out a brush,just a small square.
right click on it,and go to script>object.
next hit N on keyboard and type in the
key model
value static/alarmbell.tik
give it the targetname of speaker,and you should be all set.
Posted: Mon Jan 03, 2005 7:49 pm
by wacko
to solve this, it might be faster to pack the whole stuff (map, bsp, scr) into a pk3 and give us a link?!

Posted: Mon Jan 03, 2005 8:20 pm
by ravage
Green berret i added u on msn mabey u can send the file 2 me ??
what i must put on my trigger_use by my switch then ?? i got only there targetname alarmtrigger is that ok?
Posted: Mon Jan 03, 2005 10:02 pm
by lizardkid
well it doesnt animate because there's no line in it to tell it to.
you know, go
here. its the tut to do alarms. it's for SP so you can cut out the SP parts pretty much.
Posted: Tue Jan 04, 2005 8:45 am
by ravage
what i must put on my alarm (trigger_use) i got only targetname alarmtrigger i think thats the problem or not?

Posted: Tue Jan 04, 2005 11:15 am
by Green Beret
is there anyway you can send or post a link to the pk3,or the .map file and .scr file.
i can look at it fix it and send it back
GreenBeret@wolfbattalion.com
Posted: Tue Jan 04, 2005 11:39 am
by Carnivora
Hi,
Has anyone else tested your map? Can they hear the sounds? I had the same problem once in my map, I couldn`t hear explosions but everyone else could. I still don`t know where the problem was?