main local.origin local.angles local.triggeredonce: // keep local.triggeredonce empty, or 0. local.tswitch = spawn script_model local.tswitch model "animate/trainswitch.tik" local.tswitch.origin = local.origin local.tswitch.angles = local.angles local.tswitch anim idle local.tswitch notsolid local.tswitchtrig = spawn trigger_use local.tswitchtrig.origin = local.tswitch.origin local.tswitchtrig setsize ( -20 -20 -20 ) ( 20 20 20 ) if(local.triggeredonce != 1) { local.tswitch model "animate/trainswitch_pulsating.tik" local.tswitchtrig triggerable local.tswitchtrig waittill trigger local.tswitchtrig nottriggerable local.tswitch.model = "animate/trainswitch.tik" } local.tswitch anim move local.tswitchtrig nottriggerable local.random1 = randomint(2) if(local.random1 == 0) { local.tswitch playsound track_switch1 } if(local.random1 == 1) { local.tswitch playsound track_switch2 } /////////////////////////////////////////////*** add code here ***////// local.player = parm.other local.player iprint ("*** Lowering the barbwire wall. ***") wait 1 // or local.tswitch anim waittill animdone //////////////////////////////////////////////////////////////////////// local.tswitchtrig triggerable local.tswitchtrig waittill trigger local.tswitchtrig nottriggerable local.tswitch.angles = local.tswitch.angles + ( 0 180 0 ) local.angles = local.tswitch.angles local.tswitch remove local.tswitchtrig remove local.tswitch = spawn script_model local.tswitch model "animate/trainswitch_pulsating.tik" local.tswitch.origin = local.origin local.tswitch.angles = local.angles local.tswitch anim idle local.tswitch notsolid local.tswitchtrig = spawn trigger_use local.tswitchtrig.origin = local.tswitch.origin local.tswitchtrig setsize ( -20 -20 -20 ) ( 20 20 20 ) local.tswitch anim move local.tswitchtrig nottriggerable local.random2 = randomint(2) if(local.random2 == 0) { local.tswitch playsound track_switch1 } if(local.random2 == 1) { local.tswitch playsound track_switch2 } /////////////////////////////////////////////*** add code here ***////// local.player = parm.other local.player iprint ("*** Raising the barbwire wall. ***") wait 1 //////////////////////////////////////////////////////////////////////// local.tswitchtrig triggerable local.tswitchtrig waittill trigger local.tswitchtrig nottriggerable local.tswitch.angles = local.tswitch.angles + ( 0 -180 0 ) local.angles = local.tswitch.angles local.tswitch remove local.tswitchtrig remove thread main local.origin local.angles 1 end