How to make a Alarm

Post your scripting questions / solutions here

Moderator: Moderators

ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

How to make a Alarm

Post 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 ? :roll:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Re: How to make a Alarm

Post 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>
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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
Image
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post 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:

Code: Select all

$speaker loopsound alarm
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post 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 ?
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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 :wink:
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

level.script is sorta not needed, i think. if it's reading the script it knows where it is.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post by ravage »

:cry: :cry: :cry: :cry: 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 :roll:

and i got 2 errors:

cant find models/static/alarmbell.mao
couldn't read c:/mygame~1/main/maps/dm/alarmbell.prt
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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.
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post 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?! :)
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post 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?
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post by ravage »

what i must put on my alarm (trigger_use) i got only targetname alarmtrigger i think thats the problem or not? :roll:
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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 :wink:
GreenBeret@wolfbattalion.com
Image
Carnivora
Lance Corporal
Posts: 10
Joined: Sun Nov 07, 2004 5:20 am

Post 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?
Post Reply