; UGM Surface and LAND Strike Missiles Doctrine For Reinforce Alert Addon v.1.49 var Runout var initX var initY var run var Homing var RTESet var InitTime var DecoyLogic var Spoofed VAR TEMP VAR ALTCRUISE VAR TALT VAR TRNG var Old_T_alt var TG VAR ALT VAR TimeImpact var S var Go var LMPX var LMPY var lastX var lastY var SensRon var prast var SON var twykl VAR NUM_TH VAR ZZZConf var delta VAR WPtX VAR WPtY var kurs var fffff var PreEnableCourse var Typ var rng var landshaft VAR FCRUIS var UGMTimer var CS var AtkPhase var TClass var TType var percmalf var weapeffectv var crushevnt var otkaztime var detonpercnt var dfs var uwd var TRD_Switch var mission Func malfunction { if ( ( ownalt > 0 ) and ( pitch > 45 ) ) then { SetPitch -80 } elseif ( ( ownalt > 0 ) and ( pitch < 45 ) ) then { SetPitch -60 cs = 0 } endif IF OwnAlt > 0 THEN { UWD = 1 } ELSEIF ( OwnAlt < 0 ) AND UWD THEN { If dfs == 1 Then { Detonate } else { Shutdown } endif } ENDIF } IF INIT THEN { FCRUIS = 1 UGMTimer = 1000000 Go = 0 TimeImpact = 0 TG = 0 old_t_alt = TERRAINALT INITTIME = ( TIME + 2 ) ALTCRUISE = 350 TRNG = 10000 Runout = -1 dfs = -1 RTESet = 1 Homing = 0 Spoofed = ( RND 100 ) lastX = OwnX lastY = OwnY SensRon = 10000 SON = 1 twykl = -1 NUM_TH = 0 ZZZConf = 0 fffff = 1 } ELSEif ( twykl != -1 ) and ( twykl < time ) then { SHUTDOWN } ELSEIF ( Runout != -1 ) AND ( run > Runout ) THEN { IF TERRAINALT < 0 THEN { SHUTDOWN } ELSE { DETONATE } ENDIF RunOut = -1 } else { IF RTESet THEN { detonpercnt = rnd 10 RTEset = 0 IF ( OwnName $= "Kh-65 ALCM" ) THEN { CS = MaxSpd Typ = 1 Runout = 3000240 DecoyLogic = 80 SensRon = 9260 S = 4 weapeffectv = 7.5 } ELSEIF ( OwnName $= "YJ-18 SLAM" ) THEN { CS = 580 Typ = 1 Runout = 540000 DecoyLogic = 90 SensRon = 12000 S = 4 weapeffectv = 7 setsnotkel on trd_switch = 1 } ENDIF if malfunctionweap then { percmalf = rnd 10 if percmalf >= weapeffectv then { crushevnt = 1 otkaztime = ( time + 20 + rnd 3580 ) if percmalf > 9 then { otkaztime = ( Time + 1 ) } endif } endif } endif } ENDIF prast = xyrng ( OwnX - WPtX ) ( OwnY - WPtY ) run += xyrng ( OwnX - lastX ) ( OwnY - lastY ) lastX = OwnX lastY = OwnY IF ( Time >= InitTime ) and ( go == 0 ) THEN { go = 1 UGMTimer = ( Time + 30 ) } ENDIF if ( SensRon > prast ) and SON then { SON = 0 If S == 1 THEN { SensorEnable "Wep Radar1" 1 SensorEnable "Wep Radar2" 1 } ELSEIF S == 2 THEN { SensorEnable "Wep Radar1" 1 SensorEnable "SLAM-ER IR" 1 } ELSEIF S == 3 THEN { SensorEnable "Wep Radar1" 1 SensorEnable "Wep Radar2" 1 SensorEnable "SLAM-ER IR" 1 } ELSE { SensorEnable "Granat Visual" 1 } endif } ENDIF if ( prast < 900 ) and ( twykl == -1 ) then { twykl = ( OWNSPD * 0.514444 ) TEMP = ( pitch * 0.01745 ) TEMP = cos TEMP twykl = ( twykl * TEMP ) IF twykl == 0 then { twykl = 0.00001 } endif twykl = ( prast / twykl ) twykl = ( time + twykl + 5 ) } endif if ( crushevnt == 1 ) and ( time >= otkaztime ) then { if detonpercnt >= 9.5 then { dfs = 1 } else { dfs = 0 } endif malfunction } endif IF TRD_Switch THEN { IF ( OwnAlt > -20 ) AND ( mission != 1 ) THEN { ; DebugOut "Booster OFF" SetPriority 255 SetSnorkel OFF mission = 1 } ENDIF } ENDIF if ownalt > 0 then { uwd = 1 } elseif ( ownalt < 0 ) and uwd then { if malfunctionweap and ( dfs == -1 ) then { Shutdown } elseif not malfunctionweap then { Shutdown } endif } endif IF NEWTRACK THEN { if fffff then { TClass = TgtClass TType = TgtType fffff = 0 IF S != 4 THEN { IF ( TgtType $= "ROCK" ) Then { S = 1 } ENDIF IF ( TgtType $= "SHIP" ) Then { S = 2 } ENDIF IF ( TgtType $= "Sub" ) Then { S = 1 } ENDIF IF ( TgtType $= "FLOAT" ) Then { S = 3 } ENDIF IF ( TgtType $= "Sub" ) Then { S = 1 } ENDIF } ENDIF kurs = PreEnableCourse WPtX = TGTX WPty = TGTY trng = tgtrng talt = tgtalt If ( TAlt == 0.000000 ) THEN { TAlt = -0.999988 } ENDIF SetTactic "SBROS" } else { IF ZZZCONF < TGTCONF THEN { IF ( TgtClass $= "AIR" ) AND ( Spoofed > DecoyLogic ) THEN { WPtX = TGTX WPty = TGTY trng = tgtrng Homing = 1 IF NOT ( TType $= "Rock" ) THEN { CS = MaxSpd } ENDIF SetTactic "T_H_UGM_SLAM_AI" } ELSEIF TgtClass $= "AIR" THEN { SetTactic "SBROS" } ELSE { WPtX = TGTX WPty = TGTY trng = tgtrng Homing = 1 TALT = TGTALT If ( TAlt == 0.000000 ) THEN { TAlt = -0.999988 } ENDIF IF NOT ( TType $= "Rock" ) THEN { CS = MaxSpd } ENDIF SetTactic "T_H_UGM_SLAM_AI" } ENDIF } ELSE { SetTactic "SBROS" } ENDIF } endif } ELSEIF ( Homing == 0 ) and go THEN { SetPriority 250 SetCrs kurs } ENDIF if not homing or ( trng > 4000 ) then { temp = ( TERRAINALT - old_t_alt ) rng = 1100 IF TERRAINALT > 0 THEN { ALT = ( OWNALT - TERRAINALT ) IF 70 < abs temp THEN { TG = ( TIME + 20 ) } ENDIF if tg > time then { landshaft = 3 } else { landshaft = 2 } endif } else { ALT = OWNALT IF TERRAINALT < -300 THEN { landshaft = 0 } elseif TERRAINALT < -70 then { landshaft = 1 } else { landshaft = 2 } endif } endif IF ( UGMTimer >= Time ) THEN { IF landshaft == 0 then { ALTCRUISE = 225 } elseif landshaft == 1 then { ALTCRUISE = 450 } elseif landshaft == 2 then { ALTCRUISE = 1040 } elseif landshaft == 3 then { ALTCRUISE = 3200 rng = 800 } endif } ENDIF IF FCRUIS THEN { IF alt < ( ALTCRUISE + 300 ) THEN { FCRUIS = 0 } ELSEif ( alt < 3000 ) then { rng = 4000 } endif } ENDIF DELTA = ( ALTCRUISE - ALT ) temp = XYBRG ABS DELTA ( rng * 3.28 ) if DELTA < 0 then { temp = ( -1 * temp ) } endif IF landshaft == 3 THEN { IF TEMP > 0 THEN { ( CS = ( MaxSpd * 0.85 ) ) TEMP = ( TEMP + 7 ) } ENDIF } ENDIF if temp < -45 then { temp = -45 } endif } else { SetSpd CS if ownalt < talt then { temp = 20 } else { DELTA = ( TALT - OWNALT + 51 ) temp = XYBRG ABS DELTA ( trng * 3.28 ) if DELTA < 0 then { temp = ( -1 * temp ) } endif } endif } endif if go then { if ( ownalt < talt ) and homing then { temp = 20 } endif IF NOT ( TType $= "Rock" ) THEN { if ( ( trng > 450 ) or ( trng == 0 ) ) AND NOT AtkPhase then { SETPRIORITY 250 SETPERSIST 1 SETPITCH TEMP TAlt = -0.999988 } endif } ELSEIF ( TType $= "Rock" ) THEN { IF ( ( trng > 450 ) or ( trng == 0 ) ) THEN { SETPRIORITY 250 SETPITCH TEMP } endif } ELSE { } endif old_t_alt = TERRAINALT IF LOSTTRACK THEN { Homing = 0 } endif } endif SetSpd CS