How to see all the buildings created in .mis file through the script...
in other words:
how to use public class GroundBuilding
How to see all the buildings created in .mis file through the script...
in other words:
how to use public class GroundBuilding
Hi! GroundBuilding is class that contains just 2 members - Title (name of the building) and pos (position of the building). This class used in OnBuildingKilled event to check what kind of building dies and where. Buildings that used this class not loaded in missions - they are property of map - i.e. that buildings which are already placed to the map.
When you create buildings in mission - it would be stationary objects and you could use GroundStationary class , its propertys -
Скрытый текст:
and you can get array of GroundStationary's objects in mission like this :
GroundStationary[] gpGroundStationarys(); - all GroundStationary objects in runing mission,
GroundStationary[] gpGroundStationarys(string Country); - all GroundStationary objects in runing mission with specific Country,
GroundStationary[] gpGroundStationarys(double x, double y, double r); all GroundStationary objects in runing mission placed in circle with center in x,y and radious r,
GroundStationary[] gpGroundStationarys(string Country, double x, double y, double r); all GroundStationary objects in runing mission placed in circle with center in x,y and radious r, with specific Country.
Thus you can get array of all created stationary objects, filter it by Type == AiGroundActorType .House , and you'll get array of buildings created in mission.
Don't happy, be worry
ok, thanks for the tip. I was actually looping through GroundStationary [] but I coud not find anything like House.
However when I checked my mission in FMB there was no buildings in it.... silly me.
I noticed one thing, looping through:
foreach (GroundStationary gs in GamePlay.gpGroundStationarys())
{
//Console.WriteLine("GroundStationary: " + gs.Name + " Category: " + gs.Category + " country : " + gs.country + " Title: " + gs.Title + " Type : " + gs.Type);
}
will not result in all static objects from mission but if i add:
if (actor is AiGroundActor)
{
AiGroundActor ground = actor as AiGroundActor;
string landType = GamePlay.gpLandType(actor.Pos().x, actor.Pos().y).ToString();
string gpSectorName = GamePlay.gpSectorName(actor.Pos().x, actor.Pos().y).ToString();
//Console.WriteLine("AiGroundActor: " + actor.Name() + " Type: " + ground.Type() + " Grid: " + gpSectorName + " Land Type: " + landType);
}
Then eventually i got theme all... or is there any much simpler method to do
Ok, just tested it still no joy of getting list of buildings... i can get only statics objects... Any tips???
what i have is:
[Buildings]
0_bld buildings.House$EnglandShelter00 1 269360.87 206200.34 -55.00
1_bld buildings.House$EnglandGeneralServiceShed1916 1 70742.43 177040.67 -60.00
2_bld buildings.House$EnglandGeneralServiceShed1916 1 70785.06 177063.10 -60.00
3_bld buildings.House$EnglandGeneralServiceShed1916 1 70828.50 177088.93 -60.00
4_bld buildings.House$EnglandRespiratorWorkshop 1 70869.88 177094.28 -60.00
5_bld buildings.House$EnglandRespiratorWorkshop 1 70864.06 177104.15 -60.00
6_bld buildings.House$EnglandRespiratorWorkshop 1 70858.04 177112.86 -60.00
7_bld buildings.House$EnglandGunneryWorkshop 1 70883.13 177113.79 30.00
8_bld buildings.House$GermanyControltower 1 280570.32 213172.30 -30.00
9_bld buildings.House$FuelStorage_01 1 280547.48 213027.04 -30.00
10_bld buildings.House$FuelStorage_01 1 280547.48 212991.82 -30.00
11_bld buildings.House$FuelStorage_01 1 280549.08 212961.40 -30.00
[BuildingsLinks]
thats from .mis file
so basicly buildings created on FMB are not being written as statics objects.... right???
and if i loop through it both methods, i cant get any House types being displayed for some reason...
Крайний раз редактировалось _79_dev; 20.01.2014 в 05:33.
I'm really sorry, i don't understood you at first message, my bad . So, it is not possible to get list of [Buildings] object in script, only thing that you can get - is it's name and pos when it die.
not exactly, there are two class of objects - static and stationary, we can operate with stationary and can not - with static ; [Buildings] - are static. You can use some of buildings model in FMB stationary->buildings , and this object would be stationary and present in gpGroundStationarys() array.
Don't happy, be worry
Ok, thanks for the answer... You are gentelmen...