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-22-2011, 09:49 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default Getting the actor type?

This is probably very obvious, but I just can't seem to crack it. I'm trying to get the actor type when the actor is destroyed ie ship, car, plane etc. here's what I tried

code removed 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:24 AM.
Reply With Quote
  #2  
Old 12-22-2011, 10:07 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

If you want to observer the individual ground actors use this:
Code:
public override void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor)
{
    if (actor is AiGroundActor)
    {
        AiGroundActor groundActor = actor as AiGroundActor;
        if (groundActor.Type() == AiGroundActorType.ShipTransport /* || groundActor.Type() == AiGroundActorType.ShipDestroyer || ... */)
        {
            GamePlay.gpHUDLogCenter("Ship destroyed");
        }
    }
}
If you are interested in the complete ground group (e.g. a column or tank group) use this:
Code:
public override void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor)
{
    if (actor is AiGroundGroup)
    {
        AiGroundGroup groundGroup = actor as AiGroundGroup;
        if (groundGroup.GroupType() == AiGroundGroupType.Ship)
        {
            GamePlay.gpHUDLogCenter("Ship destroyed");
        }
    }
}
Reply With Quote
  #3  
Old 12-22-2011, 10:07 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Thanks Banks
__________________
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
  #4  
Old 12-22-2011, 11:25 AM
Octocat Octocat is offline
Approved Member
 
Join Date: Dec 2011
Posts: 22
Default

Something like this:

Code:
if (actor != null)
{
  if (actor is AiAirGroup)
  {
    var airgrp = (AiAirGroup)actor;
    // processing air group
  }
  else if (actor is AiAircraft)
  {
    var aircft = (AiAircaft)actor;
    // processing aircraft
  }
  else
  {
     LogMessage("Destroyed unknown actor type: {0}", actor.GetType().Name);
  }
}

Real problem for me, is in ActorDead handler, to separate between actor killed / disapeared events. Has someone solution?
Reply With Quote
  #5  
Old 05-27-2012, 10:36 AM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

here comes pupo ressutecting the dead again.

As anyoen foudn a solution for what Octocat was asking?

i need to creat an exception for the actor destroyd, so that planes who are reflown dont count as destroyed.
Reply With Quote
  #6  
Old 05-27-2012, 01:14 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

All disapearing Actors are registered in
OnActorDestroyed(..)

If this was the Question.
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:51 AM.


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