Trigger starts a pulsating (red) light ?

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

Post by Cigs »

Woohoo,

great, man. thanks alot
It works fine now :)

with an radius off 100
only works when triggered ! :)
10 seconds long, nice and slowly

-

Now if only a click sound could be heard each time it goes on and off
do you know a way it could possibly do that too ?

And can it be made likeso the trigger only works on Allied touching it?


And if it could work together with the corona_red.tik ... it would be the best result.
but I guess I'm gonna try some more.
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

omg!

Post by Cigs »

OMG,

It works like a charm! ^^
bdbodger... you will always be mentioned in my scriptfiles! :wink:
:!:


This is how it's set up: little is changed:

-
placed static_lamp_lightbulb_caged_red against the wall
placed script_model infront of it
placed static_corona_orange (changed its model and classname values)
-

:arrow: script_model:

key: targetname
value: pulslight

key: model
value: fx/dummy.tik



:arrow: static_corona_orange:
(changed classname to staic_corona_red)(changed model/fx/corona_red.tik)

key: targetname
value: pulslight_corona



:arrow: trigger_once:
(same as trigger_multiple and is ofcourse set to trigger only once)

key: setthread
value: trigger_pulslight

key: delay
value: 5

key: message
value: An intruder is entering the back of the bunker!



:arrow: pulslight.scr:

Code: Select all

// MAPNAME: pulslight (testmap)
// ARCHITECTURE: Cigs 
// SCRIPTING: bdbodger (also Krane) !thx alot!

main: 

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

setcvar "g_scoreboardpic" "" 


level waitTill prespawn 


//*** Precache Dm Stuff 
exec global/DMprecache.scr 


level.script = maps/dm/pulslight.scr 


// prep 
  
$pulslight light(1 0 0) 
$pulslight lightRadius 100 // CONTROL THE RADIUS OF THE LIGHT 
$pulslight notsolid 
$pulslight lightoff 

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
   $pulslight_corona[local.c] hide

level waittill spawn 


end 

//--------------------------------------------------------------

trigger_pulslight: 

if !(level.pulseing == 1) // allows only one thread to run 
{ 
   level.pulseing = 1 

   local.timer = 0 

   while(local.timer < 10) 
   { 

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
   $pulslight_corona[local.c] show

   for(local.c = 1;local.c <= $pulslight.size;local.c++) 
   $pulslight[local.c] lighton 

   wait .5 

   for(local.c = 1;local.c <= $pulslight.size;local.c++) 
   $pulslight[local.c] lightoff 

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
   $pulslight_corona[local.c] hide

   wait .5 

   local.timer++ 
   } 
level.pulseing = 0 
} 

end 
==============================================================================================

Now just

? a (relais-)sound going click, click, click ...
? and how ... trigger only works for Allied/Axis !?

:?: :)
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

try putting this at the top of you script for the sound

local.master = spawn scriptmaster

local.master aliascache myalarm sound/mechanics/Mec_Alarm_05.wav soundparms 0.3 0.0 1.0 0.0 900 20000 item loaded maps "dm obj"


then change the thread like this

Code: Select all

trigger_pulslight:

if( !(level.pulseing == 1) && (parm.other.dmteam == "axis")) // allows only one thread to run
{
   level.pulseing = 1

   local.timer = 0

   while(local.timer < 10)
   {

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++)
   $pulslight_corona[local.c] show

   for(local.c = 1;local.c <= $pulslight.size;local.c++)
   {
   $pulslight[local.c] lighton
   $pulslight[local.c] playsound myalarm
   }

   wait .5

   for(local.c = 1;local.c <= $pulslight.size;local.c++)
   $pulslight[local.c] lightoff

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++)
   $pulslight_corona[local.c] hide

   wait .5

   local.timer++
   }
level.pulseing = 0
}

end
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

this should of work instantly... !!!

Post by Cigs »

...well it kinda did!
8-)

at first it didn't work ... but i saw there was alittle mistake in the beginning of the script:
if !((level.pulseing == 1) && (parm.other.dmteam == "axis"))

... so it works.
:roll:
but there r 2 things


it seems i can't use a trigger_once, since that will only work once & never again! -:(-
so I use trigger_multiple again. this trigger is placed halfway a ladder. but when i climb the ladder, touching the trigger, ... it is touched like 6 times or more or so ... wich makes the thread execute to thatmany times.

-
:idea: maybe 2 trigger_multiple's can be place; (1 at the bottom & 1 at the top off the ladder)
can you write an expr or condition ...in the script... to make sure 2 triggers have to be touched in order to trigger the pulslight & sound ? :D
-

