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-15-2012, 03:57 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default How to remove Static4 Stationary.Environment objects

Hi all,

this used to work but now it is not. any ideas on how to fix?


Below code is in the .mis file that items the stationary objects i want to remove after 58 minutes.
Code:
[Stationary]
  Static5 Stationary.Environment.FuelDrum_GER1_9 de 296598.06 217104.48 0.00 
  Static4 Stationary.Environment.FuelDrum_GER1_9 de 296582.91 217086.94 0.00 
  Static3 Stationary.Environment.FuelDrum_GER1_9 de 296562.56 217080.95 0.00   
  Static2 Stationary.Environment.FuelDrum_GER1_9 de 295859.16 217662.86 0.00 
  Static1 Stationary.Environment.FuelDrum_GER1_9 de 295877.09 217695.95 0.00 
  Static0 Stationary.Environment.FuelDrum_GER1_9 de 295899.00 217686.78 0.00
Below is the code I have in my .cs file that states ground objects to be removed after 58 minutes. This is not working. The barrels are not removing??

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

public class Mission : AMission
{
    Stopwatch MissionTimer1M1 = new Stopwatch();
    bool ReStart = false;
    public override void Init(ABattle battle, int missionNumber)
    {
        base.Init(battle, missionNumber);
		GamePlay.gpLogServer(null, "Mission 1 Loaded ", new object[] { }); //test Message
        //MissionNumberListener = -1;

        MissionTimer1M1.Reset();
        MissionTimer1M1.Start();
    }

	public override void OnTickGame()
	{
		base.OnTickGame();
		if (Time.tickCounter() % (32 * 30 * 1) == 0)  // every 30sec repeat, (32 ticks a sec x 60 sec * 1 mins)
		{
		if (MissionTimer1M1.Elapsed.Minutes >= 59)
		MissionTimer1M1.Stop();
		}
	}
    
	
	//Section to remove AI after 58 mins

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

        if (actor is AiGroundActor) // 3599 = 58 mins
                Timeout(3599, () =>
                {
                    if (actor != null)
                    { (actor as AiGroundActor).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
  #2  
Old 10-15-2012, 04:43 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Stationaries are not Actors!

You can use

Code:
        public static void RemoveStaticAt(double xPos, double yPos, double radius)
        {
            
            foreach (GroundStationary stationary in GamePlay.gpGroundStationarys(xPos, yPos, radius))
            {
                stationary.Destroy();
            }

        }
GamePlay.gpGroundStationarys is overloaded:
GamePlay.gpGroundStationarys(double x, double y, double radius)
GamePlay.gpGroundStationarys(string country)
GamePlay.gpGroundStationarys(string country, double y, double radius)

you get a Array of GroundStationary on a Position with a given radius, additional you can specify a country. Or you can get all Stationaries of a country you specify.
Reply With Quote
  #3  
Old 10-15-2012, 08:35 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Sweet. Will test
__________________
__________________
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-15-2012, 10:19 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by hc_wolf View Post
Sweet. Will test
Keep radius small to avoid accidently deleting other ground stationaries
__________________
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
  #5  
Old 10-15-2012, 10:34 PM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Quote:
Originally Posted by salmo View Post
Keep radius small to avoid accidently deleting other ground stationaries
Thanks Salmo I shall remember for other times.

But for this topic I don't to delete in a radius area, I want to delete every object I load in a sub mission.

Example, I load a bomber mission, the targets spawn at same time as bomnbers. Then 1 hour later if the bombers did not make it or if they did, all Ground objects that were spawned in on that submission are removed.

so maybe I use the below and place it in the sub mission .cs file

Code:
   public static void RemoveStaticAt(string country)
    {
        
        foreach (GroundStationary stationary in GamePlay.gpGroundStationarys(country))
        {
             If 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

Last edited by hc_wolf; 10-16-2012 at 12:54 AM.
Reply With Quote
  #6  
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
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 12:26 PM.


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