Page 2 of 2

test

Posted: Tue Dec 16, 2003 7:02 am
by tltrude
WarTech - Can you make a small test map that shows this method and post it? It would only have to be a small room with a door and a skybox. It would also need an info_player_start and two spawn points.

Re: sounds interior and exterior

Posted: Tue Dec 16, 2003 7:56 am
by jv_map
Gold wrote:(...) both me and my son hear the sounds differently within the map according to our location,,meaning we hear indoor sounds indoors and outdoor sounds outdoors,,,in multiplayer lol,also by adding the ambience and ambient scripts it brought all the sounds back to life within the map,,if ya simply take a look see into the above scripts ya can see why this would work,,hope this helps
Show me ;)

Relevant parts from global/ambient.scr:

Code: Select all

interior:
	while (1)
	{
		self waittill trigger
		level.current_music = ("int" + self.set)
	}
end

exterior:
	while (1)
	{
		self waittill trigger
		level.current_music = ("ext" + self.set)
	}
end

musiclevel:
	local.lastmusic = -1
	level.current_music = -1
	while (1)
	{
		if (level.current_music != local.lastmusic)
		{
			local.break = 0
			local.current_music = level.current_music

			for (local.i=0;local.i<6;local.i++)
			{
				if (level.current_music == local.lastmusic)
					local.break = 1	

				waitframe
			}
		
			if (local.break == 0)
			if (level.current_music != local.lastmusic)
			{
				
				if (level.current_music == "ext1")
					forcemusic aux1 aux1
				else
				if (level.current_music == "ext2")
					forcemusic aux3 aux3
				else
				if (level.current_music == "ext3")
					forcemusic aux5 aux5
				else
				if (level.current_music == "int1")
					forcemusic aux2 aux2
				else
				if (level.current_music == "int2")
					forcemusic aux4 aux4
				else
				if (level.current_music == "int3")
					forcemusic aux6 aux6

				println ("forced music " + level.current_music)
				local.lastmusic = local.current_music
			}
		}
		wait 0.1
	}
end
To me yet the use of level.current_music shows that all players hear the same soundtrack. Moreover, this variable is set without checking for the triggerer (there is no parm.other). Finally, 'forcemusic' doesn't contain any parameters concerning the player whose music needs forced.

:wink:

sounds

Posted: Thu Dec 18, 2003 2:06 am
by Gold
actually i was refering to the sounds in the ambience such as
}
if(level.script == "maps/m1l2b.scr")
{
thread sound ( 1814 -3686 -191 ) telephone
}
if(level.script == "maps/m1l3c.scr")
{
thread sound ( -5609.50 -6004.87 752.13 ) machine_loop
}
if(level.script == "maps/m2l1.scr")
{
thread sound ( 791.99 3193.58 448.13 ) m2l1_radio4
}
if(level.script == "maps/m2l2a.scr")
{
thread sound ( -4531.13 -2482.07 -239.88 ) m2l2a_radio2
}
if(level.script == "maps/m2l2b.scr")
{
thread sound ( 5415.74 -6761.01 0.13 ) m2l2a_radio2
}
if(level.script == "maps/m2l3.scr")
{
thread sound ( -470.03 5542.64 -255.88 ) m2l2a_radio2
}
if(level.script == "maps/m4l2.scr")
{
thread sound ( -5362.82 1922.23 48.13 ) m1l2b_radio1
}
if(level.script == "maps/m4l3.scr")
{
thread sound ( -2777 -304 16 ) fireplace
thread sound ( -1911 -1264 0.13 ) fireplace
thread sound ( -2885 219 24 ) fireplace
thread sound ( -1756 -798 249 ) m1l2b_radio1
thread sound ( -2850 -295 216 ) m1l2b_radio2
thread sound ( -3913 4512 21 ) river
}
if(level.script == "maps/m5l1a.scr")
{
thread sound ( 1065 -849 11 ) fire_large

an so on:)
Gold<<mohha freak

Posted: Tue Dec 23, 2003 3:58 am
by Gold
ok now ya guys have me curious hehehe,,and since ya guys the experts what does the following lines do?? :))
from ambience script
if ($interior == NULL)
level.interiors = 0
else
level.interiors = $interior.size

if (level.interiors > 0)
{
level.interior = exec global/makearray.scr $interior

for (local.i=1;local.i<level.interiors+1;local.i++)
{
level.interior[local.i] thread interior

if (level.interior[local.i].set == NIL)
{
println ("Warning, interior at " + level.interior[local.i].origin + " has no #set")
level.interior[local.i].set = 1
}
else
println ("Spawned interior " + local.i)

if (level.interior[local.i].haze == NIL)
level.interior[local.i].haze = -1

}
}

if ($exterior == NULL)
level.exteriors = 0
else
level.exteriors = $exterior.size

