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 08-09-2012, 02:29 PM
frantic69 frantic69 is offline
Approved Member
 
Join Date: Mar 2010
Posts: 17
Default

Hello Hc_wolf,

Thank for your help. In fact, in the GamePlay.gpGetAction() we must put the shortname of the unit. As far as I understand, the name can be entered directly thanks to the quote. Here is an example of what can be found on some script on internet :

action = GamePlay.gpGetAction("a9");
AiAction action = GamePlay.gpGetAction("0_Chief");

I read that we can find the shortname in the mission file. I found some information and tried them but nothing seems to work.

It is for that reason that I tried the AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName)); method but it doesn't work in the ontickgame function.

Frantic
Reply With Quote
  #2  
Old 08-09-2012, 03:32 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Not of the unit, of an Action definded in your mission. The only available action at the moment is the spawn of an AiGroup (AiAirGroup or AiGroundGroup). You define them at the second tab (by Scripts) in the FMB.


In this case the name of the action is MyAction. So you can get access to it via GamePlay.gpGetAction("MyAction");

In the mis file you will find it in the Action Section
[Action]
MyAction ASpawnGroup 1 BoB_LW_LG2_I.01

Last edited by FG28_Kodiak; 08-09-2012 at 03:41 PM.
Reply With Quote
  #3  
Old 08-09-2012, 04:06 PM
frantic69 frantic69 is offline
Approved Member
 
Join Date: Mar 2010
Posts: 17
Default

hello Kodiak,

Thank you. I saw that there is only few possibilities in the standard action. My goal was to spawn some aircraft when the player altitude goes over 400 ft.

I am able to have the altitude of the player. The variable is I_Altitude. I can easily show this altitude on the screen thanks to the GamePlay.gpHUDLogCenter(" ALT: " + I_Altitude.ToString("0.00")); line.

All this altitude stuff are done in the ontickgame function.

So, tell me if I am wrong but I tried to spawn the enemy aircraft thanks to following script :

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

Could you confirm that we can spawn an aircraft thank to the line above ?

If yes, how can I manage to use it in the ontickgame function ?

Basically, I don't want to spawn an aircraft after a given time or when someone enter a specific area. I just want to spawn an aircraft when the player altitude is over 400 ft.

Sorry for my dumb question.
Reply With Quote
  #4  
Old 08-09-2012, 04:43 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

There are different ways to spawn a new aircraft. Via action is the simplest .

To do so, create a new mission, place the Airgroup on the map, enable only script spawn in the Object Options (if you don't do that your Airgroup spawns at beginning of the mission and than again if you call it via action.Do()). Create an action for it in the script -> action tab, give a simple name for example SpawnEnemyPlane, select the airgroup to spawn. Then save and save the mission.


Add a flag to the cs file, to avoid multiple spawning of the airgroup
Code:
    bool Spawned = false;

Then in your OnTickGame
Code:
if (I_Altitude > 400 && !Spawned)
{
    Spawned = true;
    GamePlay.gpHUDLogCenter("above 400");
    AiAction action = GamePlay.gpGetAction("SpawnEnemyPlane"));
    if (action != null)
    {
        action.Do();
    }
}
Reply With Quote
  #5  
Old 08-09-2012, 06:20 PM
frantic69 frantic69 is offline
Approved Member
 
Join Date: Mar 2010
Posts: 17
Default

Thank you so much Kodiak. That works fine. Before posting I wanted to search and find by myself. I think this is the only way to progress but I was not good enough.
I think it should looks so easy for you but thank you again because was very helpful.

thanks to your script I understood manything and I understand now my mistakes.

The most important was this part : gpGetAction("SpawnEnemyPlane")
I was wrong when I was thinking that the name to put inside the cotes have to be the name found in the mission file. It was simply the name of the trigger you created in the script action box.

Thank you, you are a code king.

I will probably have some another new questions in the futur and I am happy to think that there is, here on this forum, some very skilled guys like you.

Thanks,

Frantic
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 09:19 AM.


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