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 07-23-2012, 11:25 PM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default Place and then Remove Static Objects after destruction.

Hello,

Two questions and I think I know the answer, just want to re-check.

1) If you destroy an object on the English map (Permanent Radar) or a Static Radar object placed in the .mis file, Do they come back after x minutes or stay destroyed?

2) If I place a Static Radar and then Bomb it, Bits scatter around the bomb site and it stays destroyed.. ..Is there a script that will remove the debris (Destroy AiGroundActorType.Radar)

I want to Destroy the Radar and then have it Re-spawn a little later. I have the script all working except for clearing the Destroyed Radar. So at the moment the new Radar spawns on the destroyed one.

from .mis file
Static4 Stationary.Radar.EnglishRadar1 gb 70506.68 171685.75 93.00

The below does not seem to work if I put this in mission script

Code:
    /*------------------Remove AIGround method---------------*/
    private void destroyGroundActor(AiGroundActorType type, int army)
    {
        if (GamePlay.gpGroundGroups(army) != null)
        {
            foreach (AiGroundGroup gg in GamePlay.gpGroundGroups(army))
            {
                if (gg != null && gg.GetItems().GetLength(0) > 0)
                {
                    foreach (AiActor ggActor in gg.GetItems())
                    {
                        if (ggActor != null)
                            if ((ggActor as AiGroundActor) != null && (ggActor as AiGroundActor).Type() == type)
                                (ggActor 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 07-24-2012, 04:23 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I seem to remember the CS of "CTF_cross_roundel by naryv" has items being cleared after destroyed.

Also only current beta has code for objects as being specific ground items, I cant run the beta without crashing so can't test it.
Reply With Quote
  #3  
Old 07-24-2012, 04:50 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

1) they stay destroyed

2) Radars are no GroundActors they are static objects so you must use the new OnStationaryKilled (works since the latest beta patch)
Code:
public override void OnStationaryKilled(GroundStationary _stationary, AiDamageInitiator initiator, int eventArgInt)
{
    base.OnStationaryKilled(_stationary, initiator, eventArgInt);

    _stationary.Destroy();
}
Reply With Quote
  #4  
Old 07-24-2012, 05:38 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Quote:
Originally Posted by FG28_Kodiak View Post
1) they stay destroyed

2) Radars are no GroundActors they are static objects so you must use the new OnStationaryKilled (works since the latest beta patch)
Code:
    /*------------------Remove Static stationary Ground method---------------*/


    Dictionary<AiGroundActorType, int> PointsforGroundTargets = new Dictionary<AiGroundActorType, int>()
    {
        {AiGroundActorType.Radar, 12},
     };


    /*------------------Remove AIGround method---------------*/
    private void destroyGroundActor(AiGroundActorType type, int army)
    {
        if (GamePlay.gpGroundGroups(army) != null)
        {
            foreach (AiGroundGroup gg in GamePlay.gpGroundGroups(army))
            {
                if (gg != null && gg.GetItems().GetLength(0) > 0)
                {
                    foreach (AiActor ggActor in gg.GetItems())
                    {
                        if (ggActor != null)
                            if ((ggActor as AiGroundActor) != null && (ggActor as AiGroundActor).Type() == type)
                                (ggActor as AiGroundActor).Destroy();
                                 
                     }
                }
            }
        }
    }

    /*------------------Remove Static stationary Ground method---------------*/
/*-----Below is to remove stationary objects listed in AiGroundActorType list----------*/

    public override void OnStationaryKilled(GroundStationary _stationary, AiDamageInitiator initiator, int eventArgInt)
    {
        base.OnStationaryKilled(_stationary, initiator, eventArgInt);

            if (GamePlay.gpGroundStationarys() != null)
        {
            foreach (GroundStationary gg in GamePlay.gpGroundStationarys())
            {
                if (gg != null && gg.GetItems().GetLength(0) > 0)
                {
                    foreach (AiActor ggActor in gg.GetItems())
                    {
                        if (ggActor != null)
                            if ((ggActor as OnstationaryKilled) != null && (ggActor as AiGroundActor).Type() == type)
                                (ggActor as _stationary.Destroy).Destroy();
                     }
                }
            }
        }
    }
thanks Kodiak. For the coed. I am having trouble making it work.
The end objective is that if the Radar is bombed and destroyed I want it to "despawn" The AiGroundActorType is "Radar", but in the _stationary there is no list for Radar.

(_stationary = AiGroundActorType.Radar);


Any clue on how I integrate the _Stationary Kill into the get rid of destroyed objects like the Radar?
__________________
__________________
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; 07-26-2012 at 04:35 AM.
Reply With Quote
  #5  
Old 07-26-2012, 05:32 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Kodiak or anyone? got any cluse on the above? Hels to clean up a mission after bombing runs are complete (less static objects on the map).
__________________
__________________
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
  #6  
Old 07-26-2012, 07:24 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

The stationary object don't use an enumerator (AiGroundActorType), they return strings,
you can get
Title = Name of the static;
Category = vehicle, aircraft etc. can be empty. Radars are empty.
Type = Radar etc.
i've not tested all possible values at the moment. Integrate this into the OnStationaryKilled to get the values by yourself.
Code:
GamePlay.gpLogServer(null, "OnStationaryKilled: Title: {0}; Category: {1}; Type: {2}", new object[]{_stationary.Title, _stationary.Category, _stationary.Type});
Example to remove all radars around 1000m from position a stationary was killed
Code:
    public override void OnStationaryKilled(GroundStationary _stationary, AiDamageInitiator initiator, int eventArgInt)
    {
        base.OnStationaryKilled(_stationary, initiator, eventArgInt);


        GamePlay.gpLogServer(null, "OnStationaryKilled: Title: {0}; Category: {1}; Type: {2}", new object[]{_stationary.Title, _stationary.Category, _stationary.Type});

        if (GamePlay.gpGroundStationarys() != null)
        {
            foreach (GroundStationary gg in GamePlay.gpGroundStationarys(_stationary.pos.x, _stationary.pos.y, 1000.0))
            {
                if(_stationary.Type.Equals("Radar"))
                    gg.Destroy();
            }
        }
 
    }

Last edited by FG28_Kodiak; 07-26-2012 at 07:30 AM.
Reply With Quote
  #7  
Old 07-26-2012, 07:32 AM
podvoxx podvoxx is offline
Approved Member
 
Join Date: Feb 2010
Posts: 190
Default

In the next patch will be extended capabilities of the method OnStationaryKilled.
Reply With Quote
  #8  
Old 07-26-2012, 07:40 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok so it's more rough-and-ready at the moment , hope they integrate the missionNumber so it would be easier to remove the objects.
Reply With Quote
  #9  
Old 07-26-2012, 10:30 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Hi Kodiak,

Well thank you for the code. It works to a point. But the destroyed parts of the radar do not remove from the map. So the new radar just appears on top of the old.

May have to wait till patch and hope the destroyed parts remove after time maybe.
__________________
__________________
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
  #10  
Old 07-26-2012, 04:12 PM
podvoxx podvoxx is offline
Approved Member
 
Join Date: Feb 2010
Posts: 190
Default

Quote:
Originally Posted by hc_wolf View Post

Well thank you for the code. It works to a point. But the destroyed parts of the radar do not remove from the map. So the new radar just appears on top of the old.

May have to wait till patch and hope the destroyed parts remove after time maybe.
Please describe your problem in detail whith mission code.
http://www.sukhoi.ru/forum/showthrea...=1#post1871936
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 10:13 PM.


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