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
  #1  
Old 12-30-2011, 10:51 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default Destroy static objects by script

I'm using GamePlay.gpPostMissionLoad(MakeNewStaticSection()) ; to load a new mission section after battle start. The [Stationary] section is constructed by script & contains only stationary objects (not Ai actors). It spawns statics OK. Does anyone have a method by which I can destroy those statics after a period of time? Perhaps by capturing the mission number or storing the static names?
__________________
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

Last edited by salmo; 12-30-2011 at 10:54 AM.
Reply With Quote
  #2  
Old 12-31-2011, 02:01 AM
wildwillie wildwillie is offline
Approved Member
 
Join Date: Aug 2010
Posts: 111
Default

salmo -

I use the OnActorCreated to create a list of actors created. It picks up statics that are Artillery, Ships, AAGuns, etc. It does not pick up static objects like fuel barrels, fire extinguisher, etc.

Each actor created is stored in a list that I can go through at mission end to destroy them.

Code:
 private Dictionary<String, AiActor> allActors = new Dictionary<String, AiActor>();


public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        #region stats
        base.OnActorCreated(missionNumber, shortName, actor);
        // Add actor to list of all Actors
        if (!allActors.ContainsKey(shortName))
           allActors.Add(shortName, actor);
        try
        {
            stats.newActor(shortName, actor);
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.OnActorCreated - Exception: " + ex);
        }
        #endregion
    }

public override void OnBattleStoped()
    {
        #region stats
        base.OnBattleStoped();
        try
        {
            stats.battleStopped();
            // Loop through list of AiActors and destroy them all
            List<string> keys = new List<string>(allActors.Keys);
            for (int i = 0; i < keys.Count; i++)
            {
                AiActor a = allActors[keys[i]];
                AiAircraft aircraft = a as AiAircraft;
                if (aircraft != null)
                {
                    aircraft.Destroy();
                }
                else
                {
                    AiGroundActor aiGroundActor = a as AiGroundActor;
                    if (aiGroundActor != null)
                    {
                        aiGroundActor.Destroy();
                    }
                    else
                    {
                        System.Console.WriteLine("Stats.OnBattleStoped - Unknown Actor (" + a.Name()+") ShortName ("+keys[i]+")");
                    }
                }
            }
            stats.disconnectStats();
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.OnBattleStoped - Exception: " + ex);
        }
        #endregion
        //add your code here
    }
Hope that helps some.

WildWillie
Reply With Quote
  #3  
Old 12-31-2011, 02:18 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by wildwillie View Post
salmo -

I use the OnActorCreated to create a list of actors created. It picks up statics that are Artillery, Ships, AAGuns, etc. It does not pick up static objects like fuel barrels, fire extinguisher, etc.... <snip>
Thanks Willie, My statics are in the fuel barrels, fire extinguisher etc catagory, so unfortunately the method above won't work. Hence my problem Still searching for a solution I wonder if I should construct an entirely new mession from script; load the mission & trap the mission number for later destroying, rather than try to load just a new [staionary] section into the main mission?
__________________
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

Last edited by salmo; 12-31-2011 at 02:25 AM.
Reply With Quote
  #4  
Old 12-31-2011, 03:55 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

At the moment it's not possible, if i inform correctly this feature will be added in a future Patch by the devs.
Reply With Quote
  #5  
Old 12-31-2011, 05:14 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's not possible, if i inform correctly this feature will be added in a future Patch by the devs.
Thanks Kodiak )
__________________
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
  #6  
Old 12-31-2011, 09:37 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Let enemy tanks to destroy them. I do not know any other method.

It might be though that you can store their POS (location) into a database and then destroy them based on POS.

PS. Did not see Kodiak's reply.
Reply With Quote
  #7  
Old 12-31-2011, 12:51 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Thankyou Ataros, I'll keep exploring possible techniques.
__________________
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
  #8  
Old 12-31-2011, 01:15 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

I don't know, but i think Ataros misinterpreted your question.

With destroy we mean the remove of a object from a map.
The class member to use is Destroy(), the problem with the static objects is that there is no way to get a handler to them.

Normally we can use GamePlay.gpActorByName(Name) but if we insert the Name of a static object. The Value is Null, so it's not possible.
Also can we use a List to store them but with OnActorCreated we get only AiActors and no statics.

But maybe there is a way, but i never found it.
Reply With Quote
  #9  
Old 12-31-2011, 01:38 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Yes, it certainly is tricky Kodiak With the method I have to get statics in-game, I can trap their x,y pos & static name, but as you say, there is no easy method to destroy them (remove them from mission/battle)
__________________
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 05:05 PM.


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