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)
-   -   spawn airgroups? (http://forum.fulqrumpublishing.com/showthread.php?t=26515)

FG28_Kodiak 10-15-2011 02:49 PM

Quote:

Originally Posted by David198502 (Post 349522)
thx Kodiak, really kind of you!and finally this works!
-if i understand it correctly, if i shoot the hurri, another one spawns, and i could repeat that to infinity???
i ask this, cause so far i tried the mission several times, and after i shot down the 4th hurri, no plane will spawn anymore....

Hm normaly yes, seems i misinterpreted your posting.

Quote:

i also expierence many game crashes, i think mainly when im near the spawning aera..
Could also be the steppe map, must try this but on my computer i didn't have a crash. May be its better to spawn an other group of planes not the same again and again.

Quote:

-can i just increase the number of the hurris without changing the script?i did and made a flight of six hurris, and after i shot down the 4th, the message "New Enemy spawned!" appeared, but unfortunately my game crashed.
It depens which aircraft you shot down. BoB_RAF_F_FatCat_Early.000 is the leading Airplane. You can change the "actor.Name().Contains("BoB_RAF_F_FatCat_Early.000 ")" in
actor.Name().Contains("BoB_RAF_F_FatCat_Early") so every plane in the goup counted.

Quote:

-how do i determine the name of the plane???
The easy way with external view, you have the option "show object name" if enabled the game shows you the name you need.

Quote:

-whats the planecount you mentioned to improve the mission???
At the moment a new plane spawns after the leader plane is shot down. But
you can improve the script. For example:
Code:

using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{
    int planecounter = 0;

   
    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);

        AiAction MakeNewAircraft = GamePlay.gpGetAction("SpawnAircraft");

        if (actor != null && MakeNewAircraft != null)
        {
            if (actor.Name().Contains("BoB_RAF_F_FatCat_Early"))
            {
                planecounter++;

                if (planecounter >= 2)
                {
                    MakeNewAircraft.Do();
                    GamePlay.gpHUDLogCenter("New Enemy spawned!");
                }
            }
        }
    }

}

Now you must shot down two planes of the group, before other spawns.


Quote:

i know i have many questions and im really greatful for your help.
No problem.

David198502 10-15-2011 04:23 PM

1 Attachment(s)
hey Kodiak!thx again will try that out immediately.....

but yet i have another question:i want to build a mission, where london gets continually bombed....i mean really destroyed, that if one flies over the city, one can see the damage everywhere...for that i used the script called "scripting for dummies" i think where one can create a main mission and 3submissions which will load after a certain time...it works, but now i have the problem that my He's stay on the map, and every ten minutes 30new He's spawn to bomb the city...so after 30minutes the mission grinds my pc to a halt because i have over 100 planes in the air...so i want the He's to dissapear again after they reached a certain waypoint...is that possible???and how??
this is what i have so far...

FG28_Kodiak 10-15-2011 05:11 PM

It's possible, the easy way.

Code:

using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Ju-87B-2":
                case "bob:Aircraft.Ju-88A-1":
                case "bob:Aircraft.He-111H-2":
                case "bob:Aircraft.He-111P-2":

                    Timeout(60, () =>    // Time in Seconds
                        {
                            (actor as AiAircraft).Destroy();
                        });
                    break;
            }
        }
    }

}

The script destroy()ing the planes after an amount of time (in the example 60sec). So by creation of the plane you give a "selfdestruct" command that are executed the time you specified. To avoid vanishing of other planes you should specify the planes. In example only the Stukas, Ju88, He111H2 und P2 will be destroy()ed. Destroy() means the plane is removed from game.

An other possibility is to check if the plane reach the last waypoint and then destroy it, but this is a little bit more complicated.

David198502 10-15-2011 06:50 PM

hey Kodiak....thx will try that too!if that works, the fmb will become a whole new world of possibilities for me...
i tried the script with the planecounter command.but when i fly the mission, the second group spawns after i shot down only one plane...it will spawn a new group everytime i shoot a single plane.

FG28_Kodiak 10-16-2011 04:38 AM

Quote:

Originally Posted by David198502 (Post 349593)
i tried the script with the planecounter command.but when i fly the mission, the second group spawns after i shot down only one plane...it will spawn a new group everytime i shoot a single plane.

