Ил-2 Штурмовик: Битва за Британию. Скрипты. Скрипты для чайников. Часть 1 - Загрузка подмиссий — различия между версиями

Материал из АвиаВики
Перейти к: навигация, поиск
Строка 141: Строка 141:
 
Destroy ground targets only on 6, nothing happens!  
 
Destroy ground targets only on 6, nothing happens!  
  
''Здесь должен быть файл Sfdp1-7.jpg''
+
[[Файл:Sfdp1-777.jpg|800px]]
  
  

Версия 21:01, 4 октября 2011

Автор: FG28_Kodiak
Ссылка: Перейти (перевод Google)

Cliffs of Dover with the help of the scripting language provides the ability to missions in ongoing missions to load. This is an interesting turn for online server, on the other hand, this results in even very interesting possibilities for offline missions. One can make the game world as living by existing missions to the current charges, or give the missions a certain amount of randomness by randomly selecting one of several submissions and invites you to take. Also, this example is stored in the possibility of a ground battle in one submission at the right moment to load via triggers, so that the player not only matters when everything is over, etc.

Invite us to a mission, the gameplay, the class method void gpPostMissionLoad (string filename) are available.

Usage example:

GamePlay.gpPostMissionLoad ("missions \ \ music \ \ samples \ \ test submissions \ \ TestSubMission1.mis"); 

The double \ \ in C # is necessary to demonstrate the system to the \ character is meant to be, because the \ in C # also introduces control sequences.

It is also possible to use the normal slash. GamePlay.gpPostMissionLoad ("Missions / Single / samples / test submissions / TestSubMission.mis");

Suppose you want a couple of submissions at the beginning of the mission to load.

At the beginning of the Mission Cliffs of Dover, the method public virtual void OnBattleStarted () (is AMission of Campaign and others made available) is called. This we can overload our submissions and invite as equal at the start.

So:

public override void OnBattleStarted () 
{ 
base.OnBattleStarted (); 
MissionNumberListener = -1;
GamePlay.gpPostMissionLoad ("missions \ \ music \ \ samples \ \ test submissions \ \ TestSubMission1.mis"); 
GamePlay.gpPostMissionLoad ("missions \ \ music \ \ samples \ \ test submissions \ \ TestSubMission2.mis"); 
GamePlay.gpPostMissionLoad ("missions \ \ music \ \ samples \ \ test submissions \ \ TestSubMission3.mis"); 
} 

Explanation: base.OnBattleStarted () serves the original method call once to initialize properly at all.

MissionNumberListener = -1 sets the script is also responsible for all the events charged Submission. Otherwise, you could specify here the (get the first loaded the mission number one, the second number 2, etc.) only the events of the currently running mission (mission number listener = 0) or only a certain SubMission Cinema. If you want to have to consider all the events of the missions mission number one listener to assign a negative value, eg -1.

So really we have already all that is needed to load the submission at the beginning.

Nor to the rest of the script and you're ready:

Code:

using System;  
using maddox.game; 
using maddox.game.world;
public class Mission : AMission 
{   
   public override void OnBattleStarted()  {  base.OnBattleStarted(); 
   MissionNumberListener = -1;  
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\TestSubMission1.mis");          
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\TestSubMission2.mis"); 
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\TestSubMission3.mis"); 
   }  
}  

As mission designers really need to customize only the number of submissions to be loaded and the path and name.


But since it is known can never harm an example . We modify our previous lesson from the already well-known example:

Sfdp1-1.jpg


We simply delete the already created once ground targets, the Bf109 and we leave untouched the trigger times, this is our main mission:

Sfdp1-2.jpg


Then we create two new missions that contain only ground targets:

Sfdp1-3.jpg


and

Sfdp1-4.jpg

And since we're at it, a third mission with ground targets:

Sfdp1-5.jpg


Then the code, paste after adjusting the mission paths and names, in the main mission:

using maddox.game; 
using maddox.game.world; 
public class Mission : AMission 
{ 
public override void OnBattleStarted() 
  { 
  base.OnBattleStarted(); 
  MissionNumberListener = -1; 
  GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub1.mis"); 
  GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub2.mis"); 
  GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub3.mis"); 
  } 
} 

Then start the main quest, and lo and behold:

Sfdp1-6.jpg

The sample mission is as MissionNachladen1.zip attachment at the end of this post. So that we do not have the trigger so we can reuse them answered very well, we just copy the code - Section of OnTrigger () from our last lesson to our main mission added. Total received this:

using System; 
using maddox.game; 
using maddox.game.world; 
public class Mission : AMission 
{
   public override void OnBattleStarted() 
   { 
   base.OnBattleStarted(); 
   MissionNumberListener = -1;
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub1.mis"); 
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub2.mis"); 
   GamePlay.gpPostMissionLoad("missions\\Single\\Samples\\TestSubmissions\\MissionNachladen1Sub3.mis");
   {
       public override void OnTrigger(int missionNumber, string shortName, bool active)
       {
       base.OnTrigger(missionNumber, shortName, active);
       if ("WinCondition1".Equals(shortName) && active)
       {
       GamePlay.gpHUDLogCenter("Ziel erreicht");
       GamePlay.gpGetTrigger(shortName).Enable = false;
       GamePlay.gpGetTrigger("FailCondition1").Enable = false;
       }
       if ("FailCondition1".Equals(shortName) && active) 
       {
       GamePlay.gpHUDLogCenter("Sie haben die Zeit überschritten");
       GamePlay.gpGetTrigger(shortName).Enable = false;
       GamePlay.gpGetTrigger("WinCondition1").Enable = false;
       } 
   } 
} 

Then we start the mission (MissionNachladen2.zip), in memory we must destroy a total of six goals of the left two columns, as they lie in the trigger circuit. The course before time runs out (the time limit was increased to 320sek for testing purposes).


Destroy ground targets only on 6, nothing happens!

Sfdp1-777.jpg


Even after the destruction of even more targets still NOTHING!:

Sfdp1-8.jpg


Every time we get only this message:

Sfdp1-9.jpg