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 10-16-2012, 04:47 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

OK, so if your loading from a sub-mission, I'll presume you know the mission number from which you want all the actor objects deleted. How about this ...

Code remove by author
__________________
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; 10-18-2012 at 09:06 AM.
Reply With Quote
  #2  
Old 10-16-2012, 05:34 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Not Actors Stationaries


So
Code:
using System;
using System.Collections.Generic;
using maddox.GP;
using maddox.game;
using maddox.game.world;



public class Mission : AMission
{

    Dictionary<GroundStationary,int> Stationaries = new Dictionary<GroundStationary, int>();

    public override void  OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
    }
   

    public override void OnMissionLoaded(int missionNumber)
    {
        base.OnMissionLoaded(missionNumber);

        foreach (GroundStationary stationary in GamePlay.gpGroundStationarys())
        {
            if (!Stationaries.ContainsKey(stationary))
                Stationaries[stationary] = missionNumber;
        }
    }


    public void RemoveStationaries(int missionNumber)
    {

        List<GroundStationary> toRemove = new List<GroundStationary>();

        foreach (KeyValuePair<GroundStationary, int> keyValuePair in Stationaries)
        {
            if (keyValuePair.Value == missionNumber)
            {
                toRemove.Add(keyValuePair.Key);
                keyValuePair.Key.Destroy();
            }
        }

        foreach (GroundStationary groundStationary in toRemove)
        {
            Stationaries.Remove(groundStationary);
        }
    }
}
Reply With Quote
  #3  
Old 10-16-2012, 05:38 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Thanks Salmo, will test tonight. With regards to mission number.. well I can't say it is always mission 3 or mission 12. As the game goes on missions load and count in and the mission number can be mission 256

Anyways I will test that tonight. it is clean and looks like it will do the job.

My other way I looked at today was this but have not tested yet.

The below code removes all objects loaded in the mission that are from a country. example de

Code:
    Dictionary<GroundStationary, int> StationaryMisRelation = new Dictionary<GroundStationary, int>();
    //Section 1: Trigger Nachrichten

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

        if ("DeleteTrigger".Equals(shortName) && active)			//Trigger 1 Nachricht
        {
		    foreach (KeyValuePair<GroundStationary, int> kvp in StationaryMisRelation)
            {
                GamePlay.gpLogServer(null, "Stationary: {0}; MissNr.: {1}", new object[] { kvp.Key.Title, kvp.Value });
            }
            Timeout(20, () =>
            {
                GamePlay.gpGetTrigger(shortName).Enable = false;
            });
        }
		

    }	


	// Destroy all [Stationary] objects for country de  (germany)
    public void RemoveStaticAt(string country)  //not sure if this will work.  
    {


        foreach (GroundStationary stationary in GamePlay.gpGroundStationarys(country))
        {
            country = de;
            {
                stationary.Destroy();
            }
        }
    }
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
Reply With Quote
  #4  
Old 10-16-2012, 05:44 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

salmos code wouldn't work for stationaries he uses AiActor but a GroundStantionary is not an Actor. So it's never registered in OnActorCreated,
Reply With Quote
  #5  
Old 10-16-2012, 05:55 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Wolfie, Kodiak's code is appropriate for groundStationaries. My code is for AiActors & as Kodiak says, won't work for stationaries (I had it for stationaries originally then changed it). You need to decide exactly what you want to do: delete groundstationaries for a given country? or stationaries from a given sub-mission?

In any event you will need to trap the mission number of the mission you want the stationaries deleted from.
__________________
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; 10-16-2012 at 06:00 AM.
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 09:34 PM.


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