#21
|
|||
|
|||
Dynamic spawning?
Ok, another one:
I have found no way to dynamically create an AiActor and spawn it from my script. Is it not possible? If so, how does all those wonderful dynamic campaigns work?
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate |
#22
|
|||
|
|||
No it's not possible directly but you can create a "in memory" mis - file. And load it to the main mission.
for example Code:
internal ISectionFile CreateNewPlaneAtAirfield() { ISectionFile f = GamePlay.gpCreateSectionFile(); f.add("AirGroups", "BoB_LW_StG2_II.03", ""); f.add("BoB_LW_StG2_II.03", "Flight0", "1 2 3 4 5 6"); f.add("BoB_LW_StG2_II.03", "Class", "Aircraft.Ju-87B-2"); f.add("BoB_LW_StG2_II.03", "Formation", "VIC"); f.add("BoB_LW_StG2_II.03", "CallSign", "30"); f.add("BoB_LW_StG2_II.03", "Fuel", "100"); f.add("BoB_LW_StG2_II.03", "Weapons", "1"); f.add("BoB_LW_StG2_II.03", "SetOnPark", "1"); f.add("BoB_LW_StG2_II.03", "Idle", "1"); f.add("BoB_LW_StG2_II.03", "Skill", "0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3"); f.add("BoB_LW_StG2_II.03_Way", "TAKEOFF", "298417.47 127327.45 0 0"); return f; } Code:
GamePlay.gpPostMissionLoad(CreateNewPlaneAtAirfield()); Tanks from narvy (added as atachment) Last edited by FG28_Kodiak; 04-14-2012 at 06:44 AM. |
#23
|
|||
|
|||
Nice...
I think using a more or less textual declaration like that is even more powerful (and elegant) than pure code. Thanks again!
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate |
#24
|
|||
|
|||
Just note Kodiak,
There is a syntax error in this line in your example ISectionFile f = gamePlay.gpCreateSectionFile(); Should be this, capital G ISectionFile f = GamePlay.gpCreateSectionFile(); Oh from your example above I managed to create random generating flight including plane types, numbers and skills that is a response trigger loc to player and army specific. Still work in progress, but the basic script is working. |
#25
|
|||
|
|||
Corrected, thanks.
|
#26
|
||||
|
||||
Hi Kodiak, first of all many thanks for your presentation and introduction.
I have some questions, sorry if it is too basic but I am starting to learn. Where can I know the definition of the object type ISectionFile, I mean, all the fields that contains the different data fos setting up the new actor? My second question, the list of groups like BoB_LW_StG2_II.03? and finally, the list of callsigns associated to their codes (in the case above, was 30)? S!
__________________
|
#27
|
|||
|
|||
Quote:
for example in mis file: [AirGroups] BoB_LW_KG3_I.01 [BoB_LW_KG3_I.01] Flight0 1 Class Aircraft.He-111H-2 Formation LINEABREAST CallSign 26 Fuel 100 Weapons 1 SetOnPark 1 Idle 1 Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 [BoB_LW_KG3_I.01_Way] TAKEOFF 40064.00 20458.26 0 0 internal ISectionFile CreateNewPlaneAtAirfield() { ISectionFile f = GamePlay.gpCreateSectionFile(); f.add("AirGroups", "BoB_LW_KG3_I.01", ""); f.add("BoB_LW_KG3_I.01", "Flight0", "1"); f.add("BoB_LW_KG3_I.01", "Class", "Aircraft.He-111H-2"); f.add("BoB_LW_KG3_I.01", "Formation", "LINEABREAST"); f.add("BoB_LW_KG3_I.01", "CallSign", "30"); f.add("BoB_LW_KG3_I.01", "Fuel", "100"); f.add("BoB_LW_KG3_I.01", "Weapons", "1"); f.add("BoB_LW_KG3_I.01", "SetOnPark", "1"); f.add("BoB_LW_KG3_I.01", "Idle", "1"); f.add("BoB_LW_KG3_I.01", "Skill", "0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3"); f.add("BoB_LW_KG3_I.01_Way", "TAKEOFF", "298417.47 127327.45 0 0"); return f; } Quote:
Quote:
Last edited by FG28_Kodiak; 07-18-2012 at 12:38 PM. |
#28
|
||||
|
||||
Many thanks Kodiak, very helpful.
__________________
|
#29
|
||||
|
||||
Excellent tutorial for a total C# noob like me.
Any signs of the next lessons yet? Many thanks, WB. |
#30
|
|||
|
|||
After my vacation i will publish the next lessons
|
|
|