![]() |
|
|
|
#1
|
|||
|
|||
|
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");
}
}
}
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");
}
}
}
|
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
All disapearing Actors are registered in
OnActorDestroyed(..) If this was the Question. |
|
#6
|
|||
|
|||
|
No kodiak.
in my code i give points to teams on a plane his destroyed. yet the game also uses destroy to get rid of planes. so if i refly, the plane i refly gets caught by onactordestryed, and a kill is given to the enemy. is there a way to avoid this? |
|
#7
|
|||
|
|||
|
You can use two events:
Code:
public override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftKilled(missionNumber, shortName, aircraft);
}
Code:
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
}
OnActorDead is called later after a plane is hitting the ground or a GroundActor or AiPerson or AiGroup (a Ships is an AiGroup) is killed. And you can check the damagers. OnActorDestroyed is called every time a Actor is removed from the game, so its also called if a script removed a empty plane. So you should use OnAircraftKilled or OnActorDead. Last edited by FG28_Kodiak; 05-27-2012 at 02:44 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|