sound doesn't work on first load of the map:
when I go test the trigger, the sound doesn't go off!
when I type restart in console and go try again, the sound works!
each and every time.
( but don't forget it plays 6 times at the same time or so)

i tried killingmyself/spawning, but nope.. it needs a "restart" to let the sound go off when triggered



I also learn a bit about vis_leafgroups :)

i compiled with this ("+set developer 1 +set thereisnomonkey 1 +set cheats 1 +set ui_console 1") commandline

when i try to set r_showtris "2" , while cheats is 1, the console says r_showtris is a cheatprotected :!:


:x :?:

k, thx for listening :P
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Where did you add the scriptmaster part in the script ?

level.pulseing = 1 keeps the thread from running more than one thread at a time now since this thread is run useing setthread then instead of that put

self nottriggerable

then at the end instead of useing level.pulseing = 0 use

wait 10
self triggerable
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

Post by Cigs »

!! Great Job So Far !!

:D :D :D :D :D :D :D
:lol:

you said
try putting this at the top of you script for the sound

local.master = spawn scriptmaster

local.master aliascache myalarm sound/mechanics/Mec_Alarm_05.wav soundparms 0.3 0.0 1.0 0.0 900 20000 item loaded maps "dm obj"


then change the thread like this
Code:
i gues I finally managed to do that now :oops: :)

But it works fine for Axis now: :D

just the way ..it should be..

Code: Select all

// MAPNAME: pulslight 
// ARCHITECTURE: Cigs 
// SCRIPTING: bdbodger (also Krane) :) 

main: 

local.master = spawn scriptmaster 

local.master aliascache myalarm sound/mechanics/Mec_Alarm_05.wav soundparms 0.3 0.0 1.0 0.0 900 20000 item loaded maps "dm obj" 

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

setcvar "g_scoreboardpic" "" 


level waitTill prespawn 

//*** Precache Dm Stuff 
exec global/DMprecache.scr 

level.script = maps/dm/pulslight.scr 


// prep 
  
$pulslight light(1 0 0) 
$pulslight lightRadius 100 // CONTROL THE RADIUS OF THE LIGHT 
$pulslight notsolid 
$pulslight lightoff 

for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
$pulslight_corona[local.c] hide 

level waittill spawn 


end 

//--------------------------------------------------------------

trigger_pulslight: 

if !((level.pulseing == 1) && (parm.other.dmteam == "axis")) // allows only one thread to run 
{ 
   level.pulseing = 1 

   self nottriggerable 

   local.timer = 0 

   while(local.timer < 8) 
   { 

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
   $pulslight_corona[local.c] show 

   for(local.c = 1;local.c <= $pulslight.size;local.c++) 
   { 
   $pulslight[local.c] lighton 
   $pulslight[local.c] playsound myalarm 
   } 

   wait .5 

   for(local.c = 1;local.c <= $pulslight.size;local.c++) 
   $pulslight[local.c] lightoff 

   for(local.c = 1;local.c <= $pulslight_corona.size;local.c++) 
   $pulslight_corona[local.c] hide 

   wait .5 

   local.timer++ 
   } 
level.pulseing = 0 

wait 5 

self triggerable 

} 

end 



so the trigger & pulslight & alarmsound all work fine together when an Axis triggers it

good job ( & I get it too! :) I read the "Adding Custom sounds :: jv_map" tut )


...though it go's off for alied too... but NOT in the bad way (the thread runs one time :] because i place this (*) under the thread! ) ... BUT it should just be nottriggrable for allied at all times !!

:?:

-
i tried placing this (*) under the first"if !()"

Code: Select all

trigger_pulslight:

if !()
{
   ...
}

if !((level.pulseing == 1) && (parm.other.dmteam == "allied")) // allows only one thread to run 
{ 
   level.pulseing = 1 

   self nottriggerable 

   wait 2

   self triggerable

   level.pulseing = 0 
}

end
:)
so it never runs 6 times in a row anymore :)
again it shouldn't be activated when dmteam allied touch,,, ?
-



now there's a secondthing allready in my mind too :/

the sound will probably be heard ALL over the map
hmm
I read how to target a vis_leafgroup (where a speaker is in) so that "speakers" aren't heard in the area the targetting vis_leafgroup secludes.

like this:

1 vis_leaffgroup arround the "sound_model" (don't know what's use as sound entities!) :oops: with targetname/speakervis

all the places the sound shouldn't be heard should have vis_leafgroups that have a tartget/speakervis
1 vis

... but can it be done here ? & what about the local.master = spawn scriptmaster then?

i dno


