Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   [Tutorial] Simple Scripting Lessons - Preparations (http://forum.fulqrumpublishing.com/showthread.php?t=28997)

moggel 04-08-2012 07:31 PM

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?

FG28_Kodiak 04-08-2012 07:43 PM

1 Attachment(s)
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;
        }

Then you can load it with
Code:

GamePlay.gpPostMissionLoad(CreateNewPlaneAtAirfield());
For more example take a look on
Tanks from narvy (added as atachment)

moggel 04-08-2012 08:29 PM

Nice...

I think using a more or less textual declaration like that is even more powerful (and elegant) than pure code.

Thanks again!

Smokeynz 04-14-2012 04:42 AM

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.:-P

FG28_Kodiak 04-14-2012 05:45 AM

Quote:

Originally Posted by Smokeynz (Post 409012)
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();

Corrected, thanks.

SG1_Lud 07-18-2012 10:38 AM

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!

FG28_Kodiak 07-18-2012 11:34 AM

Quote:

Originally Posted by SG1_Lud (Post 446040)
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?

Make a little Mission, then open the mis file, there are all informations you need:

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:

My second question, the list of groups like BoB_LW_StG2_II.03?
Don't know if there is a list of all Airgroups available, simplest solution create a mission with all Airgroups you need, then open the mis file.

Quote:

and finally, the list of callsigns associated to their codes (in the case above, was 30)?
Callsigns are available from 0-35 (german, italian beginning with Adler, english with Acorn) but don't think there is a complete list present, never needed one :rolleyes:

SG1_Lud 07-18-2012 12:10 PM

Many thanks Kodiak, very helpful.

WhiskeyBravo 08-21-2012 02:46 PM

Excellent tutorial for a total C# noob like me.

Any signs of the next lessons yet?

Many thanks,

WB.

FG28_Kodiak 08-23-2012 05:27 AM

After my vacation i will publish the next lessons ;)


All times are GMT. The time now is 06:30 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.