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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-09-2012, 12:10 PM
frantic69 frantic69 is offline
Approved Member
 
Join Date: Mar 2010
Posts: 17
Default GamePlay.gpGetAction Question

Hello All,

First of all, thank you for this great forum and all the information we can find. As it is my first post, I take the occasion to say hello to all the COD fan.

My question is regarding this script :

AiAction action = GamePlay.gpGetAction("XXXXXXX");
if (action != null)
{
action.Do();
}

My goal is to constantly test the flight level of an aircraft (I have the flight level thanks to a OnTickGame function and it works fine).

As I don't know the name of the aircraft (the XXXX in the script above), I use the following script :

AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));

It works fine for a OnTrigger() function but it doesn't for a OnTickGame function because missionNumber and shortName do not exist in the OnTickGame context.

So, either I use the exact name XXXXX used by COD mission but I can't find it in the mission file (I tried many name indicated in this file but nothing seems to work) or I use the script above with missionNumber and shortName but it doesn't work in the OnTickGame function.

Have you any Idea of How I can manage this ?

I must say the I search a long time on internet and I tried many thing but nothing works. I am not a specialist of C# and script and I problably make a mistake but I can't see where.

So the full script is something like this :

using System;
using maddox.game;
using maddox.game.world;

public class Mission : maddox.game.AMission
{
double I_Altitude;

public override void OnTickGame()
{

base.OnTickGame();

if (Time.tickCounter() % 30 == 1)
{

AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft;

if (curPlane != null)
{

I_Altitude = curPlane.getParameter(part.ParameterTypes.I_Altitu de, -1);

double dtime = Time.current();

GamePlay.gpHUDLogCenter(" ALT: " + I_Altitude.ToString("0.00"));

if (I_Altitude > 400)
{
GamePlay.gpHUDLogCenter("above 400");
AiAction action = GamePlay.gpGetAction(maddox.game.ActorName.Full(mi ssionNumber, shortName));
if (action != null)
{
action.Do();
}
}

}


}

}

}


Last point, I would like to thank all the people that post script on internet. As mentioned, I am not a great script maker and I try to understand and reuse existing code. The code above is a made of different script that I found on internet. Thanks to all the guy that made them.

Frantic
Reply With Quote
 


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:28 PM.


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