thanks for helping out sofar
it has allready been great :!: :P
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well the ! means not and it belongs inside the first bracket

if (!(level.pulseing == 1) && (parm.other.dmteam == "axis"))

means this

if (not(level.pulseing == 1) && (parm.other.dmteam == "axis"))

if you put it outside the bracket then it means if not everything in the bracket is true in other words if everything if the brackets is false then do the stuff when what you want is if not( level.pulseing == 1) in other words if level.pulseing is 1 don't do the stuff anything else and you can do the stuff but the && (parm.other.dmteam == "axis") means , and the guy who tripped the trigger is an axis player . So if level.pulseing is not 1 and the guy is axis then the thread runs .
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

message command in script?

Post by Cigs »

k, works like a charm :)

only axis CAN trigger it! allied CAN'T !!

I removed the message/An enemy is entering the back off the bunker from the trigger_multiples properties.
because this messages also printed when allied triggered it :s
i like to have it in the script...

i thought like this

Code: Select all

if (!(level.pulseing == 1) && (parm.other.dmteam == "allied"))  // allows only one thread to run 
{ 
   level.pulseing = 1 

   local.timer = 0 

   $pulslight message An enemy is entering the back off the bunker

   ...
but not! :?

it actually didn't work AT ALL annymore :s
so i removed it

hmm? (ofcourse im looking for it too : ] )

tried println "Allied Alert! - an enemy is using shaft to enter!",
but no printing to be spotted
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

Post by Cigs »

cool, found it myself then :idea: :lol:

self message "Allied Alert! - an enemy is using shaft to enter!"

did the trick 8-)



2 more things ...

?

i still always have to type "restart" in console in order for it to work on the map :o

like this

map dm/lightpuls
i try it ... lights puls, message prints, NO SOUND!
restart
i try it ... lights puls, message prints, SOUND!

?

how to set the ambient radius?
is it the [mindist] & [maxdist] that set the range in wich we heard the sound ?
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Look in the ubersounds.scr it will tell you about the settings . Also you can use

$pulslight[local.c] playsound myalarm 2 "levelwide"

the 2 is 2x normal volume
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

Post by Cigs »

im will test how and where it sounds when I first compile my map (fast)
i just don't wan't it to be heard everywhere. just where it goes off.hope the sound fades the more you go away from it :lol:
it may be heard everywhere, but NOT equally loud everywhere (i presume that won't be the matter -> dummy.tik)
so I don't know if I wanna double the sound :?
but thx for the TiP ! :)

PS: is global/dmdog.scr in pak0.pk3 ? i didn't find it

-
I also had a look on your homepage a I'm tinking of trying to inport the DMDOGS.SCR :D
if it's easy to be done, i ll try it. but I won't ask you to help me with it if I can't do it ! you helped me soo much :) and bacause of that I was able to understand jv_map's scripting tut ! (VERY NICE!)
:D :D :D :D You Guys Rock!
i was wondering if the dogs guard or if they just spawn n sit there ? can they quard an area you map them to guard ?
if yes, I try it out. (just the origin stuff i gt figure out - prob. easy)
-

also I could read in the console I shoud make a *_precache.scr map script
& put following tik models innit.....
i did. named it pulslight_precache.scr
but does it load automaticly?? :?: or does there have to be a line in the mapname.scr executing it? how?

kk 8-)
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

if your map name is pulselight then name the precache pulselight_precache.scr and it will load automatically just use your mapname .
If you have pathnodes in your map then don't bother with the dmdog.scr that is for stockmaps that have no pathnodes . Also when I wrote that I didn't know how to make a .pth file for stock maps so that was the best solution at the time . If you want to have dogs just make pathnodes all over your map or in areas that you want the dogs to be able to go and put some dogs in your map . I think the max distance for the pathnodes from each other is about 360 units or so . If you want american dogs just do $dogtargetname american in your script . For that to work you have to do a thread like this to also make the players either german or american .

player_teams:

while (1)
{
for (local.playtm=1;local.playtm <= $player.size;local.playtm++)
{
if ($player[local.playtm].dmteam == axis)
$player[local.playtm] german
$player[local.playtm] threatbias 1000

if ($player[local.playtm].dmteam == allies)
$player[local.playtm] american
$player[local.playtm] threatbias 1000

if ($player[local.playtm].dmteam == "spectator")
$player[local.playtm] threatbias ignoreme
}
waitframe
}
end
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

Post by Cigs »

aaah :)

I about get it. The script was made to get dogs in stockmaps, eventhough the map wasn't compiled with pathnodes, dogs can still be spawned in there !
guess people must love you for it! isn't it?