if (level.exteriors > 0)
{
level.exterior = exec global/makearray.scr $exterior

for (local.i=1;local.i<level.exteriors+1;local.i++)
{
level.exterior[local.i] thread exterior

if (level.exterior[local.i].set == NIL)
{
println ("Warning, exterior at " + level.exterior[local.i].origin + " has no #set")
level.exterior[local.i].set = 1
}
else
println ("Spawned exterior " + local.i)

if (level.exterior[local.i].haze == NIL)
level.exterior[local.i].haze = -1

and since the ambience points to the makearray what does this do??
main local.object:

if (local.object.size > 1)
{
for (local.i = 1; local.i <= local.object.size; local.i++)
local.array[local.i] = local.object[local.i]
end local.array
}
else if (local.object.size == 1)
{
local.array[1] = local.object
end local.array
}
else if (!local.object.size)
{
local.array[1] = NIL
end local.array
}
else
{
println "Error in make_array for '" local.object.targetname "'"
}

and does the above scripts work in conjunction any way with the m5l1a mus file which says the following or does in work seperately from this??
path sound/amb_stereo

normal Amb_M5_TownExt_1.mp3 // Default

aux1 Amb_M5_TownExt_1.mp3 // Exterior 1 - this is for all exteriors
aux2 Amb_M5_TownInt.mp3 // Interior 1 - this is for all interiors

!normal volume 1
!normal loop

!aux1 volume 1
!aux1 loop

!aux2 volume 0.7
!aux2 loop

just curious hehehe,,,and ya will never know to ya ask those who do know:)) hmmm i could alter those mus files and make some custom ones maybe??
Gold<<mohha freak

Posted: Tue Dec 23, 2003 4:33 am
by Gold
hmmm,,,would also seem that the makearray works in conjuntion with the global weather script also???

from weather script
if ($weatherF == NULL)
level.weatherFs = 0
else
level.weatherFs = $weatherF.size

if (level.weatherFs > 0)
level.weatherF = exec global/makearray.scr $weatherF

but like i said be4 ,,,i noob ,,so understanding at this point of what all this means is very vague,,,help!!!!

Gold<<mohha freak

array

Posted: Tue Dec 23, 2003 5:40 am
by tltrude
Arrays are used when one targetname is used over and over in the map. Take the global/door_locked.scr script as an example. Any trigger_use with the targetname "door_locked" in the map will make the locked sound when a player hits the use key. You don't have to number all the triggers because the script checks to see how many there are in the map and numbers them for you.


//***********************************************************
//*** locked sounds for doors
//*** place a trigger_use in front of the door you want to be locked
//*** make the targetname of the trigger 'door_locked'
//*** add a key/value to the trigger of $type [wood | large | metal | metal_garage]
//*** if you put nothing, then wood is default
//***********************************************************
lock:

for (local.i = 1 ; local.i <= $door_locked.size ; local.i ++)
{
if ($door_locked[local.i].type == "large")
{
$door_locked[local.i] thread door_locked_large
}
else if ($door_locked[local.i].type == "metal")
{
$door_locked[local.i] thread door_locked_metal
}
else if ($door_locked[local.i].type == "metal_garage")
{
$door_locked[local.i] thread door_locked_metal_garage
}
else
{
$door_locked[local.i] thread door_locked_wood
}
}

end

//****************************************
//*** play a locked sound for metal doors
//****************************************
door_locked_large:

door_locked_large_loop:
local.self waittill trigger
local.self playsound gate_large_locked

//thread global/message_print.scr::message "This door is locked!!" 1

wait 1

goto door_locked_large_loop

end


//****************************************
//*** play a locked sound for metal doors
//****************************************
door_locked_metal:

door_locked_metal_loop:
local.self waittill trigger

local.self playsound door_metal_locked

//thread global/message_print.scr::message "This door is locked!!" 1

wait 1

goto door_locked_metal_loop

end


//*******************************************
//*** play a locked sound for metal garage doors
//*******************************************
door_locked_metal_garage:

door_locked_metal_garage_loop:
local.self waittill trigger

local.self playsound garagedoor_locked

//thread global/message_print.scr::message "This door is locked!!" 1

wait 1

goto door_locked_metal_garage_loop

end


//****************************************
//*** play a locked sound for wood doors
//****************************************
door_locked_wood:

door_locked_wood_loop:
local.self waittill trigger

local.self playsound door_wood_locked

//thread global/message_print.scr::message "This door is locked!!" 1

wait 1

goto door_locked_wood_loop

end

//***********************************************************

The reason the message lines are commented out is because you can also set that in the trigger (Key: message; Value: This door is locked!). You can even set the locked sound that it playes by using:

Key: $type
Value: large

or one of the other three (wood is default). Anyway, you can think if "local.i" as the local index number.

Hope that helps!

Posted: Sat Jan 03, 2004 11:23 pm
by Gold
yup helped alot,,,thanx Tom:)
Gold<<mohha freak