TITLE Helo Dipping Sonar Search ; uses timer 3 and 4 for Dipping Search ; uses timer 1 and 2 and var 1 for pop-up behavior ; var 2 - integer when greater than zero, indicates we are engaging a sub RULE Init IF INIT = 1 THEN ; SET_TIMER 1 1800 VAR_SET 1 0 VAR_SET 2 0 ; SET_TIMER 3 100 END RULE Assign Dipping Tactic IF NEWTRACK = 1 THEN RULE Sub? IF CLASS = SUB AND ORDER = SEARCH THEN DEBUG "Assigning Dipping Tactic\n" TACTIC_CENTER TACTIC DippingSonar SENSOR "Active Sonar" 0 SETENTMODE SET_TIMER 1 -1 SET_TIMER 2 -1 SET_TIMER 3 -1 SET_TIMER 4 -1 VAR_ADD 2 1 END RULE Missile? IF CLASS = MISSILE AND ( MISSILE_CLASS = AAM OR MISSILE_CLASS = SAM ) THEN TACTIC AirEvadeMissile END RULE Enemy Plane? IF CLASS = AIR AND ( ID = HOSTILE OR ID = UAE OR ID = UPD ) THEN TACTIC AirEvadeAir END END RULE lost track IF LOSTTRACK = 1 THEN DEBUG "Lost Track!" SETSOLNMODE RULE decrement attack var2 IF DOCTRINENAME = "DippingSonar" THEN SETENTMODE VAR_SUB 2 1 ;lets make sure our variable doesn't go negative! RULE check var2 IF VAR2 < 0 THEN SETENTMODE VAR_SET 2 0 END END END RULE Search only IF ORDER = SEARCH THEN RULE Dip IF VAR1 = 1 THEN ; game has just clued us we've reached a waypoint DEBUG "Starting Search Dip" PRIORITY 249 PERSIST 180 SETSPD 0 SETALT 45 END RULE Start pinging IF VAR1 = 1 AND ALT < 50 THEN DEBUG "Starting Dip Timer" PRIORITY 249 PERSIST 180 SETSPD 0 SETALT 45 SENSOR "Active Sonar" 1 VAR_SET 1 0 SET_TIMER 4 180 END RULE Stop Dip IF TIMER4 = 0 THEN DEBUG "Stopping Search Dip" PRIORITY 249 MAX_SPD SETALT 300 SENSOR "Active Sonar" 0 END END ;RULE Pop-up ;IF TIMER1 = 0 THEN ; DEBUG "Starting Popup\n" ; SETALT 5000 ; SENSOR "Active Sonar" 0 ; SET_TIMER 2 300 ;END ;RULE Stop Pop-up ;IF TIMER2 = 0 THEN ; DEBUG "Stopping Popup\n" ; MAX_SPD ; SETALT 300 ; SENSOR "Active Sonar" 0 ; SET_TIMER 1 1800 ; SET_TIMER 3 600 ;END