home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 April / Gamestar_83_2006-04_dvd.iso / Dema / demowot_english.exe / Script / Source / Chapter2 / MS06-C2L2.sma < prev    next >
Text File  |  2005-03-11  |  25KB  |  840 lines

  1. #include "Script.inc"
  2. #include "visualeffects.inc"
  3. #include "antiair.inc"
  4.  
  5. #define max_run_once 7
  6. /*
  7. Temp Speeches:
  8. US Soldier: Buza Laszlo aka Buza
  9. US Tank Commander: Ovari Tamas aka aTom
  10. US Officer: Zalabai Peter aka Timber
  11. */
  12.  
  13.  
  14. //GlobalParams
  15. //============================================================================================================================
  16. new iMS06_SP001[]="#iMS06_SP001#";
  17. new iMS06_SP002[]="#iMS06_SP002#";
  18. new iMS06_SP003[]="#iMS06_SP003#";
  19. new iMS06_SP004[]="#iMS06_SP004#";
  20. new iMS06_SP005[]="#iMS06_SP005#";
  21. new iMS06_SP006[]="#iMS06_SP006#";
  22. new iMS06_SP007[]="#iMS06_SP007#";
  23.  
  24. new gFueltanksum = 0;
  25. new gWarehouse = 0;
  26. new DestFueltank = 0;
  27. new DestWarehouse = 0;
  28.  
  29. new Float:gOra;
  30.  
  31. // new Float:Fog = 0.0;
  32.  
  33. new bool:RunOnce[max_run_once];
  34.  
  35. //name constant
  36. new gBunker1[] = "big_bunker1";
  37. new gBunker2[] = "big_bunker2";
  38. new gTarget1[] = "wp_target_1";
  39. new gTarget2[] = "wp_target_2";
  40. new gHouse1[] = "house1";
  41. new gHouse2[] = "house2";
  42. new gHouse3[] = "house3";
  43. new gHouse4[] = "house4";
  44. new gfueltank1[] = "fueltank1";
  45. new gStartWP1[] = "wp_start1";
  46. new gStartWP2[] = "wp_start2";
  47. new gActor1[] = "actor1";
  48. new gActor2[] = "actor2";
  49. new gSmallbunker1[] = "bunker1";
  50. new gSmallbunker2[] = "bunker2";
  51. new gSmallbunker3[] = "bunker3";
  52. new gHelphouse1[] = "helphouse1";
  53. new gHelphouse2[] = "helphouse2";
  54. new gHelphouse3[] = "helphouse3";
  55.  
  56. //group constant
  57. new gPantherz[] = "grp_pantherz";
  58. new gAirguns[] = "AirGuns";
  59. new gPort[] = "grp_port";
  60. new gHelperz[] = "grp_Helperz"
  61. new gFueltankz[] = "grp_fueltankz";
  62. new gPorthouses[] = "grp_porthouses";
  63. new gMobilForce[] = "grp_MobilForce";
  64. new gIntro1[] = "grp_intro1";
  65. new gIntro2[] = "grp_intro2";
  66. // new gOberStumFhurer[] = "oberstumfuhrer";
  67. new gBunkerz[] = "grp_bunkerz";
  68. new gBunkercrew1[] = "grp_Bunker1Crew";
  69. new gBunkercrew2[] = "grp_Bunker2Crew";
  70. new gBunkercrew3[] = "grp_Bunker3Crew";
  71.  
  72.  
  73. //soundfiles
  74. new gSoundFile1[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP001.mp3";
  75. new gSoundFile2[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP002.mp3";
  76. new gSoundFile3[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP003.mp3";
  77. new gSoundFile4[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP004.mp3";
  78. new gSoundFile5[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP005.mp3";
  79. new gSoundFile6[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP006.mp3";
  80. new gSoundFile7[] = "Sounds\\Game\\Speech\\Mission\\MS06_SP007.mp3";
  81.  
  82. //============================================================================================================================
  83. public main()
  84.     CommonAKMain();
  85.  
  86. //============================================================================================================================
  87. public PostGameStart()
  88. {
  89.     CommonAKInit();
  90. //Level Init
  91.     ScenarioMode();
  92.     Add2GermanGroup();
  93.     forbidden_grp_num = 2;
  94.     gForbiddenGroups[0] = "grp_pantherz";
  95.     gForbiddenGroups[1] = "grp_AirDefense";
  96.     HideEntity( GetEntity( "sys_palyahatar1" ) );
  97.     
  98.     for(new counter = 0; counter <= max_run_once-1; counter++)
  99.     {
  100.         RunOnce[counter] = false;
  101.     }
  102.     
  103. //fadein
  104.     AddTimerEvent( "Fadeout", 0.001 ); 
  105.     AddTimerEvent("FogSet", 0.001);
  106.  
  107. //Megszamlaljuk hany tartaj es haz van
  108.     gFueltanksum = CountEntitiesInSelector( gFueltankz );
  109.     gWarehouse = CountEntitiesInSelector( gPorthouses );
  110. //szamlalas vege
  111.  
  112.     new PrevLevel = GetGlobalVariable("gvMS05_BonusTank");
  113.     
  114.     if(PrevLevel != 1)
  115.     {
  116.         new Iterator:i = Iterate( "grp_bonuspz" );
  117.         while(ItNext( i ))
  118.         {
  119.             DeActivateEntity( ItEntity( i ) );
  120.             HideEntity( ItEntity( i ) );
  121.         }
  122.         ItStop( i );
  123.     }
  124.     else
  125.         AddAKEntityEvent( "PZIsSeleceted", ANY_ENTITY, ENTITY_SELECTED );
  126.     
  127.     SetBehav("SelectorTeam1",MB_MOVE_IN_VICINITY,_,_,_,_,_);
  128.     SetBehav( gAirguns,_,_,UB_NEVER,DB_DISABLED,_,_ );
  129.     SetBehav(gPort,MB_MOVE_IN_VICINITY,FB_FIRE_AT_WILL,UB_EVAC,DB_DISABLED,_,_);
  130.     SetBehav(gMobilForce,MB_MOVE_FREELY, FB_FIRE_AT_WILL, UB_EVAC,DB_DISABLED,_,_);
  131.     SetBehav( "grp_flakguardz", MB_MOVE_IN_VICINITY,FB_FIRE_AT_WILL);
  132.     SetBehav( "grp_radiocarz", MB_MOVE_IN_VICINITY, FB_HOLD_FIRE, UB_EVAC);
  133.     SetBehav( gPantherz, MB_MOVE_IN_VICINITY,FB_FIRE_AT_WILL,UB_EVAC,DB_DISABLED,_,_);
  134.     SetBehav2Ent( GetEntity( "surprise_panzer" ), MB_MOVE_FREELY, FB_FIRE_AT_WILL, UB_EVAC );
  135.     SetNationality("SelectorTeam2", "American");
  136.     
  137. //Bunkerz opening fire!
  138.     CmdAttack( GetEntity( gBunker1 ), Q_OVERRIDE, GetEntity( gTarget1 ) );
  139.     CmdAttack( GetEntity( gBunker2 ), Q_OVERRIDE, GetEntity( gTarget2 ) );
  140.     
  141. //Timer Events
  142.     AddTimerEvent( "BunkerTargetPos", 30.0 );
  143.      AddTimerEvent( "RandomWaterImpact", 3.0, "GameLogic", true);
  144.     AddTimerEvent( "ParticleDestroyer", 10.0, "GameLogic", true);
  145. //User Events
  146.     AddUserEvent( "GroupEliminated", UE_GROUPELIM_SUCC );
  147.     AddUserEvent( "TeamEliminated", UE_TEAMELIM_SUCC );
  148.     AddUserEvent( "ObjectiveChanged", UE_OBJECTIVE_CHANGED);
  149. //Code Events
  150.     AddAKEntityEvent( "AreaEnterCheck", ANY_ENTITY, UNIT_AREA_ENTER );
  151.     AddAKEntityEvent( "CountDownDone", ANY_ENTITY, COUNTDOWN_DONE );
  152.     AddAKEntityEvent( "HQCaptured", ANY_ENTITY, HQ_TAKEOVER );
  153.     AddAKSelectorEvent( "Help", gPort, UNIT_HIT );
  154.     AddAKSelectorEvent( "HiddenObjective", gFueltankz, UNIT_DIED );
  155.     AddAKSelectorEvent( "SecondaryObjective", gPorthouses, UNIT_DIED );
  156.     AddAKEntityEvent( "FueltankDestroyCutscene", GetEntity(gfueltank1), UNIT_DIED );
  157.     AddAKSelectorEvent( "BunkerDamaged", gBunkerz, UNIT_DAMAGED );
  158. //     AddAKEntityEvent( "kiiras", ANY_ENTITY, TEST_EVENT );
  159.     AddAKSelectorEvent( "GlobalGroupRemover", "grp_German", UNIT_TEAM_CHANGED );
  160.  
  161.     AddObjective( "PRI_Port", OT_PRIMARY, "#iMS06_PS01#", "#iMS06_PL01#", OS_SLEEPING );
  162.     AddObjective( "SEC_PortDestroyed", OT_SECONDARY, "#iMS06_SS01#", "#iMS06_SL01#",  OS_SLEEPING );
  163.     AddObjective( "SEC_AirDefense", OT_SECONDARY, "#iMS06_SS02#", "#iMS06_SL02#",  OS_SLEEPING );    
  164.     AddObjective( "HID_OilTanks", OT_HIDDEN, "#iMS06_HS01#", "#iMS06_HL01#", OS_SLEEPING );
  165.  
  166.     switch(GetDifficulty())
  167.     {
  168.         case 0://easy
  169.         {
  170.             GiveAirRecon(gPlayerTeam);
  171.             gOra = 270.0;
  172.         }
  173.         case 1,2://medium hard
  174.         {
  175.             gOra = 270.0;
  176.         }
  177.         case 3://extreme
  178.         {
  179.             gOra = 210.0;
  180.         }
  181.     }
  182.  
  183.     Intro();
  184. }
  185. //============================================================================================================================
  186. public ObjectiveChanged()
  187. {
  188.     if(GetObjectiveState( "PRI_Port" ) == OS_COMPLETED)
  189.     {
  190.         if(GetObjectiveState( "HID_OilTanks" ) == OS_IN_PROGRESS)
  191.         {
  192.             SetObjectiveState( "HID_OilTanks", OS_COMPLETED );
  193.             SetGlobalVariable("gvMS06_OilTankz",1);
  194.         }
  195.         if(GetObjectiveState( "SEC_PortDestroyed" ) == OS_IN_PROGRESS)
  196.             SetObjectiveState( "SEC_PortDestroyed", OS_COMPLETED );
  197.         
  198.         if(GetObjectiveState( "SEC_AirDefense" ) == OS_IN_PROGRESS)
  199.             SetObjectiveState( "SEC_AirDefense", OS_FAILED );
  200.             
  201.         SetCutScene(true);
  202.         BulletTime( GetEntity( "hq" ), false, false, false, 35.0, 30.0);
  203.         AddUserEvent( "Victory", UE_BULLETTIME_END );
  204.     }
  205.     
  206.     if(GetObjectiveState("PRI_Port") == OS_FAILED)
  207.     {
  208.         if(GetObjectiveState( "SEC_PortDestroyed" ) == OS_IN_PROGRESS)
  209.             SetObjectiveState( "SEC_PortDestroyed", OS_FAILED );
  210.     }
  211. }
  212. //============================================================================================================================
  213. public FogReducer()
  214. {
  215.     new DrID:WeatherManager = GetPropertyObject( GetWorld(), "Weather" );
  216.     new Float:MaxRange = GetPropertyFloat( WeatherManager, "FogMaxRange" );
  217.         
  218.     if(MaxRange < 1000.0)
  219.         MaxRange = MaxRange + 1.0;
  220.     else
  221.         RemoveEvent( "FogReducer" );
  222.     
  223.     SetPropertyFloat( WeatherManager, "FogMaxRange", MaxRange );
  224.  
  225. //debug
  226. //    Fog = MaxRange;
  227. }
  228.  
  229. //============================================================================================================================
  230. public FogSet()
  231. {
  232.     
  233.     new DrID:WeatherManager = GetPropertyObject( GetWorld(), "Weather" );
  234.     static Float:MaxRange;
  235.  
  236. //set fog    
  237.     if(RunOnce[1] == false)
  238.     {
  239.         RunOnce[1] = true;
  240.         SetPropertyFloat( WeatherManager, "FogMaxRange", 0.0 );
  241.         SetPropertyFloat( WeatherManager, "FogMinRange", 0.0 );
  242.         MaxRange = 1000.0;
  243.     }    
  244. //end    
  245.  
  246.     if(MaxRange > 100.0)
  247.     {
  248.         MaxRange -= 0.35;
  249.         SetPropertyFloat( WeatherManager, "FogMaxRange", MaxRange );
  250.     }
  251.     else
  252.     {
  253.         RemoveEvent( "FogSet" );
  254.         AddTimerEvent( "FogReducer", 1.0 );
  255.     }
  256. }
  257. //============================================================================================================================
  258. public GroupEliminated()
  259. {
  260.     new ID = GetMsgParamInt();
  261.     if(ID == 20)
  262.     {
  263.         AddSoundMessage(iMS06_SP006, gSoundFile6);
  264.         GiveArtilleryAttack(gPlayerTeam);        
  265.         RemoveEvent( "RandomWaterImpact" );
  266.     }    
  267.     if(ID == 30)
  268.     {
  269.         AddSoundMessage(iMS06_SP007, gSoundFile7);
  270.         SetParatroopers(gPlayerTeam,1);
  271.         SetObjectiveState( "SEC_AirDefense", OS_COMPLETED );
  272.     }
  273.     if(ID == 100)
  274.     {
  275.         if(GetObjectiveState( "HID_OilTanks" ) == OS_IN_PROGRESS)
  276.         {
  277.             SetObjectiveState( "HID_OilTanks", OS_COMPLETED );
  278.             SetGlobalVariable("gvMS06_OilTankz",1);
  279.             new Iterator:i = Iterate( gFueltankz, "cDamageableEntity" );
  280.             while(ItNext( i ))
  281.             {
  282. //                 MakeInvulnerable(ItEntity( i ));
  283.                 SetPropertyBool( GetComponent( ItEntity( i ), "cDRSimple"), "Invulnerable", true );
  284.             }
  285.             ItStop( i );
  286.         }
  287.         if(RunOnce[6] == false)
  288.             CountDownDone();
  289.     }
  290. }
  291. //============================================================================================================================
  292. public Fadeout()
  293. {
  294.     static Float:light = 0.0;
  295.     
  296.     if(light >= 0.55)
  297.     {
  298.         RemoveEvent( "Fadeout" );
  299.         SetPropertyFloat( GetWorld(), "AmbientIntensity",  0.55); 
  300.         SetPropertyFloat( GetWorld(), "DirLightIntensity",  0.55); 
  301.         AddTimerEvent( "DawnToDay", 0.1 );
  302.     }
  303.     else
  304.     {
  305.         light+= 0.0001;
  306.         SetPropertyFloat( GetWorld(), "AmbientIntensity",  light); 
  307.         SetPropertyFloat( GetWorld(), "DirLightIntensity",  light); 
  308.     }
  309. }
  310. //============================================================================================================================
  311. public AreaEnterCheck(DrID:Unit, DrID:Area)
  312. {
  313.     new DrID:area = GetEntity( "area_perimeter" );
  314.     if(RunOnce[0] == false && area == Area && GetPropertyInt( Unit, "Team" ) == gPlayerTeam )
  315.     {
  316.         RunOnce[0] = true;
  317.         DebugMessage( "A gamer elerte a varos hatarat! Itt jon a megsemmisetes cutscene", DL_MESSAGE );
  318.         Destroy(gPantherz, GetEntity(  gHouse1 ) );
  319.         DestroyCutscene();
  320.     }
  321. }
  322. //============================================================================================================================
  323. public CountDownDone()
  324. {
  325.     RunOnce[6] = true;
  326.     RemoveEvent( "CountDownDone" );
  327.     RemoveEvent( "DestroyAgain" );
  328.     RemoveEvent( "PortHouseInfo" );
  329.     
  330.     CmdGroupStop( gPantherz, Q_OVERRIDE );
  331.     SetBehav( gPantherz, MB_MOVE_FREELY);
  332.  
  333.     if(DestWarehouse == gWarehouse)
  334.     {
  335.         SetObjectiveState( "SEC_PortDestroyed", OS_FAILED );
  336.         AddSoundMessage(iMS06_SP005, gSoundFile5);
  337.     }
  338.     else
  339.     {
  340.         SetObjectiveState( "SEC_PortDestroyed", OS_COMPLETED );
  341.         new Iterator:i = Iterate( gPorthouses );
  342.         while(ItNext( i ))
  343.         {
  344.             MakeInvulnerable(ItEntity( i ));
  345.         }
  346.         ItStop( i );
  347.     }
  348.     SetCountDown( -1 );
  349.     SetShortInfo("");
  350. }
  351. //============================================================================================================================
  352. public BunkerTargetPos()
  353. {
  354.     static bool:state = false;
  355.     
  356.     new DrID:Target1 = GetEntity( gTarget1 );
  357.     new DrID:Target2 = GetEntity( gTarget2 );
  358.     new Float:TargetPos1[vec3];
  359.     new Float:TargetPos2[vec3];
  360.     
  361.     GetPropertyVec3( Target1, "LogicalPos_", TargetPos1 );
  362.     GetPropertyVec3( Target2, "LogicalPos_", TargetPos2 );
  363.     
  364.         
  365.     if(state == false)
  366.     {
  367.         state = true;
  368.         TargetPos1[vec3:y] += 50.0;            
  369.         TargetPos2[vec3:y] -= 50.0;
  370.         SetPropertyVec3( Target1, "Pos", TargetPos1 );
  371.         SetPropertyVec3( Target2, "Pos", TargetPos2 );
  372.     }
  373.     else
  374.     {
  375.         state = false;
  376.         TargetPos1[vec3:y] -= 50.0;            
  377.         TargetPos2[vec3:y] += 50.0;
  378.         SetPropertyVec3( Target1, "Pos", TargetPos1 );
  379.         SetPropertyVec3( Target2, "Pos", TargetPos2 );
  380.     }
  381. }
  382. //============================================================================================================================
  383. public Destroy(group[], DrID:target)
  384. {
  385.     if(IsAlive(target))
  386.     {
  387.         new Iterator:i = Iterate(group);
  388.         while(ItNext( i ))
  389.         {
  390.             new DrID:Unit = ItEntity( i );
  391.             if(IsAlive(Unit))
  392.             {
  393.                 CmdAttack( Unit, Q_ENQUEUE, target , AF_FORCE);
  394.             }
  395.         }
  396.     }
  397. }
  398. //============================================================================================================================
  399. public DestroyAgain()
  400. {
  401.     static counter = 0;
  402.     
  403.     switch(counter)
  404.     {
  405.         
  406.         case 0: Destroy(gPantherz, GetEntity(gHouse2));
  407.     
  408.         case 1: Destroy(gPantherz, GetEntity(gfueltank1));
  409.     
  410.         case 2: Destroy(gPantherz, GetEntity(gHouse3));
  411.         
  412.         case 3: Destroy(gPantherz, GetEntity(gHouse4));
  413.         
  414.     }
  415.     counter++;
  416. }
  417. //============================================================================================================================
  418. public TeamEliminated()
  419. {
  420.     new ID = GetMsgParamInt();
  421.  
  422.     if(ID == 10)
  423.     {
  424.         SetCutScene(true, true, true);
  425.         SetObjectiveState( "PRI_Port", OS_FAILED );
  426.         CallUserEvent( UE_OBJECTIVE_CHANGED );
  427.         new DrID:LastPlayerUnit = GetLastKilledEntity();
  428.         BulletTime( LastPlayerUnit, false);
  429.         AddUserEvent( "GameOver", UE_BULLETTIME_END );
  430.     }
  431.     if(ID == 20 && RunOnce[5] == false)
  432.     {
  433.         RunOnce[5] = true;
  434.         if(GetDifficulty() == 0)
  435.         {
  436.             Reinforcement( "help_to_easy", GetEntity( "wp_reinforcement" ), GetEntity( "wp_incoming" ));
  437.         }
  438.     }
  439. }
  440. //============================================================================================================================
  441. public HQCaptured(DrID:HQ)
  442. {
  443.     if(GetPropertyInt( HQ, "Team" )== gPlayerTeam)
  444.     {
  445.         SetObjectiveState( "PRI_Port", OS_COMPLETED );
  446.         CallUserEvent( UE_OBJECTIVE_CHANGED );
  447.     }
  448. }
  449. //============================================================================================================================
  450. public Help(DrID:Unit)
  451. {
  452.     static counter = 0;
  453.     if(counter == 5)
  454.         RemoveEvent( "Help" );
  455.     else
  456.     {
  457.         new Iterator:i = Iterate( gHelperz );
  458.         
  459.         while(ItNext( i )) 
  460.         {
  461.             new DrID:Helper = ItEntity( i );
  462.             if(IsAlive(Helper))
  463.             {
  464.                 CmdMoveToEnt( Helper, Unit, Q_ENQUEUE, MF_ATTACKMOVE );
  465.             }
  466.         }
  467.     }
  468.     counter++;
  469. }
  470. //============================================================================================================================
  471. public HiddenObjective()
  472. {
  473.     DestFueltank++;
  474. }
  475. //============================================================================================================================
  476. public SecondaryObjective()
  477. {
  478.     DestWarehouse++;
  479.     PortHouseInfo();
  480. }
  481. //============================================================================================================================
  482. public Intro()
  483. {
  484.     SetCutScene(true, true, true);
  485.  
  486.     SetSpeedInSelector( gIntro2, 8.0 );
  487.     FormationMoveToEnt(gIntro2,GetEntity(gStartWP2),Q_OVERRIDE, MF_DIRECT);
  488.     AddAKEntityEvent( "IntroSpeech", GetEntity( gActor1 ), UNIT_ARRIVED );
  489.     
  490.     TeleportCameraToEnt(GetEntity( gActor1 ));    
  491.     CameraFollow( GetEntity( gActor1 ) );
  492.     
  493.     SetCameraPitchSpeed(30.0);
  494.     SetCameraZoomSpeed(2.0);
  495.     SetCameraRotSpeed(2.0);
  496.     
  497.     SetCameraActualPitch(85.0);
  498.     SetCameraActualDistance(35.0);
  499.     SetCameraActualRotate(90.0);
  500.     
  501.     SetCameraTargetPitch(85.0);
  502.     SetCameraTargetDistance(35.0);
  503.     SetCameraTargetRotate(90.0);
  504.  
  505.     SetCameraTargetRotate(-89.0);
  506.     SetCameraTargetDistance( 30.0 );
  507.     SetCameraTargetPitch( 55.0 );
  508. }
  509. public IntroSpeech()
  510. {
  511.     static counter = 0;
  512.  
  513.     switch(counter)
  514.     {
  515.         case 0:    
  516.         {
  517.             RemoveEvent("IntroSpeech");
  518.             AddAKEntityEvent( "IntroSpeech", ANY_ENTITY, MESSAGE_END );
  519.             AddSoundMessage(iMS06_SP001, gSoundFile1);
  520.             CameraFollow(  DrID:0 );
  521.         }        
  522.         
  523.         case 1: 
  524.         {
  525.             RemoveEvent( "IntroSpeech" );
  526.             AddTimerEvent( "IntroSpeech", 2.0, "GameLogic", true );
  527.             SetSpeedInSelector( gIntro1, 8.0 );
  528.             FormationMoveToEnt(gIntro1,GetEntity(gStartWP1),Q_OVERRIDE, MF_DIRECT);
  529.         }
  530.         
  531.         case 2:    
  532.         {
  533.             RemoveEvent("IntroSpeech");
  534.             TeleportCameraToEnt(GetEntity( gActor2 ));    
  535.             CameraFollow( GetEntity( gActor2 ) );
  536.         
  537.             SetCameraRotSpeed(5.5);
  538.  
  539.             SetCameraActualPitch(85.0);
  540.             SetCameraActualDistance(30.0);
  541.             SetCameraActualRotate(90.0);
  542.             
  543.             SetCameraTargetPitch(85.0);
  544.             SetCameraTargetDistance(30.0);
  545.             SetCameraTargetRotate(90.0);
  546.  
  547.             SetCameraTargetRotate(-1.0);
  548.             SetCameraTargetDistance( 40.0 );
  549.             SetCameraTargetPitch( 55.0 );
  550.  
  551.             AddSoundMessage(iMS06_SP002, gSoundFile2);
  552.             AddAKEntityEvent( "IntroOver", GetEntity(gActor2), UNIT_ARRIVED );
  553.         }
  554.     }
  555.     counter++;
  556. }
  557.  
  558. public IntroOver()
  559. {
  560.     RemoveEvent( "IntroOver" );
  561.     SetCutScene(false);
  562.     CameraFollow( DrID:0 );
  563.     ResetCameraSpeed();
  564.  
  565.     SetSpeedInSelector( gIntro1, 0.0 );
  566.     SetSpeedInSelector( gIntro2, 0.0 );
  567.     HackAntiAirInit();
  568.  
  569. //Ojjektivak
  570.     SetObjectiveState( "PRI_Port", OS_IN_PROGRESS );
  571.     SetObjectiveState( "SEC_AirDefense", OS_IN_PROGRESS );
  572.     SetObjectiveState( "HID_OilTanks", OS_IN_PROGRESS );
  573.     
  574.     SetPropertyBool( GetEntity( "hq" ), "VisibleOnMiniMap", true );
  575. }
  576. //============================================================================================================================
  577. public DestroyCutscene()
  578. {
  579.     SetCutScene(true, false, true);
  580.     new Float:Pos[vec3];
  581.     GetPropertyVec3( GetEntity(gHouse1), "LogicalPos_", Pos );
  582.     new DrID:Fow = CreateEntity( "fowbacon_30", Pos );
  583.     SetPropertyString( Fow, "StringID", "HouseFOW" );
  584.     SetPropertyInt( Fow, "Team", gPlayerTeam );
  585.     SetPropertyBool( Fow, "GadgetsVisible", false );
  586.     RefreshFOW();
  587.     CamPosStore();
  588.     TeleportCameraToEnt(GetEntity( gHouse1 ));
  589.     
  590.     SetCameraPitchSpeed(30.0);
  591.     SetCameraZoomSpeed(2.0);
  592.     SetCameraRotSpeed(2.0);
  593.  
  594.     SetCameraActualDistance( 45.0 );
  595.     SetCameraActualPitch( 65.0 );
  596.     SetCameraActualRotate( 90.0 );
  597.  
  598.     SetCameraTargetDistance( 45.0 );
  599.     SetCameraTargetPitch( 65.0 );
  600.     SetCameraTargetRotate( 90.0 );
  601.  
  602.     SetCameraTargetDistance( 55.0 );
  603.     SetCameraTargetPitch( 45.0 );
  604.     SetCameraTargetRotate( 180.0 );
  605.  
  606.     AddSoundMessage(iMS06_SP003, gSoundFile3);
  607.     AddSoundMessage(iMS06_SP004, gSoundFile4);
  608. //     AddAKEntityEvent( "DestroyCutsceneOver", ANY_ENTITY, MESSAGE_END );
  609.     AddTimerEvent( "DestroyCutsceneOver", 10.0, "GameLogic", true);
  610. }
  611. //============================================================================================================================
  612. public DestroyCutsceneOver()
  613. {
  614.     RemoveEvent( "DestroyCutsceneOver" );
  615.     CamPosRestore();
  616.     SetPropertyFloat( GetEntity( "HouseFOW" ), "FOWRangeRadius", 0.0 );
  617.     SetPropertyInt( GetEntity( "HouseFOW" ), "Team", 0 );
  618.     SetCutScene(false, false, true);    
  619.     SetCountDown( floatround(gOra)*4 );
  620.     AddTimerEvent( "DestroyAgain", gOra-10.0, "GameLogic", true );
  621.     SetObjectiveState( "SEC_PortDestroyed", OS_IN_PROGRESS );
  622.     PortHouseInfo();
  623. }
  624. //============================================================================================================================
  625. public FueltankDestroyCutscene()
  626. {
  627.     RemoveEvent( "FueltankDestroyCutscene" );
  628.     BulletTime(GetEntity( gfueltank1 ), true, false, false, 30.0, 40.0 );
  629.     AddUserEvent( "HiddenIsFailed", UE_BULLETTIME_END );
  630. }
  631. //============================================================================================================================
  632. public SetNationality(group[], nationality[])
  633. {
  634.     new Iterator:i = Iterate( group );
  635.  
  636.     while(ItNext(i))
  637.     {
  638.         new DrID:Unit = ItEntity(i);
  639.         SetPropertyString( Unit, "Nationality", nationality );
  640.     }
  641. }
  642. //============================================================================================================================
  643. public DawnToDay()
  644. {
  645.     static Float:light = 0.55;
  646.     
  647.     if(light >= 1.0)
  648.     {
  649.         RemoveEvent( "DawnToDay" );
  650.         SetPropertyFloat( GetWorld(), "AmbientIntensity",  1.0); 
  651.         SetPropertyFloat( GetWorld(), "DirLightIntensity",  1.0); 
  652.     }
  653.     else
  654.     {
  655.         light+= 0.001;
  656.         SetPropertyFloat( GetWorld(), "AmbientIntensity",  light); 
  657.         SetPropertyFloat( GetWorld(), "DirLightIntensity",  light); 
  658.  
  659.         //debug
  660. /*        new tmpstr1[255];
  661.         new tmpstr2[255];
  662.         Float2Str( light, tmpstr1, 254 );
  663.         Float2Str( Fog, tmpstr2, 254 );
  664.         ConcatString( tmpstr1, 255, tmpstr1, "#b#" );
  665.         ConcatString( tmpstr1, 255, tmpstr1, tmpstr2 );
  666.         SetShortInfo(tmpstr1);*/
  667.         
  668.     }
  669. }
  670. //============================================================================================================================
  671. public BunkerDamaged(DrID:Building)
  672. {
  673.     new Float:MaxHP=GetPropertyFloat( GetPropertyObject(GetBaseComponentBase(GetBaseEntity(Building), "cDRBuildingBase"), "Body"), "HP" );
  674.     new Float:ActHP=GetPropertyFloat( GetPropertyObject(GetComponent( Building, "cDRBuilding"), "Body"), "HP" );
  675.     
  676.     if(GetEntity(gSmallbunker1) == Building)
  677.     {
  678.         if(RunOnce[2] == false && ActHP <= MaxHP/4)
  679.         {
  680.             RunOnce[2] = true;
  681.             CmdGroupSetMS( gBunkercrew1, Q_OVERRIDE, MS_RUN );
  682.             CmdGroupUnmount( gBunkercrew1, Q_ENQUEUE );    
  683.             CmdGroupMount( gBunkercrew1, Q_ENQUEUE, GetEntity( gHelphouse1 ) );
  684.         }
  685.     }
  686.  
  687.     if(GetEntity(gSmallbunker2) == Building)
  688.     {
  689.         if(RunOnce[3] == false && ActHP <= MaxHP/4)
  690.         {
  691.             RunOnce[3] = true;
  692.             CmdGroupSetMS( gBunkercrew2, Q_OVERRIDE, MS_RUN );
  693.             CmdGroupUnmount( gBunkercrew2, Q_ENQUEUE );    
  694.             CmdGroupMount( gBunkercrew2, Q_ENQUEUE, GetEntity( gHelphouse2 ) );
  695.         }
  696.     }
  697.     
  698.     if(GetEntity(gSmallbunker3) == Building)
  699.     {
  700.         if(RunOnce[4] == false && ActHP <= MaxHP/4)
  701.         {
  702.             RunOnce[4] = true;
  703.             CmdGroupSetMS( gBunkercrew3, Q_OVERRIDE, MS_RUN );
  704.             CmdGroupUnmount( gBunkercrew3, Q_ENQUEUE );    
  705.             CmdGroupMount( gBunkercrew3, Q_ENQUEUE, GetEntity( gHelphouse3 ) );
  706.         }
  707.     }
  708. }
  709. //============================================================================================================================
  710. public Victory()
  711. {
  712.     RemoveEvent( "Victory" );
  713.     
  714.     AddDebriefing("#iMISSION06_DB_P#");
  715.  
  716.     if(GetObjectiveState( "SEC_PortDestroyed" ) == OS_COMPLETED)
  717.         AddDebriefing("#iMISSION06_DB_S#");    
  718.     
  719.     EndMission(MS_ACCOMPLISHED);
  720. }
  721. public GameOver()
  722. {
  723.     RemoveEvent( "GameOver" );
  724.  
  725.     AddDebriefing("#iMISSION_DB_F#");
  726.     EndMission(MS_FAILED);
  727. }
  728.  
  729. // public kiiras()
  730. // {
  731. //     ShowShortMessageP1( "gFueltanksum %d", gFueltanksum );
  732. //     ShowShortMessageP1( "DestFueltank %d", DestFueltank );
  733. //     ShowShortMessageP1( "gWarehouse %d", gWarehouse );
  734. //     ShowShortMessageP1( "DestWarehouse %d", DestWarehouse );
  735. // }
  736.  
  737. public PZIsSeleceted(DrID:Unit)
  738. {
  739.     if(GetEntity( "panzer" ) == Unit)
  740.     {
  741.         RemoveEvent( "PZIsSeleceted" );
  742.         AddSoundMessage("#iMS06_SP008#", gSoundFile1);
  743.     }
  744. }
  745.  
  746. public Add2GermanGroup()
  747. {
  748.     new Iterator:i = Iterate( "SelectorTeam1" );
  749.     while(ItNext( i ))
  750.     {
  751.         if(IsInstanceOf( ItEntity( i ), GetClassID( "cVehicle" )))
  752.             AddToGroup( "grp_German", ItEntity( i ) );
  753.     }
  754.     ItStop( i );
  755.  
  756. }
  757.  
  758. public PortHouseInfo()
  759. {
  760.     static HouseNum = 0;
  761.     HouseNum = CountLivingInSelector( gPorthouses );
  762.     
  763.     if(HouseNum == 0)
  764.     {
  765.         SetShortInfo("");
  766.         CountDownDone();
  767.         return;
  768.     }
  769.     new HouseNumSTR[2];
  770.     Int2Str( HouseNum, HouseNumSTR, 2 );
  771.     new OriginalHouseNumSTR[2];
  772.     Int2Str( gWarehouse, OriginalHouseNumSTR, 2 );
  773.  
  774.     new WareHouseSTR[] = "#d##iMS06_MSG001#";
  775.     new Separator[] = "#d#:";
  776.     
  777.     new tmpstr1[20];
  778.     new tmpstr2[40];
  779.     new tmpstr3[60];
  780.     
  781.     
  782.     ConcatString( tmpstr1, 20, WareHouseSTR, HouseNumSTR );
  783.     ConcatString( tmpstr2, 40, tmpstr1, Separator );
  784.     ConcatString( tmpstr3, 55, tmpstr2, OriginalHouseNumSTR );
  785.     ConcatString( tmpstr3, 60, "#d#", tmpstr3 );
  786.     
  787.     SetShortInfo(tmpstr3);
  788. }
  789.  
  790. public HiddenIsFailed()
  791. {
  792.     RemoveEvent( "HiddenIsFailed" );
  793.     SetObjectiveState( "HID_OilTanks", OS_FAILED );
  794.     SetGlobalVariable("gvMS06_OilTankz", 0);
  795. }
  796.  
  797. public ScenarioMode()
  798. {
  799.     new Iterator:i = Iterate( "StartingPlayerUnits" );
  800.     while(ItNext( i ))
  801.     {
  802.         AddToGroup( "grp_intro1", ItEntity( i ) );    
  803.     }
  804.     ItStop( i );
  805. }
  806.  
  807. public RandomWaterImpact()
  808. {
  809.     new Float:AreaPos[vec3];
  810.     new Float:RndPos[vec3];
  811.     new DrID:area = GetEntity( "area_random_impact" );
  812.     GetPropertyVec3( area, "LogicalPos_", AreaPos )
  813.     RndPos[vec3:x] = FloatRnd( -(GetPropertyFloat( area, "SizeX" )/2), (GetPropertyFloat( area, "SizeX" )/2) )+AreaPos[vec3:x];
  814.     RndPos[vec3:y] = FloatRnd( -(GetPropertyFloat( area, "SizeY" )/2), (GetPropertyFloat( area, "SizeY" )/2) )+AreaPos[vec3:y];
  815.     RndPos[vec3:z] = 0.0;
  816.     new DrID:Effect = CreateEntity( "patricle_water_impact", RndPos );
  817.     if(Effect==DrID:0)
  818.     {
  819.         DebugMessage( "Effect name is not valid or do not exist!", DL_WARNING );
  820.     }
  821.     else
  822.     {
  823.         AddToGroup( "particle", Effect );
  824.     }
  825. }
  826.  
  827. public ParticleDestroyer()
  828. {
  829.     new Iterator:i = Iterate( "particle", "cAKEntity" );
  830.     while(ItNext(i))
  831.         DestructEntity( ItEntity(i) );
  832.  
  833.     ItStop(i);
  834. }
  835.  
  836. public GlobalGroupRemover(DrID:Unit)
  837. {
  838.     GroupRemover(Unit);
  839. }
  840.