MQ-9.ac -3 0 0 0 0 0 select Sensor SensorMount1 sim/current-view/internal Stores Aircraft/MQ-9/Models/Stores/Stores.xml Aircraft/MQ-9/Sounds/MP-Sounds.xml Effects/model-transparent sim/multiplay/generic/float[6] 9 /sim/rendering/rembrandt/enabled Disk BladesBlur Aircraft/MQ-9/Models/Effects/Effects.xml Aircraft/MQ-9/Models/Lights/LightPack.xml #if you're just using the pack, change the values according to the MP bindings in the -set.xml file #you don't need to delete the entries if the path is nil - it gets skipped automatically and the MP path is just ignored var mirrorValues = [ mpVar.new(mpPath~"sim/multiplay/generic/int[7]", mpPath~"sim/crashed"), mpVar.new(mpPath~"sim/multiplay/generic/int[0]", navSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[1]", beaconSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[1]", strobeSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[2]", landingSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[3]", taxiSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[3]", probeSwitch), mpVar.new(mpPath~"sim/multiplay/generic/int[0]", whiteSwitch), ]; #loop at the default MP transfer frequency (10Hz) var mirrorTimer = maketimer(0.1, func { foreach(var mir; mirrorValues) { mir.check(); } }); mirrorTimer.start(); #### NAV LIGHTS #### #class for a periodic fade in/out animation - for flashing, use rather standard aircraft.light.new(), as in Beacon and Strobe section var lightCycle = { #constructor new: func(propSwitch, propOut) { m = { parents: [lightCycle] }; props.globals.initNode(propOut, 0, "DOUBLE"); props.globals.initNode(propSwitch, 1, "BOOL"); m.fadeIn = 0.4 + rand()*0.05-0.025; #fade in time m.fadeOut = 0.4 + rand()*0.05-0.025; #fade out time m.stayOn = 1.5 + rand()*0.05-0.025; #stable on period m.stayOff = 1 + rand()*0.05-0.025; #stable off period m.turnOff = 0.12; #fade out time when turned off m.phase = 0; #phase to be run on next timer call: 0 -> fade in, 1 -> stay on, 2 -> fade out, 3 -> stay off m.cycleTimer = maketimer(0.1, func { if(getprop(propSwitch)) { if(m.phase == 0) { interpolate(propOut, 1, m.fadeIn); m.phase = 1; m.cycleTimer.restart(m.fadeIn); } else if(m.phase == 1){ m.phase = 2; m.cycleTimer.restart(m.stayOn); } else if(m.phase == 2){ interpolate(propOut, 0, m.fadeOut); m.phase = 3; m.cycleTimer.restart(m.fadeOut); } else if(m.phase == 3){ m.phase = 0; m.cycleTimer.restart(m.stayOff); } } else { interpolate(propOut, 0, m.turnOff); #kills any currently ongoing interpolation m.phase = 0; } }); m.cycleTimer.singleShot = 1; if(propSwitch==nil) { m.listen = nil; return m; } m.listen = setlistener(propSwitch, func{m.cycleTimer.restart(0);}); #handle switch changes m.cycleTimer.restart(0); #start the looping return m; }, #destructor del: func { if(me.listen!=nil) removelistener(me.listen); me.cycleTimer.stop(); }, }; #By default, the switch property is initialized to 1 (only if no value is already assigned). Don't change the class implementation! To override this, set the property manually. You don't need to care if any other code already does it for you. var navLights = nil; if(!navStillOn) { navLights = lightCycle.new(navSwitch, lightsPath~"nav-lights-intensity"); ### Uncomment and tune those to customize times ### #navLights.fadeIn = 0.4; #fade in time #navLights.fadeOut = 0.4; #fade out time #navLights.stayOn = 3 + rand()*0.05-0.025; #stable on period #navLights.stayOff = 0.6; #stable off period #navLights.turnOff = 0.12; #fade out time when turned off } ### BEACON ### var beacon = nil; if(beaconSwitch!=nil) { props.globals.initNode(beaconSwitch, 1, "BOOL"); beacon = aircraft.light.new(lightsPath~"beacon-state", [0.0, 1.0 + rand()*0.05-0.025], beaconSwitch); } ### STROBE ### var strobe = nil; if(strobeSwitch!=nil) { props.globals.initNode(strobeSwitch, 1, "BOOL"); strobe = aircraft.light.new(lightsPath~"strobe-state", [0.0, 0.87 + rand()*0.05-0.025], strobeSwitch); } ### LIGHT FADING ### #class for controlling fade in/out behavior - propIn is a control property (handled as a boolean) and propOut is interpolated #all light brightness animations in xmls depend on propOut (Rembrandt brightness, material emission, flares transparency, ...) var lightFadeInOut = { #constructor new: func(propSwitch, propOut) { m = { parents: [lightFadeInOut] }; m.fadeIn = 0.3; #some sane defaults m.fadeOut = 0.4; if(propSwitch==nil) { m.listen = nil; return m; } props.globals.initNode(propSwitch, 1, "BOOL"); m.isOn = getprop(propSwitch); props.globals.initNode(propOut, m.isOn, "DOUBLE"); m.listen = setlistener(propSwitch, func { if(m.isOn and !getprop(propSwitch)) { interpolate(propOut, 0, m.fadeOut); m.isOn = 0; } if(!m.isOn and getprop(propSwitch)) { interpolate(propOut, 1, m.fadeIn); m.isOn = 1; } } ); return m; }, #destructor del: func { if(me.listen!=nil) removelistener(me.listen); }, }; fadeLanding = lightFadeInOut.new(landingSwitch, lightsPath~"landing-lights-intensity"); fadeTaxi = lightFadeInOut.new(taxiSwitch, lightsPath~"taxi-light-intensity"); fadeProbe = lightFadeInOut.new(probeSwitch, lightsPath~"probe-light-intensity"); fadeWhite = lightFadeInOut.new(whiteSwitch, lightsPath~"white-light-intensity"); if(navStillOn) { navLights = lightFadeInOut.new(navSwitch, lightsPath~"nav-lights-intensity"); navLights.fadeIn = 0.1; navLights.fadeOut = 0.12; } #manipulate times if defaults don't fit your needs: #fadeLanding.fadeIn = 0.5; #fadeLanding.fadeOut = 0.8; ### the rest of your model load embedded Nasal code ### ]]> stopFire(); disintegrated = 0; removelistener(listenCrash); #prevent multiple timers and listeners from running and fighting on next connect #cleanly destroy MP property mirroring mirrorTimer.stop(); mirrorTimer = nil; mirrorValues = nil; #cleanly destroy nav lights if(navStillOn) { navLights.del(); } else { if(navSwitch!=nil) setprop(navSwitch, 0); navLights.del(); if(navSwitch!=nil) navLights.cycleTimer = nil; navLights = nil; } #cleanly destroy beacon if(beaconSwitch!=nil) setprop(beaconSwitch, 0); beacon.del(); beacon = nil; #cleanly destroy strobe if(strobeSwitch!=nil) setprop(strobeSwitch, 0); strobe.del(); strobe = nil; #cleanly destroy light fade in/out animation objects fadeLanding.del(); fadeTaxi.del(); fadeProbe.del(); fadeWhite.del(); ### the rest of your model unload embedded Nasal code ### Aircraft/MQ-9/Models/Effects/Normal MQ-9 Aircraft/MQ-9/Models/Effects/Specular MQ-9 var livery_update = aircraft.livery_update.new("Aircraft/MQ-9/Models/Liveries"); livery_update.stop(); material MQ-9 sim/model/livery texture Aircraft/MQ-9/Models/Liveries/MQ-9.jpg material Disk texture Aircraft/MQ-9/Models/Liveries/Disk.png material BladesBlur texture Aircraft/MQ-9/Models/Liveries/Disk.png rotate AileronR surface-positions/left-aileron-pos-norm 20 0.6977 5.5070 0.4481 0.6255 8.8878 0.4392 rotate AileronL surface-positions/left-aileron-pos-norm 20 0.6977 -5.5070 0.4481 0.6255 -8.8878 0.4392 rotate FlapR2 surface-positions/flap-pos-norm 40 0.7273 2.5708 0.4576 0.6968 5.5070 0.4495 rotate FlapL2 surface-positions/flap-pos-norm -40 0.7273 -2.5708 0.4576 0.6968 -5.5070 0.4495 rotate FlapR1 surface-positions/flap-pos-norm 40 0.7302 0.7240 0.4589 0.7196 2.5708 0.4545 rotate FlapL1 surface-positions/flap-pos-norm -40 0.7302 -0.7240 0.4589 0.7196 -2.5708 0.4545 rotate ElevatorR surface-positions/elevator-pos-norm -20 3.4018 0.4181 0.6136 3.5428 2.9323 2.3741 rotate ElevatorL surface-positions/elevator-pos-norm 20 3.4018 -0.4181 0.6136 3.5428 -2.9323 2.3741 rotate Rudder surface-positions/rudder-pos-norm -20 3.3652 0.0000 0.2360 3.4900 0.0000 -0.7541 rotate WheelN JawN surface-positions/rudder-pos-norm -20
-2.9145 0.0000 -1.2683
0.0 0.0 1.0
rotate WheelN JawN Strut1N Strut2N Scissor1N Scissor2N gear/gear[1]/position-norm 130 -130
-2.0705 0.0000 0.1760
0.0 1.0 0.0
rotate WheelL StrutL gear/gear[1]/position-norm 98 -98 0.0559 -0.3306 0.3248 0.0559 -0.2413 0.2317 rotate WheelR StrutR gear/gear[2]/position-norm -98 98 0.0559 0.3306 0.3248 0.0559 0.2413 0.2317 translate WheelN JawN Scissor1N Scissor2N Strut1N gear/gear[0]/compression-norm[0] 0.60 -2.7232 0.0000 -0.6690 -2.5221 0.0000 -0.4077 translate WheelR StrutR gear/gear[2]/compression-norm[0] 0.1 -0.0728 1.7594 -1.0981 -0.0728 1.7594 -0.8998 translate WheelL StrutL gear/gear[1]/compression-norm[0] 0.1 -0.0728 -1.7594 -1.0981 -0.0728 -1.7594 -0.8998 spin Propeller Blades engines/engine[0]/n2 3
4.4823 0.0000 0.7577
1.0 0.0 0.0
select Blades engines/engine[0]/n2 50.0001 select BladesFlat engines/engine[0]/n2 50.000 engines/engine[0]/n2 70.0001 spin BladesFlat engines/engine[0]/n2
4.4823 0.0000 0.7577
1.0 0.0 0.0
select Disk engines/engine[0]/n2 70.0000 spin Disk engines/engine[0]/n2 .5
4.4823 0.0000 0.7577
1.0 0.0 0.0
rotate Sensor SensorMount1 sim/model/turret[0]/heading 0 0 -1
-4.1425 0.0000 -0.0697
rotate Sensor sim/model/turret[0]/pitch 0 0 1 0
-4.1425 0.0000 -0.0697