View Single Post
  #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