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 05-27-2012, 03:37 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You can use two events:

Code:
 public override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftKilled(missionNumber, shortName, aircraft);
    }
and
Code:
    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);
    }
On OnAircraftKilled is called when a plane is not longer flyable, for example if the pilot get killed or its too heavy damaged, but you get not the damager.

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 03:44 PM.
Reply With Quote
  #2  
Old 05-27-2012, 04:57 PM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

Quote:
Originally Posted by FG28_Kodiak View Post
You can use two events:

Code:
 public override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftKilled(missionNumber, shortName, aircraft);
    }
and
Code:
    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);
    }
On OnAircraftKilled is called when a plane is not longer flyable, for example if the pilot get killed or its too heavy damaged, but you get not the damager.

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.
thanks! that puts some light on waht each one does. i started by using onactordead, but its giving some issues with exception errors, so im tryign on aircraft killed, still not workin.... yet.

Also, since you are here ( ), im havign were a damaged plane, when landed is not destroyed.

code here

Quote:
public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftLanded(missionNumber, shortName, aircraft);

Player player = null;



int value = 0;


if (aircraft.Player(0) != null)
{
for (int i = 0; i < aircraft.Places(); i++)
{
if (aircraft.Player(i) != null)
{
// TODO: Account for more than one player in an aircraft
player = aircraft.Player(i);
break;
}
}

if (player != null)


switch (player.Army())
{
case 1:
if (rafa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
rafa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
bluescore = bluescore - rafv[(aircraft as AiAircraft).InternalTypeName()];
GamePlay.gpHUDLogCenter(new Player[] { player }, "Welcome Home, {0} : saved!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) }); // THIS MESSAGE IS STILL DISPLAYED!
Timeout(5, () =>
{ destroyPlane(aircraft); });

}

break;

case 2:
if (lwa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
lwa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
redscore = redscore - lwv[(aircraft as AiAircraft).InternalTypeName()];
GamePlay.gpHUDLogCenter(new Player[] { player }, "Welcome Home, {0} : saved!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) }); // THIS MESSAGE IS STILL DISPLAYED!
Timeout(5, () =>
{ destroyPlane(aircraft); });

}
break;

}
}
}
Reply With Quote
  #3  
Old 05-27-2012, 05:44 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You would like to destoy a plane only if a player is present in that plane?
Reply With Quote
  #4  
Old 05-27-2012, 06:31 PM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

YES!

it works nicely, only if plane is intact.

you cant create a new airplane utni lthe previus one is destoyed or back to base and disappeared.
Reply With Quote
  #5  
Old 05-27-2012, 06:38 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Can i have the complete code, please?
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:50 AM.


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