Yes the script is not complete ;), there are two problems unsolved in it, i always hope the "students" find the problems and eliminate them. :rolleyes:
"I've a dream" :grin:

OK what are the Problems.
The first, not only the plane itself has a name which contains "BoB_RAF_F_FatCat_Early", the pilot (and gunners) also contains it.
We need something that checked if it is a plane. For this we need a if-clause that check: if (actor is AiAircraft) so we only get the plane. If we want examine the crew extra we could use: if (actor is AiPerson)
So now we only get the plane, but an other problem still exist.
i use the if - clause:
if (planecounter >= 2)
but whats the problem, with this if-clause the planes spawn after shooting down two, but also after three , four ....
so it should changed in
if (planecounter == 2)

so the script should now look like:
Code:

using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{
    int planecounter = 0;

   
    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);

        AiAction MakeNewAircraft = GamePlay.gpGetAction("SpawnAircraft");

        if (actor != null && MakeNewAircraft != null && actor is AiAircraft)
        {
            if (actor.Name().Contains("BoB_RAF_F_FatCat_Early"))
            {
                planecounter++;

                if (planecounter == 2)
                {
                    MakeNewAircraft.Do();
                    GamePlay.gpHUDLogCenter("New Enemy spawned!");
                }
            }
        }
    }
}

:rolleyes:

Osprey 10-16-2011 09:27 AM

.

David198502 10-16-2011 09:37 AM

thx Kodiak..believe me, yesterday i started too have closer look in those scripts,and i also looked at your really detailed tutorials on sturmovik.de,and i wanted to solve the problem by myself....i have the same dream...will look at it and try to understand.


@sorry Osprey if it was due to me that your question was overheard

Osprey 10-16-2011 10:50 AM

It's ok, I blanked it and I've done some reading, but I'm getting just plain frustrated that's all:

Quote:

Originally Posted by FG28_Kodiak (Post 343906)
Made a sample mission, the Doniers spawn after 10sec.

I put this into my dogfight folder and opened in FMB, and then did 'Play Mission'. It worked perfectly. BUT, when I used the same code on my mission (obviously with the triggername edited) it was ignored.

I have an historical mission I am making. There is a bomber attack spawning deep in France and it requires a fighter sweep 5 mins ahead. The fighter bases are nearer to the coast so at present they all spawn in together and naturally the fighters have completed their run well before the bombers are in the area. Here's what I have done and stumbled on:

1. An area trigger for the fighters so that when the bombers pass through the trigger zone they spawn in. The outcome is that the trigger is totally ignored. There is another bug where DOUBLE the number of aircraft are spawned in as you've set up in the mission. No idea why.
2. I changed the trigger to a time delay copying your script but again, the fighters simply spawned in. This time I had them groundstart but on one base the ground wasn't rendered in time and all the fighters nosedived into the sea - in the middle of France!!!
3. I changed the trigger time delay to match your script for a single fighter but again the trigger was ignored.

What I really don't understand is how your script works and mine doesn't yet the only difference is the fighter group selected and the map. Why would your script be run but mine ignored??

Quote:

using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

if ("FighterSweep".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("FighterSweep"); //same as YourTriggerName
GamePlay.gpLogServer(null, "Fighter sweep spawned ", new object[] { }); //Testmessage
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
.mis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

[Trigger]
FighterSweep TTime 60
[Action]
FighterSweep ASpawnGroup 1 BoB_LW_JG3_I.01



Osprey 10-16-2011 11:05 AM

OK I've just found out something interesting. What appears to be happening is that the FMB is spawning in double the number of objects for these fighters, no idea why. I've been running the script and instantly seeing the spawning in fighters thus assumed that it hadn't worked. This time I let it run a little and et voila! upon 60 seconds, the designated time, a NEW group spawned in - this caused the others to explode because they hadn't yet moved off their spawn position!!!

So this is a result, this means that it's a case of getting rid of these initial airgroups in the mission. Has anyone seen this before??? Is this some weird cahcing problem because I can't see a problem in the .mis file.

FG28_Kodiak 10-16-2011 12:54 PM

Can you upload your complete mission, please. So it's easier to debug. ;)


All times are GMT. The time now is 12:12 AM.

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