1C Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official 1C Company forum > 1C Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2012, 07:39 PM
melasuda melasuda is offline
Member
 
Join Date: Feb 2012
Posts: 43
Default scrips problem.

Hi all,

I use il2 clod comander for E69 squadron server.

But i have a problem.

When launch misión de AI actor create by a triggers, no start.

I do not program in c but i think the problem is

Quote:
/ Base Scripts for Missions
private bool isAiControlledPlane (AiAircraft aircraft)
{
if (aircraft == null)
{
return false;
}

Player [] players = GamePlay.gpRemotePlayers ();
foreach (Player p in players)
{
if (p != null && (p.Place () is AiAircraft) && (p.Place () as AiAircraft) == aircraft)
{
return false;
}
}

return true;
}

private void destroyPlane (AiAircraft aircraft) {
if (aircraft != null) {
aircraft.Destroy ();
}
}

private void explodeFuelTank (AiAircraft aircraft)
{
if (aircraft != null)
{
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
}
}

private void destroyAiControlledPlane (AiAircraft aircraft) {
if (isAiControlledPlane (aircraft)) {
destroyPlane (aircraft);
}
}

private void damageAiControlledPlane (AiActor actor) {
if (actor == null || !(actor is AiAircraft)) {
return;
}

AiAircraft aircraft = (actor as AiAircraft);

if (!isAiControlledPlane (aircraft)) {
return;
}

if (aircraft == null) {
return;
}

aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);

int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
aircraft.hitNamed((part.NamedDamageTypes)Enum.Pars e(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}

/***Timeout (240, () =>
{explodeFuelTank (aircraft);}
);
* ***/

Timeout (300, () =>
{destroyPlane (aircraft);}
);
}

public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
MissionNumberListener = -1; //Listen to events of every mission
}
how to add an exception for these aircraft appear?

Thx

Sorry for my english
Reply With Quote
  #2  
Old 03-14-2012, 10:54 PM
Smokeynz Smokeynz is offline
Senior Member
 
Join Date: Apr 2011
Posts: 106
Default

I would read sticky thread tutorials on scripts and triggers, and maybe this thread about triggers might help guide you.


http://forum.1cpublishing.eu/showthread.php?t=26515
__________________
<^..^>
Reply With Quote
  #3  
Old 03-15-2012, 02:02 PM
melasuda melasuda is offline
Member
 
Join Date: Feb 2012
Posts: 43
Default

Quote:
Originally Posted by Smokeynz View Post
I would read sticky thread tutorials on scripts and triggers, and maybe this thread about triggers might help guide you.


http://forum.1cpublishing.eu/showthread.php?t=26515
Thx now is solved the problem, i add this

Quote:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{


base.OnTrigger(missionNumber, shortName, active);

AiAction Action = GamePlay.gpGetAction(shortName);

if (Action != null)
Action.Do();

GamePlay.gpGetTrigger(shortName).Enable = true;
}

And now work
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:51 PM.

Based on a design by: Miner Skinz.com

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.