Well, I wasn't able to access static aircraft by name. I'll just have to deal with the wreckage for now.
Quote:
Originally Posted by Longbone
Hi mate,
I think there must be a solution to access static aircraft like other static object's
gpgroundgroup,aigroundgroup etc but if so, is there a way to really despawn them or move
them to another location x0.00 y0.00 ?.
|
A lot of objects (including AI aircraft and ground vehicles) have a Destroy() method. This completely removes them, leaving nothing behind. The problem comes when we are not able to access the object and call that method.
Quote:
Originally Posted by Longbone
Edit: is there a way to edit Strings in C# automatically
like a counter do "Bob_f_218Sqn:001" ..."Bob_f_218Sqn:002"..."Bob_f_218Sqn:003"....
as you see in my script it is made complicated a little bit
|
Yes. I would do this with a for loop. Here's an example from a mission I'm working on.
Code:
for (int i = 1; i <= 5; i++)
{
DEGroundMisNums.Add(GamePlay.gpNextMissionNumber());
string miss = DEGroundMissPath + "Ground_" + i.ToString() + ".mis";
GamePlay.gpPostMissionLoad(miss);
}
Here I'm loading missions, but the part we're interested in is where I build the string. I call it "miss". I already know that the missions are named Ground_1, Ground_2, etc. up to Ground_5. "DEGroundMissPath" is just a string that represents the path to where the missions are located.
As you can see, I take the path to the missions, add the name of the mission, and then use the "i" variable from the for loop to change the name of the mission each time the loop is run. I need to call the ToString() method because you can't add integers to strings. After all that, I simply tack on the ".mis" extension.
This is an easy way to do it, but you have to know (or be able to find out) the number of times to go through the for loop, and they have to be sequential. Skipping numbers would make things more complicated. I hope this helps.