home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 September / GSSH0904CD1.iso / MedievalLords / MedievalLordsMaps.exe / 004400650073006500720074.scn / Desert_Gameplay.scp < prev    next >
Text File  |  2004-09-14  |  13KB  |  469 lines

  1. // CrΘation des variables
  2.  
  3. s32 delaimodif;
  4. s32 delai;
  5. s32 goldviking;
  6. s32 NbrAttackViking;
  7.  
  8. s32 Choix;
  9. s32 pop_seuil;
  10. s32 seuil_max;
  11. s32 Message_avertissement;
  12. s32 V2_Free;
  13. s32 fief_sarasins_Dead;
  14. s32 voleurs_sarasins_Dead;
  15.  
  16. s32 Message_objective1_ok;
  17. s32 Message_objective2_ok;
  18. s32 Message_objective3_ok;
  19.  
  20. s32 Enough_Plow;
  21. s32 Enough_Watermill;
  22. s32 Enough_Windmill;
  23.  
  24. s32 Enough_UpgradeProduction;
  25.  
  26.  
  27. s32 InitGame()
  28. {
  29.  
  30. //    Inutile: ScΘnario α downloader
  31. //    SetMissionID(7,0);
  32.  
  33.        StopAllFunctions();  
  34.     InitVariables();
  35.     SetMonthYear(0,1000);
  36.  
  37.  
  38.     LockPrototypeDestruction("wells",1);
  39.  
  40.     SetKeyTitle("DESERT_TITLE");
  41.     SetKeyHistory("DESERT_BRIEFING");
  42.  
  43.     
  44.     BlockPosingCell( "CELL_124" );    
  45.  
  46.     AddForbiddenProto("5_Architect_Workshop");             // On bloque ces technologies pour le scΘnario
  47.  
  48.  
  49.     AddForbiddenProto("Wells");                     // On bloque ces technologies pour le scΘnario
  50.     AddForbiddenProto("Fountain");
  51.     AddForbiddenProto("Worked_Fountain");
  52.     
  53.     Objective1Start();                        // On lance le premier objectif
  54.                         
  55.     s32 TreasureStart;
  56.     TreasureStart = 2000.0*Diff_GetTreasureAtStartFactor();
  57.     SetTreasure(TreasureStart);                        
  58.  
  59.     ExecEverySec("BeginFood", 2);
  60.  
  61.     InitVariables();
  62.  
  63.     CreateEnemies();
  64.  
  65. //    VΘrification des technologies rΘcupΘrΘes sur le terrain + Terrain gagnΘ
  66.     Army_SetOnLooseSiegeFunction("desert_V2","Set_V2_Free");
  67.     Army_SetOnLooseSiegeFunction("desert_V1","Check_voleurs_sarasins_Dead");
  68.  
  69.  
  70. //    VΘrification des technologies rΘcupΘrΘes sur le terrain
  71.     Army_SetOnLooseAllInvasionFunction("fief_sarasins","CheckRecupTechno_fief");
  72.     Army_SetOnLooseSiegeFunction("desert_V3","CheckRecupTechno_V3");
  73.  
  74.  
  75. //    ShowStartGame("DESERT_OBJECTIFS");
  76.     ExplicationDesert();
  77.  
  78.     SetObjective(1,"DESERT_OBJECTIFS_01"); 
  79.     SetObjective(2,"DESERT_OBJECTIFS_02");
  80.     SetObjective(3,"DESERT_OBJECTIFS_03");
  81.  
  82.     PrepareCityLevelAndUpsetStandard();
  83.     PrepareCityLevelAndUpset_Desert();    // RΘglage de la baisse des taxes si pas de modifications bien_Ωtre des habitants
  84.  
  85.     SetPercentSoldiersMax(50);
  86.  
  87.     InitGeneralsToDungeons();
  88. }
  89.  
  90.  
  91. s32 InitVariables()                            // On initialise les variables α 0
  92. {
  93.     delaimodif            =    0;
  94.     delai                =    480;
  95.     goldviking                =    3000;
  96.     NbrAttackViking            =    0;
  97.  
  98.     seuil_max                =    800;
  99.     pop_seuil                =    200;
  100.     Message_avertissement        =    0;
  101.  
  102.     V2_Free                =    0;    
  103.     fief_sarasins_Dead            =    0;
  104.     voleurs_sarasins_Dead        =    0;
  105.  
  106.     Message_objective1_ok        =    0;
  107.     Message_objective1_ok        =     0;
  108.     Message_objective1_ok        =     0;
  109.  
  110.     Enough_Plow            =    0;
  111.     Enough_Watermill            =    0;
  112.     Enough_Windmill            =    0;
  113.  
  114.     Enough_UpgradeProduction        =    0;
  115. }
  116.  
  117. //=====================
  118. //= Les Brigands sont ΘliminΘs
  119.  
  120. s32 Set_V2_Free(mcString name)
  121. {
  122.     V2_Free = 1;
  123. }
  124.  
  125.  
  126. s32 ExplicationDesert()
  127. {
  128.     
  129.     ExecInFewSec("Cut_scene_on",0);
  130.  
  131.  
  132.     BlocAllInterfaceExceptWidget("BOX_USERMESSAGE_PAUSE_TEXT_CLOSE_BUTTON");
  133.  
  134.  
  135.     SetCurCameraDirectionNbMilliSec(4000,5024.6,4515.2,26000.0,45518.9,48789.5,-71266.0);
  136.     SetCurCameraDirectionNbMilliSec(2000,5024.6,4515.2,26000.0,45518.9,48789.5,-71266.0);
  137.  
  138.     SetCurCameraDirectionNbMilliSec(4000,57547.3,22716.8,26000.0,90570.9,72811.1,-75162.1);
  139.     SetCurCameraDirectionNbMilliSec(3000,57547.3,22716.8,26000.0,90570.9,72811.1,-75162.1);
  140.  
  141.     SetCurCameraDirectionNbMilliSec(4000,133547.4,26194.0,26000.0,130239.1,86102.8,-75177.0);
  142.     SetCurCameraDirectionNbMilliSec(2000,133547.4,26194.0,26000.0,130239.1,86102.8,-75177.0);
  143.  
  144.     SetCurCameraDirectionNbMilliSec(4000,133192.0,122367.4,26000.0,148781.2,180306.8,-74159.3);
  145.     SetCurCameraDirectionNbMilliSec(2000,133192.0,122367.4,26000.0,148781.2,180306.8,-74159.3);
  146.  
  147.     SetCurCameraDirectionNbMilliSec(4000,5024.6,4515.2,26000.0,45518.9,48789.5,-71266.0);
  148.  
  149.  
  150.     StopBlocAllInterface();
  151.     Cut_scene_off();    
  152.     MessageUserPause("DESERT_INDICATIONS");
  153.     
  154.     ShowStartGame("DESERT_OBJECTIFS");
  155.  
  156. }
  157.  
  158.  
  159.  
  160.  
  161. s32 CheckRecupTechno_fief(mcString name)
  162. {
  163.     fief_sarasins_Dead =1;
  164.     MessageUserPause("DESERT_FIEF_SARASINS_DEAD");
  165.     UndoForbiddenProto("5_Architect_Workshop");
  166. }
  167.  
  168. s32 CheckRecupTechno_V3(mcString name)
  169. {
  170.     UndoForbiddenProto("5_Architect_Workshop");
  171. }
  172.  
  173. s32 Check_voleurs_sarasins_Dead(mcString name)
  174. {
  175.     voleurs_sarasins_Dead =1;
  176.     MessageUserPause("DESERT_VOLEURS_SARASINS_DEAD");
  177. }
  178.  
  179.  
  180. //==============================================================================
  181. void StartGame()
  182. {
  183.     ForcePlayerConstruction("Fortified_House");        // Le joueur doit commencer par poser sa Fortified House
  184.  
  185.      SetWaterSecurityFeelingLevel(2);
  186.  
  187.     SetRazziaDelay(240);
  188.     SetRazziaAleaDelay(120);
  189.     SetWaitPeriodBeforeFirstRazzia(420);
  190.  
  191.     SetCataGlobalFactor(1.0);                //pour rΘgler gloalement la force des cata
  192.     
  193. }
  194.  
  195.  
  196. //==============================================================================
  197. // Condition de dΘfaite : prise de la maison fortifiΘe
  198. s32 FailCondition1()
  199. {
  200.     if(IsMainTowerDestroyed())
  201.     {
  202.         ExecInFewSec("Defeat_Message_Condition1",3);
  203.     }
  204. }
  205.  
  206.  
  207.  
  208. // Condition de dΘfaite : autre que prise de la maison fortifiΘe
  209. s32 Defeat_Message_Condition1()
  210. {
  211.     PlayerDefeat("LOOSE_DUNGEON");  
  212. }
  213.  
  214.  
  215. //==============================================================================
  216. //==============================================================================
  217. s32 Objective1Start()                  
  218. {                                                            
  219.     ExecEverySec("Objective1TestEnd", 5); 
  220. }
  221.  
  222. s32 BeginFood()
  223. {
  224.     if (GetNbGranaries()>0)
  225.     {
  226.     StopFunction("BeginFood");
  227.  
  228.     DeclareCataDesert();                // On lance la dΘclaration des diffΘrentes catastrophes (voir Terres_Cata.scp)
  229.     ExecInFewSec("TestCataDesert",600);            // On execute le lancement d'un catastrophe dans X secondes (voir Terres_Cata.scp)
  230.  
  231.     s32 FoodStart;
  232.     FoodStart = 400.0*Diff_GetFoodAtStartFactor();
  233.     SetFood (FoodStart);
  234.  
  235.     
  236.     ExecInFewSecNoBattle("Check_Invasion", delai);
  237.  
  238.     ExecEverySec("Seuil", 10);
  239.  
  240.     ExecEverySec("POP_OBJ_TEST", 10);
  241.  
  242.     ExecEverySec("FailCondition1", 5);    
  243.     UnblockPosingCell( "CELL_124" );    
  244.     }
  245. }
  246.  
  247. s32 POP_OBJ_TEST()
  248. {
  249.     if(V2_Free == 1)
  250.     {
  251.         if (Message_objective1_ok==0)
  252.         {    
  253.             MessageUserPause("OBJECTIVE1_OK");
  254.             Message_objective1_ok=1;
  255.         }
  256.     SetObjectiveSucceed(1); 
  257.     }
  258.     
  259.     if(V2_Free != 1)
  260.     {
  261.     SetObjectiveFailed(1); 
  262.     }
  263.  
  264.  
  265.  
  266.     Enough_Plow=((GetNbProtoOnTerritory("Plow","CELL_124"))+(GetNbProtoOnTerritory("plow","CELL_2220"))+(GetNbProtoOnTerritory("plow","CELL_2223")));
  267.     Enough_Watermill=((GetNbProtoOnTerritory("Watermill","CELL_124"))+(GetNbProtoOnTerritory("Watermill","CELL_2220"))+(GetNbProtoOnTerritory("Watermill","CELL_2223")));
  268.     Enough_Windmill=((GetNbProtoOnTerritory("Windmill","CELL_124"))+(GetNbProtoOnTerritory("Windmill","CELL_2220"))+(GetNbProtoOnTerritory("Windmill","CELL_2223")));
  269.  
  270.     if((Enough_Plow >= 4 ) && (Enough_Watermill >= 4) && (Enough_Windmill >= 4))
  271.     {
  272.     Enough_UpgradeProduction = 1;
  273.         if (Message_objective2_ok==0)
  274.         {    
  275.             lightmessage ("OBJECTIVE2_OK","GFX_ADVISOR_POP_UP_SELECTION",10,5);
  276.             Message_objective2_ok=1;
  277.         }
  278.     SetObjectiveSucceed(2); 
  279.     }
  280.     else
  281.     {
  282.     SetObjectiveFailed(2);
  283.     }
  284.  
  285.  
  286.  
  287.     if(GetNbHousesByLevelOnTerritory( 7,"CELL_124")>=15)
  288.     {
  289.         if (Message_objective3_ok==0)
  290.         {    
  291.             lightmessage ("OBJECTIVE3_OK","GFX_ADVISOR_POP_UP_SELECTION",10,5);
  292.             Message_objective1_ok=1;
  293.         }
  294.     SetObjectiveSucceed(3); 
  295.     }
  296.     
  297.     if(GetNbHousesByLevelOnTerritory( 7,"CELL_124")<15)
  298.     {
  299.     SetObjectiveFailed(3); 
  300.     }
  301. }
  302.  
  303.  
  304. s32 Objective1TestEnd()                  
  305. {
  306.     if((V2_Free == 1) && ( Enough_UpgradeProduction == 1) && (GetNbHousesByLevelOnTerritory( 7,"CELL_124")>=15)) 
  307.     {
  308.         StopFunction("Objective1TestEnd");             // pour arreter cette fonction particuliΦre
  309.         SetObjectiveSucceed(1);
  310.         PlayerVictory("DESERT_DEBRIEFING"); 
  311.  
  312. //    On dΘbloque toutes les technologies par sΘcuritΘ.
  313.         UndoForbiddenProto("1_Carpenter_Workshop");
  314.         UndoForbiddenProto("2_Blacksmith_Workshop");
  315.         UndoForbiddenProto("3_Mecanician_Workshop");
  316.         UndoForbiddenProto("4_Mason_Workshop");
  317.         UndoForbiddenProto("5_Architect_Workshop");
  318.         UndoForbiddenProto("6_Ingeneer_Workshop");
  319.     }                                                           
  320.  
  321.  
  322. //==============================================================================
  323. //==============================================================================
  324. s32 Check_Invasion()
  325. {
  326.     if(delaimodif==1)
  327.     {
  328.     delai=delai-840;
  329.     delaimodif=0;
  330.     }
  331.  
  332.     if(voleurs_sarasins_Dead  == 1)
  333.     {
  334.         StopFunction("Check_Invasion"); 
  335.     }
  336.     else
  337.     {
  338.         if ((GetPopulationAndSoldiers()>=50) && (GetTreasure()>=(goldviking+5000)))
  339.         {
  340.             s32 Answer;
  341.             replacetxtinnextmsg ("PROPOSITION_INVASION",goldviking);
  342.             Answer = AskPlayerYesNo("ARMY_INVASION_PREPAREINVASION");
  343.             if (Answer == 1)
  344.             {
  345.                 AddGold(-goldviking);
  346.                 Army_Reinforcement("desert_voleurs_sarasins",1.2,2.0);  //multiplieur, multi MAXIMUM
  347.                 goldviking=goldviking+500;
  348.             }
  349.             else
  350.             {
  351.                 Army_StartInvasion("desert_voleurs_sarasins");
  352.                 delai=delai+840;
  353.                 delaimodif=1;
  354.             }
  355.         }
  356.         ExecInFewSecNoBattle("Check_Invasion", delai);
  357.     }
  358. }
  359.  
  360. //==============================================================================
  361. //==============================================================================
  362. s32 Seuil()
  363. {
  364.     if(fief_sarasins_Dead == 1)
  365.     {
  366.         StopFunction("Seuil"); 
  367.     }
  368.     else
  369.     {
  370.         if(pop_seuil >= seuil_max)
  371.         {
  372.             StopFunction("Seuil"); 
  373.         }
  374.         else
  375.         {
  376.             if(GetPopulationAndSoldiers() >= pop_seuil)
  377.             {
  378.                 Attack();
  379.                 pop_seuil = pop_seuil + 150;
  380.             }
  381.     
  382.         }
  383.     }        
  384. }
  385.  
  386. //---------------
  387.  
  388. s32 Attack()
  389. {
  390. Choix = Random(2);
  391.  
  392. if(Message_avertissement==0)
  393. {
  394.     MessageUserPause("DESERTATTAK_INVASION");
  395.     Message_avertissement = 1;
  396. }
  397.  
  398.  
  399. if(Choix == 0)
  400.     {
  401.         
  402.         Army_StartInvasion("desert_mercenaires01_sarasins");
  403.         Army_Reinforcement("desert_mercenaires01_sarasins",1.2,2.0);
  404.  
  405.     }
  406. else
  407.     {
  408.         Army_StartInvasion("desert_mercenaires02_sarasins");
  409.         Army_Reinforcement("desert_mercenaires02_sarasins",1.2,2.0);
  410.     }
  411. }
  412.  
  413. //==============================================================================
  414. //==============================================================================
  415.  
  416. s32 CreateEnemies()       
  417. {
  418.  
  419. // Create Brigands "nom brigand",troop_attack,men_attack,toop_def,men_def,"model",facteur augmentation, attackdelay,defdelay
  420.  
  421. //     Create Brigands     "nom brigand",        troop_attack,    men_attack,    troop_def,    men_def,        troop_inva,    men_inva,    "model",        facteur augmentation,     attackdelay,    defdelay,        Gold,    Food
  422.     CreateBrigand(    "desert_B1",        4,        6,        6,        8,        4,        6,        "THIEVES",    0.5,            25,        30,        300,    300);
  423.     Army_SetDistanceTreveDeDieu("desert_B1", 40.0); // en metres.
  424.     Army_SetTextureFace("desert_B1", "ENNEMI_HEAD_07");
  425.  
  426.     CreateBrigand(    "desert_B2",        4,        6,        6,        8,        4,        6,        "THIEVES",    0.5,            25,        30,        300,    300);
  427.     Army_SetDistanceTreveDeDieu("desert_B2", 50.0); // en metres.
  428.     Army_SetTextureFace("desert_B2", "ENNEMI_HEAD_04");
  429.  
  430.  
  431. //    CreateVillage    "nom du village"      "model"         temps de preparation,    Gold,    Food
  432.     CreateVillage(    "desert_V1",    "SARRASIN",    30,            2000,    300);
  433.     Army_SetDistanceTreveDeDieu("desert_V1", 30.0); // en metres.
  434.     Army_SetTextureFace("desert_V1", "ENNEMI_HEAD_09");
  435.     
  436.     CreateVillage(    "desert_V2",    "SARRASIN",    50,            600,    1200);
  437.     Army_SetDistanceTreveDeDieu("desert_V2", 40.0); // en metres.
  438.     Army_SetTextureFace("desert_V2", "ENNEMI_HEAD_10");
  439.     
  440.     CreateVillage(    "desert_V3",    "SARRASIN",    30,            1000,    800);
  441.     Army_SetDistanceTreveDeDieu("desert_V3", 50.0); // en metres.
  442.     Army_SetTextureFace("desert_V3", "ENNEMI_HEAD_10");
  443.  
  444.  
  445. //    Createfief         "nom fief",        troop_attack,    men_attack,    troop_def,        men_def,        troop_invasion,    men_invasion,    model,        augmentation,    atackdelay,    defdelay,        invasiondelay,    Gold    Food
  446.     Createfief(    "fief_sarasins",        8,        8,        12,        12,        10,        12,        "SARRASIN",    1.0,        15,        120,        140,        1200,    800  );  
  447.     Army_SetDistanceTreveDeDieu("fief_sarasins", 55.0); // en metres.
  448.     Army_SetTextureFace("fief_sarasins", "ENNEMI_HEAD_10");
  449.  
  450.  
  451. //     CreateInvasion(    "nom invasion",        troop_attack,    men_attack,    troop_invasion,    men_invasion ,    "model",            atackdelay,    invasiondelay)
  452.      CreateInvasion(    "desert_mercenaires01_sarasins",        8,        12,        10,        8,        "SARRASIN_RIDER",    5,        10);
  453.     Army_SetTextureFace("desert_mercenaires01_sarasins", "ENNEMI_HEAD_10");
  454.  
  455. //     CreateInvasion(    "nom invasion",        troop_attack,    men_attack,    troop_invasion,    men_invasion ,    "model",            atackdelay,    invasiondelay)
  456.      CreateInvasion(    "desert_mercenaires02_sarasins",        8,        12,        10,        8,        "SARRASIN_RIDER",    5,        10);
  457.     Army_SetTextureFace("desert_mercenaires02_sarasins", "ENNEMI_HEAD_10");
  458.  
  459. //     CreateInvasion(    "nom invasion",        troop_attack,    men_attack,    troop_invasion,    men_invasion ,    "model",            atackdelay,    invasiondelay)
  460.      CreateInvasion(    "desert_voleurs_sarasins",        8,        8,        8,        8,        "SARRASIN_RIDER",    5,        10);
  461.     Army_SetTextureFace("desert_voleurs_sarasins", "ENNEMI_HEAD_09");
  462. }
  463.  
  464.  
  465.  
  466. //==============================================================================
  467. //==============================================================================
  468.