02-23-2020, 07:16 PM
So here is an issue I came across in scripting Cliffs of Dover FMB missions.
Generally you can get a list of all ground stationaries using a few simple functions CloD makes available to script writers.
HOWEVER - those lists of ground stationaries do not include a few important items!
In particular, they don't seem to include smoke or fire objects.
So I can understand how this likely happened--smoke & fire are simply a different type of object than most others. For example, if you bomb a location you might kill any nearby static object, but you probably wouldn't kill nearby smoke or fire.
Anyway, this is an issue because for most ground stationary objects, you can place them and then later remove them.
But with smoke & fire, you can place them--but you can't EVER remove them unless you completely restart the mission.
Anyone who knows a solution to this, I would really appreciate hearing it!
Sample .cs file that lists all ground stationaries of the mission and any submission loaded. If you create a .mis file with various groundstationaries including some smoke and fire, you'll see that everything is listed EXCEPT the smoke and fire:
Example of how to get groundstationaries within a distance of a given point--except not that it will NOT list any smoke or fire groundstationaries!
Example of how to create and place smoke or fire mid-mission via script:
The smoke & fire types listed there are exactly the ones that cannot be found via the groundstationarys() method--as far as I know.
Example of how to create a SectionFile via script, put a static object (groundstationary) in it, and then load it in:
Examples of what static objects look like in a .mis file--you can load any of these types or dozens of others (discover them using FMB and then looking at the resulting .mis file) using the above routine:
Generally you can get a list of all ground stationaries using a few simple functions CloD makes available to script writers.
HOWEVER - those lists of ground stationaries do not include a few important items!
In particular, they don't seem to include smoke or fire objects.
So I can understand how this likely happened--smoke & fire are simply a different type of object than most others. For example, if you bomb a location you might kill any nearby static object, but you probably wouldn't kill nearby smoke or fire.
Anyway, this is an issue because for most ground stationary objects, you can place them and then later remove them.
But with smoke & fire, you can place them--but you can't EVER remove them unless you completely restart the mission.
Anyone who knows a solution to this, I would really appreciate hearing it!
Sample .cs file that lists all ground stationaries of the mission and any submission loaded. If you create a .mis file with various groundstationaries including some smoke and fire, you'll see that everything is listed EXCEPT the smoke and fire:
Code:
using System;
using System.Collections.Generic;
using maddox.GP;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
Dictionary<GroundStationary, int> Stationaries = new Dictionary<GroundStationary, int>();
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
}
public override void OnMissionLoaded(int missionNumber)
{
base.OnMissionLoaded(missionNumber);
foreach (GroundStationary stationary in GamePlay.gpGroundStationarys())
{
if (!Stationaries.ContainsKey(stationary))
{
Stationaries[stationary] = missionNumber;
Console.WriteLine("Stat: {0} {1} {2} {3}", missionNumber, stationary.Name, stationary.Category, stationary.Title);
}
}
}
}
Example of how to get groundstationaries within a distance of a given point--except not that it will NOT list any smoke or fire groundstationaries!
Code:
GroundStationary[] gs = GamePlay.gpGroundStationarys(250000, 252000, 1000); //Find all groundstationaries within 1000 meters of map coordinate (250000,252000)
Example of how to create and place smoke or fire mid-mission via script:
Code:
public static void loadSmokeOrFire(maddox.game.IGamePlay GamePlay, AMission mission, double x, double y, double z, string type = "BuildingFireBig", double duration_s = 300)
{
/* Sample: Static556 Smoke.Environment.Smoke1 nn 63718.50 187780.80 110.00 /height 16.24
possible types: Smoke1 Smoke2 BuildingFireSmall BuildingFireBig BigSitySmoke_0 BigSitySmoke_1
*/
ISectionFile f = GamePlay.gpCreateSectionFile();
string sect = "Stationary";
string key = "Static1";
string value = "Smoke.Environment." + type + " nn " + x.ToString("0.00") + " " + y.ToString("0.00") + " " + (duration_s / 60).ToString("0.0") + " /height " + z.ToString("0.00");
f.add(sect, key, value);
GamePlay.gpPostMissionLoad(f);
}
The smoke & fire types listed there are exactly the ones that cannot be found via the groundstationarys() method--as far as I know.
Example of how to create a SectionFile via script, put a static object (groundstationary) in it, and then load it in:
Code:
public static void loadStatic(maddox.game.IGamePlay GamePlay, AMission mission, double x, double y, double z, string type = "Stationary.Opel_Blitz_cargo", double heading = 0, string side = "nn")
{
/* side = nn , gb, or de
* Examples: https://theairtacticalassaultgroup.com/forum/showthread.php?t=8493
*/
ISectionFile f = GamePlay.gpCreateSectionFile();
string sect = "Stationary";
string key = "Static1";
string value = type + " " + side + " " + x.ToString("0.00") + " " + y.ToString("0.00") + " " + heading.ToString("0.0") + " /height " + z.ToString("0.00");
//Console.WriteLine("Load Static: " + value);
f.add(sect, key, value);
GamePlay.gpPostMissionLoad(f);
}
Examples of what static objects look like in a .mis file--you can load any of these types or dozens of others (discover them using FMB and then looking at the resulting .mis file) using the above routine:
Code:
Static4 Stationary.Environment.Table_empty_UK-GER_1 nn 14334.77 15015.75 661.10
Static2 Stationary.Scammell_Pioneer_R100 gb 14357.38 15036.04 661.10
Static7 Stationary.Airfield.Sign_Table_UK1 nn 14295.63 15054.30 661.10
Static5 Stationary.Environment.Table_w_chess_UK-GER_1 nn 14308.39 15048.51 661.10
Static6 Stationary.Environment.Table_w_dinner_UK-GER_1 nn 14306.36 15060.39 661.10
Static3 Stationary.BMW_R71_w_MG_34 de 14325.78 15042.71 661.10 //motorcycle
Static1 Stationary.Opel_Blitz_cargo de 14321.43 15065.61 661.10
Static0 Stationary.Horch_830_B1 de 14350.42 15056.62 661.10
Static65 Stationary.Humans.Kdo_Hi_Ger35_passenger_4 de 14345.22 15051.82 661.10 2
Static120 Stationary.Humans.Soldier_Krupp_L2H43_Driver_1 de 14342.67 15055.75 661.10 3
Static48 Stationary.Humans.Soldier_MG_TA_Passenger_1 de 14341.79 15056.98 661.10 4
Static66 Stationary.Humans.Ladder_passenger_ger_1 de 14344.66 15053.11 661.10 5
Static50 Stationary.Humans.150_cm_Flakscheinwerfer_gunner1 de 14343.99 15055.41 661.10 6
Static123 Stationary.Humans.Soldier_Krupp_L2H43_pak_Driver_1 de 14344.14 15054.25 661.10 7
Static119 Stationary.Humans.Soldier_Sdkfz105_Gunner de 14346.02 15052.77 661.10 8
Static71 Stationary.Humans.Portable_Siren_ger_passenger de 14347.25 15052.80 661.10 9