![]() |
|
|
|
#1
|
|||
|
|||
|
Thank you!
Maybe you can get Length of LimbNames.Tail from the game same as with engines here and run a loop? Tail would do the job in the air too I think. Code:
int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}
|
|
#2
|
|||
|
|||
|
1.11 version up on Repka #3 for testing
|
|
#3
|
|||
|
|||
|
I have a more general question which I hope someone can answer:
My mission loads submission with some parameters (attacker army, mission type, attack sector, etc), then gets trigger status, calculates mission results and shows results messages using the same parameters. It goes fine when submissions are loaded one by one. I want to add different types of submissions and make them overlap in time. Naturally I have to store parameters of every submissions as different variables to prevent them mixing up. How can I do this? Should I create a list for each parameter and send it to array when each new submission loads or there is a more elegant way to do this. I will not have more then 10 submissions going on simultaneously and do not have to create arrays with the length of total past submissions quantity. |
|
#4
|
|||
|
|||
|
Make a class with all infos you need and then store the objects in a list.
For example : Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
public static string SubMissionsPath = @"missions\Multi\Dogfight\test\subs\";
public class Mis
{
public string Missionfilename {get; set;}
public string PathToMission { get; set; }
public DateTime MissionBegin{get; set;}
public DateTime MissionEnd{get; set;}
public double MissionLengh{get; set;}
public bool IsMissionRunning { get; set; }
public Mis(string Filename, string Path, double Lengh)
{
this.Missionfilename = Filename;
this.PathToMission = Path;
this.MissionLengh = Lengh;
}
}
public List<Mis> MissionPool = new List<Mis>()
{
new Mis ("Mission1.mis",SubMissionsPath ,1000.0),
new Mis ("Mission2.mis",SubMissionsPath ,1000.0),
};
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
try
{
foreach (Mis mi in MissionPool)
GamePlay.gpPostMissionLoad(mi.PathToMission + mi.Missionfilename);
}
catch
{
GamePlay.gpLogServer(null, "File not found", null);
}
}
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
}
}
Last edited by FG28_Kodiak; 10-20-2011 at 03:13 PM. |
|
#5
|
|||
|
|||
|
Thank yoг for a good example. I will try creating a class for my needs and will come back with more questions if any.
S! |
|
#6
|
|||
|
|||
|
I did the exercise, sure with many mistakes but will do some reading on classes creation to correct them.
However I am stuck in OnTrigger method completely. I have several submissions running at the same time with the same filenames and the same trigger names. This happens because they are randomly loaded and the same submission can be loaded 2-4 times within an hour. How can I identify which trigger of which submission is triggered OnTrigger? I number my missions as "mi.MisMissionNumber" but their numbers are different from OnTrigger "missionNumber". The file is renamed to a .txt. If you have time to answer other questions I will appreciate it. Last edited by Ataros; 10-21-2011 at 03:44 PM. |
|
#7
|
|||
|
|||
|
Will take a look at it.
Short answers: Code:
public static string SubMissionsPath = @"missions\Multi\Dogfight\r_steppe\subs\";
// is @ necessary here? did not use it in other missions.
Code:
// what does this block do?
public Mis(string Filename, string misType, int Lengh) // should I include all the above variables here?
{
this.Missionfilename = Filename; // You use mi.Missionfilename instead of mi.Filename in your example when load missions. Why?
this.MissionLengh = Lengh;
this.MissionType = misType;
this.TrgWasTriggered = wasTriggered;
}
So i can use Code:
public List<Mis> MissionPool = new List<Mis>()
{
new Mis ("Mission1.mis",SubMissionsPath ,1000.0),
new Mis ("Mission2.mis",SubMissionsPath ,1000.0),
};
// You use mi.Missionfilename instead of mi.Filename in your example when load missions. Why? I use the public method Missionfilename to get access to the variable in the object. Filename is only used in the constructor to give the value to the variable Missionfilename. More to come, must take a deeper look at it, but no time at the moment. But it seems you think a bit too complicated |
![]() |
| Thread Tools | |
| Display Modes | |
|
|