Quote:
(1) What would be the most efficient way to trigger a bunch of lights to turn on in sequence? Via scripts, of course. I did this successfully with a trigger_once + relay, but it clutters the geometry in my map, and makes brush / entity management difficult. I want to clean this mess up.
Call a function from your trigger that loops through all your lights turning them on. Most efficient would most likely be to name them all in sequence e.g $myLightSequence#, where # is a number 1 to how ever many and loop through with a for loop. e.g
Code:
void lightSequence(){
for(int n=1;n<10;n++){
entity light = sys.getEntity("myLightSequence"+n);
light.On;
sys.wait(1);
}
}
Quote:
(2) I'd like a sound to be triggered every time I pass over a particular surface (a small tile on the ground), but I do not want the sound to repeat if I stay standing on it. So I want a multiple trigger that only triggers once while I am inside. Was able to get everything but that bolded bit to work. A script solution, again, is best.
You can disable a trigger by using $myTrigger.disable and .enable to reenable it. Make your trigger call a function that disables your trigger and plays your sound. Then you would need another set of triggers around your original to reenable it once youve stepped of the tile, these would need to start off disabled.
Quick test map
Script
Code:
/* will need 4 outter triggers if your tile is in the middle of open ground
this function is used to both enable and disable these 4 triggers */
void enableoutters(boolean enab){
float n;
for(n=1;n<5;n++){
entity outter = sys.getEntity(("myouttertrigger"+n));
if (enab){
outter.enable();
}else{
outter.disable();
}
}
}
void triggerSound(){ //called from your trigger on the tile
$mysoundtrigger.disable(); //disable tile trigger
sys.trigger(sys.getEntity("mySpeaker")); //trigger speaker or link to trigger or play sound here
enableoutters(1); //enable outter triggers
}
void myouttertrigger(){ //called from outter triggers
enableoutters(0); //disable outter triggers
$mysoundtrigger.enable(); //reenable tile trigger
}
void main(){
sys.setcvar("g_showtriggers","1"); //just for testing so you can see the triggers
enableoutters(0); //disable outter triggers from start of map
}
Map
Code:
Version 2
// entity 0
{
"classname" "worldspawn"
// primitive 0
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 1
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 2
{
brushDef3
{
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( -1 0 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 3
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 4
{
brushDef3
{
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
( 0 0 1 -8 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
( 0 -1 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
( -1 0 0 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_diafloor_1b_fin" 0 0 0
}
}
// primitive 5
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 248 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 6
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 7
{
brushDef3
{
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( -1 0 0 480 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 8
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 -488 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 328 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
// primitive 9
{
brushDef3
{
( -1 0 0 -440 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 1 0 -336 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 -1 0 -264 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 1 -256 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
( 1 0 0 432 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/base_floor/a_sflpanel4a_01" 0 0 0
}
}
}
// entity 1
{
"classname" "trigger_multiple"
"name" "myouttertrigger1"
"model" "myouttertrigger1"
"origin" "32 64 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
( 0 -1 0 32 ) ( ( 0.0625 0 56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 1 0 0 -64 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( -1 0 0 -64 ) ( ( 0.0625 0 2 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 1 0 -40 ) ( ( 0.0625 0 -56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 1 -24 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 56 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 -1 -16 ) ( ( 0.0625 0 -2 ) ( 0 0.0625 -56 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 2
{
"classname" "speaker"
"name" "mySpeaker"
"origin" "32 32 40"
"s_waitfortrigger" "1"
"s_shader" "char_sentry_active"
}
// entity 3
{
"classname" "light"
"name" "light_1"
"origin" "40 8 120"
"light_radius" "796 492 264"
}
// entity 4
{
"classname" "info_player_start"
"name" "info_player_start_1"
"origin" "-376 -216 8"
"angle" "45"
}
// entity 5
{
"classname" "trigger_multiple"
"name" "mysoundtrigger"
"model" "mysoundtrigger"
"origin" "32 32 8"
"call" "triggerSound"
// primitive 0
{
brushDef3
{
( 0 0 -1 0 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 1 -8 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 -1 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 1 0 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 1 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( -1 0 0 -32 ) ( ( 0.0625 0 0 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 6
{
"classname" "trigger_multiple"
"name" "myouttertrigger3"
"model" "myouttertrigger3"
"origin" "32 -72 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
( 0 0 -1 -16 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 -56 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 1 -24 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 56 ) ) "textures/common/trigmulti" 0 0 0
( 0 1 0 -40 ) ( ( 0.0625 0 -56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( -1 0 0 -64 ) ( ( 0.0625 0 -6.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 1 0 0 -64 ) ( ( 0.0625 0 6.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 -1 0 32 ) ( ( 0.0625 0 56 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 7
{
"classname" "trigger_multiple"
"name" "myouttertrigger2"
"model" "myouttertrigger2"
"origin" "112 -8 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
( 0 0 -1 -16 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 -51 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 1 -24 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 51 ) ) "textures/common/trigmulti" 0 0 0
( 0 1 0 -104 ) ( ( 0.0625 0 -51 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( -1 0 0 -16 ) ( ( 0.0625 0 -2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 1 0 0 8 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 -1 0 -24 ) ( ( 0.0625 0 51 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
// entity 8
{
"classname" "trigger_multiple"
"name" "myouttertrigger4"
"model" "myouttertrigger4"
"origin" "-24 -8 24"
"call" "myouttertrigger"
// primitive 0
{
brushDef3
{
( 0 0 -1 -16 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 -59.5 ) ) "textures/common/trigmulti" 0 0 0
( 0 0 1 -24 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 59.5 ) ) "textures/common/trigmulti" 0 0 0
( 0 1 0 -104 ) ( ( 0.0625 0 -59.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( -1 0 0 -16 ) ( ( 0.0625 0 -2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 1 0 0 8 ) ( ( 0.0625 0 2.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
( 0 -1 0 -24 ) ( ( 0.0625 0 59.5 ) ( 0 0.0625 0 ) ) "textures/common/trigmulti" 0 0 0
}
}
}
Hope that helps, easiest way i could think of doing it.