So, me, I can compile it with pathnodes :) right!?
just a dog guarding main entrance,,,one guarding the 'garden'

I gues I just have to

1)
targetname & target the pathnodes (like ViS blocks are targeted)
& add dog close enough to pathnodes

:?: the dogs don't have to be "linked" to those pathnodes. do they. just stand close to them (max 360 units) ?

2)
dmdog.scr in global folder: global/dmdog.scr
dog_killed.scr in anim folder: anim/dog_killed.scr
( dog_pain.scr in anim folder: anim/dog_pain.scr <- ? CAN'T find this script ?!)



like this:

Code: Select all

	level waittill spawn

exec global/dmdog.scr 

// thread player_teams // NOT this because it's executed from global/dmdog.scr // I guess !!

end 
maybe you meant I can do this much easier that this way (not using dmdog.scr)
just running player_team thread ? :oops:
tell me, cause I like the threads in that script :)
and ofcourse all sounds are cached init :)

Tell me, don't botter with dmdog.scr !

for now, I'm gonna try this out...
...and then how you inplied !
Image
TS217.172.173.37:9095
Spearhead SDK Q's
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

yes just put lots of pathnodes into the map thats all and if you make one of the dogs american like I said then you can run the teams script or make a normal dog and run the team script the normal dogs attack americans so if you run the teams thread then they will only attack allies players not all players . The anim/dog_pain.scr is a stock mohaa script . the dog_killed.scr was a fix I added that someone made to stop maps with dogs from crashing when the dog died . You don't need to link the dogs to anything . If you use the dmdog.scr for stock maps the sounds don't work the players will have to have a sound fix . For your map you can add a sound fix . one way is to precache a tik with the sounds in it . Like the one here
Image
User avatar
Cigs
Colour Sergeant
Posts: 90
Joined: Fri May 28, 2004 1:04 pm
Location: Gent - BELGIUM

everything works - how spawn them ? (randomly ?)

Post by Cigs »

You probably know all off this out off your head and dealth with this many times
? ...

guess so :)

so i wrote How It's Set Up for people who also like to try putting dogs in.

Allies Dog - Axis Dog ::: How It's Set Up ::: This script works thanks to bdbodger.

mapname: alliesaxisdogs

:arrow: ai_german_hund_dog-real (axis dog eating allies'asses raw!)

key: targetname
value: axis_dog


:arrow: ai_german_hund_dog-real (allies dog eating axis'asses raw!)

key: targetname
value: allies_dog


:arrow: ofcourse info_pathnodes on the ground - with max. 360 units distance between them


alliesaxisdogs.scr

Code: Select all

// ALLIESAXISDOGS
// ARCHITECTURE: CIGS 
// SCRIPTING: BDBODGER, 

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" "" // your score board picture 

	
	//*** Precache Dm Stuff 
	exec global/DMprecache.scr 

	// level.script = maps/dm/mapname.scr //remember to put in your map name
	level.script = maps/dm/.scr 

	// exec global/door_locked.scr // trigger_use: targetname/door_locked | setthread/lock | type/wood | message/This door is locked!
	exec global/door_locked.scr 

	// exec global/ambient.scr stockmapname ; may want to make your own ambient sounds, read the tut
	exec global/ambient.scr 



level waittill prespawn ///////////////////////********************************** 




	//add more codes here after you add more features to your maps

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	// prep

	$axis_dog german 
	$allies_dog american 
	$axis_dog health 275
	$allies_dog health 275




level waittill spawn ///////////////////////**************************************

	thread player_teams	

end 

//-----------------------------------------------------------------------------

player_teams: 

while (1) 
{ 
for (local.playtm=1;local.playtm <= $player.size;local.playtm++) 
{ 
if ($player[local.playtm].dmteam == axis) 
$player[local.playtm] german 
$player[local.playtm] threatbias 1000 

if ($player[local.playtm].dmteam == allies) 
$player[local.playtm] american 
$player[local.playtm] threatbias 1000 

if ($player[local.playtm].dmteam == "spectator") 
$player[local.playtm] threatbias ignoreme 
} 
waitframe 
} 
end
 

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end 

alliesaxisdogs_precache.scr
(without caching this TIKI file dog sounds aren't heard)

Code: Select all

exec global/DMprecache.scr
cache models/fx/dogsounds.tik



I just need to spawn the dogs each 30 secs, randomly would be nice to (but not more then 60 secs)
i think I'll manage

:P Thank u for the help, bdbodger
could never off done this without you! :)
Image
TS217.172.173.37:9095
Spearhead SDK Q's
Post Reply