How to make a Alarm

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

i havnt really mastered speakers yet either but, instead if saying

Code: Select all

$speaker loopsound alarm
would it have to be

Code: Select all

$speaker loopsound Mec_Alarm_03
and again, i havnt mastered this but am i right?
Image
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

he had a sound he called at the top.u can give them nick names
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

that line was an ubersound (means oversound in German... hmmz...) alias, means he just made Mec_Alarm_2 be alarm. if he so wishes.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

ravage wrote: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
You can't turn a speaker into a static alarmbell model. Make them two seperate things, one alarmbell model and one (invisible) speaker.
First add the static/alarmbell model and leave out the targetname.
Then make a new "script_model" close to the alarmbell model and give it:
Key: model
Value: fx/dummy.tik
and
Key: targetname
Value: speaker
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

i use script origins for my speakers.but u can also call sounds from a trigger,so most of the time i dont need a speaker.
on my alarm i got a switch/targetname alarm_switch.
then i got a fx/dummy.tik for my light targetname light.
then i put a cage light near the dummy.tik.
then put a trigger around the switch /targetname alarm_switch_trigger.

Code: Select all

level waittill spawn

end

//alert_switch---------------------------------------------------------------------

alert_switch:

            $alarm_switch_trigger triggerable
            $alarm_switch_trigger waittill trigger
            $alarm_switch anim turn
            $alarm_switch_trigger playsound alarm_switch
            $alarm_switch_trigger loopsound alarmbell//i have an alias cache
            $alarm_switch_trigger nottriggerable
            wait .5
            goto lighton

end

lighton:
            $light light 0 0 1 706
            wait .5
            goto turnoffswitch

end

turnoffswitch:

            $alert_switch_trigger triggerable
            $alert_switch_trigger waittill trigger
            $alert_switch anim off
            $alert_switch_trigger playsound alarm_switch
            $alarm_switch_trigger stop loopsound
            $alert_switch_trigger nottriggerable
            wait .5
            $light light 0 0 0 24
            goto alert_switch

end
works great :wink:
Image
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post by ravage »

i test later thnx for info all
ravage
Lance Corporal
Posts: 10
Joined: Sat Dec 18, 2004 5:22 pm

Post by ravage »

can u post the full script completed??


somone mail it to Futuresily@hotmail.com plz *thnx*
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

ok,i will even send the .map and a pk3 with everything included 8-)
Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

panTera wrote:
ravage wrote: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
You can't turn a speaker into a static alarmbell model. Make them two seperate things, one alarmbell model and one (invisible) speaker.
First add the static/alarmbell model and leave out the targetname.
Then make a new "script_model" close to the alarmbell model and give it:
Key: model
Value: fx/dummy.tik
and
Key: targetname
Value: speaker
whay cant we just make anything loopsound? why do we ALWAYS have to use an fx/dummy.tik script model????
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

here is the code..it works great,except i couldnt get the sound to loop,never messed with sound too much.

Code: Select all

// 
// ARCHITECTURE: Green Beret
// SCRIPTING: Green Beret

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "alarm"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" " Run"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "NONE"


        local.master = spawn ScriptMaster
        local.master aliascache alarmbell sound/mechanics/Mec_Alarm_07.wav soundparms 1.2 0.0 1.0 0.0 300 12000 item loaded maps "m dm moh obj "

        level waittill prespawn

        thread alert_switch
        $alarm_switch angles 0 180 0

	//*** Precache Dm Stuff
        level.script = maps/dm/alarm_tut.scr//your map name

        level waittill spawn


end

//alert_switch---------------------------------------------------------------

alert_switch:

            $alarm_switch_trigger triggerable
            $alarm_switch_trigger waittill trigger
            $alarm_switch anim turnon
            $alarm_switch_trigger playsound alarm_switch
            $alarm_switch_trigger playsound alarmbell
            $alarm_switch_trigger nottriggerable
            wait .5
            goto lighton

end

lighton:
            $light light 1 0 0 706
            wait .5
            goto turnoffswitch

end

turnoffswitch:

            $alarm_switch_trigger triggerable
            $alarm_switch_trigger waittill trigger
            $alarm_switch anim turnoff
            $alarm_switch_trigger playsound alarm_switch
            $alarm_switch_trigger stopsound alarmbell
            $alarm_switch_trigger nottriggerable
            wait .5
            $light light 0 0 0 24
            goto alert_switch

end
download the pk3 here the .map is in the .pk3
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

to make it complete, here's a pk3 with working loopsound and a little corona added to the light.

I think, u can't add 2 sounds to one entity, so I added another script_model which does the job.
This is the script:

Code: Select all

main:
        local.master = spawn ScriptMaster
        local.master aliascache alarm1 sound/mechanics/Mec_Alarm_07.wav soundparms 1.2 0.0 1.0 0.0 300 12000 auto loaded maps "dm obj"
	
	    level waittill prespawn
		$alarmcorona hide
        thread alert_switch        

	//*** Precache Dm Stuff
        level.script = maps/dm/alarm_tut.scr

        level waittill spawn
end


alert_switch:
while (1)
{
            $alarm_switch_trigger triggerable
//-------------------waiting---------------------------------- 
            $alarm_switch_trigger waittill trigger
            $alarm_switch anim turnon
            $alarm_switch_trigger playsound alarm_switch
            $alarm_switch_trigger nottriggerable
            $light light 1 0 0 100
            $alarmcorona show
            $alarmbell loopsound alarm1
            $alarm_switch_trigger triggerable
//-------------------waiting----------------------------------           
            $alarm_switch_trigger waittill trigger
            $alarmbell stoploopsound
            $alarm_switch anim turnoff
            $alarm_switch_trigger playsound alarm_switch
            $alarm_switch_trigger nottriggerable
            $light light 0 0 0 24
            $alarmcorona hide
}
end
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

for some reason when i used the loopsound command,my sound wouldnt play,till i made it playsound.

thnx for the loopsound wacko :wink:

i updated my pk3 and added the loop sound and carona.

http://wolfbattalion.com/alarm_tut.pk3

enjoy :wink:
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

my loopsounds wont work... and i dont feel like posting the long script... but the sounds i have are from pak3 : veh_jeep_on ; veh_jeep_idle ; veh_jeep_move ; veh_jeep_off ; horn. they are all .wav's i found in pak3 that go very well to what i want.... and i also have lighthouse_run ; item_timer_01 ; final_countdown but those 3 sounds work... i have some debugging to do with the actual movements of the thing im making so maybe ill uncover something ive missed several times?

the sounds in red dont work for some reason...

thread_name:
$bot loopsound veh_jeep_on
wait 1
$bot loopsound veh_jeep_idle
wait 1
$bot stoploopsound
$bot loopsound veh_jeep_move
$bot do some stuff
$bot stoploopsound
$bot loopsound veh_jeep_idle
wait 1
$arm loopsound lighthouse_run
$arm rotateX 45
wait 1
$arm rotateX -90
wait 2
$arm rotateX 45
wait 1
$arm rotateX 0
$arm stoploopound

end

theres more to this script but you get the basic idea.
most of the stuff that i want to move and that i have scripted work except for some minor things.
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

dont think the problem is the sound, rather $bot which cant do a loopsound... :?
try to change the sounds veh_jeep_on and so on to lighthouse_run and see whether this works. prob not.
u could also try to change $bot to $arm in the loopsound lines and check this.
maybe bind a speaker to ur bot and let it do the sounds?!
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

well $bot isnt actually an AI bot. its stands for robot.... bot just sounds a little less childish that robot... lol.
Image
Post Reply