Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 06-18-2012, 08:21 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Yes OnActorTaskComplete sometimes have strange results (not triggered correctly). Additional problem is that it's not possible to get GetWay() on a Groundgroup to work, it's always returns null. So its not possible to check which Waypoint is reached. . The workaround is to create a Area (TPassthrou Trigger or defined in code) and if a GroundActor reached it then destroy it.
Reply With Quote
  #12  
Old 06-18-2012, 08:27 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

ah ok thats why.....
damn it, i really hope that this is possible soon
but thx for your answer
__________________
Reply With Quote
  #13  
Old 06-18-2012, 09:30 AM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by David198502 View Post
thx for your testing and answering Kodiak...a bit disappointing though..hope this will soon be possible, as i would really like to implement "random" life on the ground...

Hey David,

I've written a solution for random life on the ground but it's collecting dust at the moment as I'm buzy writing "Fighter Command" (will be uses to simulate Chain Home and Observer corps in online sessions).

I call the solution "Live Map" and if you're willing to be my tester I would love to send it to you. Currently it's written for offline use but I'm gonna upgrade it for online when I see it works as expected. Are you thinking online or single player for this?

LiveMap works by loading and running "sub missions" as you fly over the country side. Most actors that gets activated below will get removed after a set time (I also couldn't get any even when they reached their last waypoint) to reduce workload. There's a few exceptions to that rule. Ships and trains do not get removed as they're much more visible and you'd expect to see them lumbering along somewhere if you return to the region some time after you saw them last.

The solution means you'll need to piece together those sub missions for regions you intend to fly over. It's not alot of work and you only need to do it once. The sub missions just gets thrown into a sub folder and you're good to go.

Let me know if you're interested.
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #14  
Old 06-18-2012, 09:35 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

hey moggel!
nice to see you on the forum as well!
man i would love to be your crash test dummy!
my main aim is, to make that work for a coop mission, but it would be fine for offline use as well first!

regarding the submissions.....
i would like to introduce some random life on ground in my mission, which generates flights out of a pool of submissions as well...
my problem is mainly, that if i just put ground vehicles into my submissions, the longer the mission runs, the more vehicles will be on the ground, that in the end they are that many, that its not playable anymore because of performance decrease...
have a look, this is my script.....right now, there are no moving ground object placed in the submissions, only in the main mission template, there are static objects, and a few ships(its the ACG map template)....

HTML Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{
    Stopwatch MissionTimer = new Stopwatch();

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionTimer.Start();
        MissionNumberListener = -1;
    }
   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.He-111P-2":
                case "bob:Aircraft.BlenheimMkIV":

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

    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);


        if(IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        if (IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    private bool IsActorDestroyable(AiActor actor)
    {
        bool actorDestroyable = true;

        //Check if actor is empty (no Player)
        if (actor is AiAircraft)
        {
            if ((actor as AiAircraft).ExistCabin(0))
                for (int i = 0; i < (actor as AiAircraft).Places(); i++)
                {
                    if ((actor as AiAircraft).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }
        else if (actor is AiGroundActor)
        {
            if ((actor as AiGroundActor).ExistCabin(0))
                for (int i = 0; i < (actor as AiGroundActor).Places(); i++)
                {
                    if ((actor as AiGroundActor).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }

        return actorDestroyable;
    }

// to remove GroundActors after their Task is completed
   public override void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorTaskCompleted(missionNumber, shortName, actor);

        if (actor is AiGroundActor)
            if (IsActorDestroyable(actor))
                (actor as AiGroundActor).Destroy(); 
    }

    public int GetSumAllPlanes()
    {
        int planeCount = 0;
        List<AiAirGroup> allAirgroups = new List<AiAirGroup>();

        if (GamePlay.gpAirGroups(1) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(1));

        if (GamePlay.gpAirGroups(2) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(2));


        allAirgroups.ForEach(item =>
            {
                foreach (AiAircraft ac in item.GetItems())
                {
                    planeCount++;
                }
            });

        return planeCount;
    }

public override void OnTickGame()
    {
    
        if(MissionTimer.Elapsed.TotalSeconds >= 130 && GetSumAllPlanes() < 30)  //Loads a mission every 130s and only if the sum of all planes < 30
        {
            Random ZufaelligeMission = new Random();

            MissionTimer.Restart(); // Sets timer to 0 and start again
    
            switch (ZufaelligeMission.Next(1,34))
            {
                case 1:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission1.mis");
                    break;
                case 2:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission2.mis");
                    break;
                case 3:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission3.mis");
                    break;
                case 4:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission4.mis");
                    break;
                case 5:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission5.mis");
                    break;
                case 6:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission6.mis");
                    break;
                case 7:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission7.mis");
                    break;
                case 8:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission8.mis");
                    break;
                case 9:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission9.mis");
                    break;
                case 10:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission10.mis");
                    break;
                case 11:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission11.mis");
                    break;
                case 12:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission12.mis");
                    break;
                case 13:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission13.mis");
                    break;
                case 14:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission14.mis");
                    break;
                case 15:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission15.mis");
                    break; 
                case 16:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission16.mis");
                    break;
                case 17:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission17.mis");
                    break;
                case 18:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission18.mis");
                    break;
                case 19:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission19.mis");
                    break;
                case 20:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission20.mis");
                    break;
                case 21:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission21.mis");
                    break;
                case 22:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission22.mis");
                    break;
                case 23:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission23.mis");
                    break;
                case 24:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission24.mis");
                    break;
                case 25:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission25.mis");
                    break;
                case 26:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission26.mis");
                    break;
                case 27:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission27.mis");
                    break;
                case 28:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission28.mis");
                    break;
                case 29:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission29.mis");
                    break;
                case 30:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission30.mis");
                    break;
                case 31:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission31.mis");
                    break;
                case 32:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission32.mis");
                    break;
                case 33:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission33.mis");
                    break;
                case 34:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission34.mis");
                    break;

            }
        }
    }
}
ps: to be honest, that is not my script,actually every single line was written by Kodiak(thx again)
__________________

Last edited by David198502; 06-18-2012 at 09:49 AM.
Reply With Quote
  #15  
Old 06-18-2012, 10:00 AM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by David198502 View Post
hey moggel!
nice to see you on the forum as well!
man i would love to be your crash test dummy!
my main aim is, to make that work for a coop mission, but it would be fine for offline use as well first!

regarding the submissions.....
i would like to introduce some random life on ground in my mission, which generates flights out of a pool of submissions as well...
my problem is mainly, that if i just put ground vehicles into my submissions, the longer the mission runs, the more vehicles will be on the ground, that in the end they are that many, that its not playable anymore because of performance decrease...
have a look, this is my script.....right now, there are no moving ground object placed in the submissions, only in the main mission template, there are static objects, and a few ships(its the ACG map template)....

HTML Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{
    Stopwatch MissionTimer = new Stopwatch();

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionTimer.Start();
        MissionNumberListener = -1;
    }
   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.He-111P-2":
                case "bob:Aircraft.BlenheimMkIV":

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

    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);


        if(IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        if (IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    private bool IsActorDestroyable(AiActor actor)
    {
        bool actorDestroyable = true;

        //Check if actor is empty (no Player)
        if (actor is AiAircraft)
        {
            if ((actor as AiAircraft).ExistCabin(0))
                for (int i = 0; i < (actor as AiAircraft).Places(); i++)
                {
                    if ((actor as AiAircraft).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }
        else if (actor is AiGroundActor)
        {
            if ((actor as AiGroundActor).ExistCabin(0))
                for (int i = 0; i < (actor as AiGroundActor).Places(); i++)
                {
                    if ((actor as AiGroundActor).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }

        return actorDestroyable;
    }

// to remove GroundActors after their Task is completed
   public override void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorTaskCompleted(missionNumber, shortName, actor);

        if (actor is AiGroundActor)
            if (IsActorDestroyable(actor))
                (actor as AiGroundActor).Destroy(); 
    }

    public int GetSumAllPlanes()
    {
        int planeCount = 0;
        List<AiAirGroup> allAirgroups = new List<AiAirGroup>();

        if (GamePlay.gpAirGroups(1) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(1));

        if (GamePlay.gpAirGroups(2) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(2));


        allAirgroups.ForEach(item =>
            {
                foreach (AiAircraft ac in item.GetItems())
                {
                    planeCount++;
                }
            });

        return planeCount;
    }

public override void OnTickGame()
    {
    
        if(MissionTimer.Elapsed.TotalSeconds >= 130 && GetSumAllPlanes() < 30)  //Loads a mission every 130s and only if the sum of all planes < 30
        {
            Random ZufaelligeMission = new Random();

            MissionTimer.Restart(); // Sets timer to 0 and start again
    
            switch (ZufaelligeMission.Next(1,34))
            {
                case 1:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission1.mis");
                    break;
                case 2:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission2.mis");
                    break;
                case 3:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission3.mis");
                    break;
                case 4:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission4.mis");
                    break;
                case 5:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission5.mis");
                    break;
                case 6:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission6.mis");
                    break;
                case 7:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission7.mis");
                    break;
                case 8:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission8.mis");
                    break;
                case 9:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission9.mis");
                    break;
                case 10:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission10.mis");
                    break;
                case 11:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission11.mis");
                    break;
                case 12:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission12.mis");
                    break;
                case 13:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission13.mis");
                    break;
                case 14:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission14.mis");
                    break;
                case 15:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission15.mis");
                    break; 
                case 16:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission16.mis");
                    break;
                case 17:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission17.mis");
                    break;
                case 18:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission18.mis");
                    break;
                case 19:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission19.mis");
                    break;
                case 20:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission20.mis");
                    break;
                case 21:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission21.mis");
                    break;
                case 22:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission22.mis");
                    break;
                case 23:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission23.mis");
                    break;
                case 24:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission24.mis");
                    break;
                case 25:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission25.mis");
                    break;
                case 26:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission26.mis");
                    break;
                case 27:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission27.mis");
                    break;
                case 28:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission28.mis");
                    break;
                case 29:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission29.mis");
                    break;
                case 30:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission30.mis");
                    break;
                case 31:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission31.mis");
                    break;
                case 32:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission32.mis");
                    break;
                case 33:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission33.mis");
                    break;
                case 34:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission34.mis");
                    break;

            }
        }
    }
}
ps: to be honest, that is not my script,actually every single line was written by Kodiak(thx again)
Well, LiveMap deals with resource housekeeping and makes sure the same sub mission doesn't get loaded when already running. As you (or any pilot in the online context) flies into a "region" LiveMap looks for a sub mission linied to that same region, using simple naming rules. As the sub mission loads and runs all actors are tracked and as they time out (configurable, default is ten minutes if I remember it correctly) they'll get destroyed, yes, even if they haven't reached their final destination.

There's certainly room for improvement, especially in making the "life" appear more random, but my tests show they work quite fine.

I don't think it's all that much code that needs to be modified to make it work on a server in the online context but I need to clean away the "dust" and get back into the code. I'll give it a look this week and send you my private e-mail so we can link up.

~S~
Mog
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #16  
Old 06-18-2012, 10:02 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

that sounds great moggel!
__________________
Reply With Quote
  #17  
Old 10-06-2012, 08:10 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by FG28_Kodiak View Post
At the moment it works good for Planes, but i get no Handle to the Waypoitnts of GroundActors nor is GetCurrentWayPoint() working for GroundGroups, at the moment, so its not possible to check if a Groundactor reached it last waypoint.
Trying to do some waypoint scripting & just came across this error. I confirm that GetCurrentWayPoint is STILL not working for aiGroundGroups How does Luthier expect us to develop content for his wonderful "sandbox" (his words) when there are fundemental components that are broken with no prospect of getting them fixed
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:15 AM.


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