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 03-21-2012, 08:25 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default Can you group multiple [Action] to spawn from one time [Trigger]?

I want to use one time trigger to spawn multiple groups in an [ACTION] spawn

Is there a way you can spawn multiple actions when the time trigger G17 is active?



[Trigger]
G17 TTime 60


[Action]
action17 ASpawnGroup 1 BoB_LW_KuFlGr_706.01
action18 ASpawnGroup 1 BoB_LW_KuFlGr_706.04
action19 ASpawnGroup 1 BoB_LW_KuFlGr_706.02



Code:
base.OnTrigger(missionNumber, shortName, active);

		if ("G17".Equals(shortName) && active)
        {
            AiAction action = GamePlay.gpGetAction("action17");
            if (action != null)
            {
                action.Do();
            }
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
Reply With Quote
  #2  
Old 03-21-2012, 08:37 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

yes create a list (or array) which contains the actionnames.

Example:
Code:
        List<string> ActionToDoList = new List<string>{"action17", "action18", "action19"};

if ("G17".Equals(shortName) && active)
{
        ActionToDoList.ForEach(item =>
            {
                AiAction action = GamePlay.gpGetAction(item);
                if (action != null)
                {
                    action.Do();
                }
            });
}
You can also use:
Code:
if ("G17".Equals(shortName) && active)
{
                AiAction action = GamePlay.gpGetAction("action17");
                if (action != null)
                {
                    action.Do();
                }
                action = GamePlay.gpGetAction("action18");
                if (action != null)
                {
                    action.Do();
                }
                action = GamePlay.gpGetAction("action19");
                if (action != null)
                {
                    action.Do();
                }
}
But lists or arrays are easier to handle.

Last edited by FG28_Kodiak; 03-21-2012 at 08:43 AM.
Reply With Quote
  #3  
Old 03-21-2012, 08:38 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

FG28_Kodiak I tried this with a number of other changes but I keep getting the following server error.

The name 'action' does not exist in the current context.
I have looked at other coding and can not see the problem.


Code:
	

base.OnTrigger(missionNumber, shortName, active);	
	   
	   List<string> ActionToDoList = new List<string>{"action17", "action18", "action19", "action20", "action21", "action22"};    
		        
		if ("G17".Equals(shortName) && active)
        {
  		ActionToDoList.ForEach(item =>
		{	
				if (action != null)
				{
                action.Do();
				}
 
			});
		}

and if I use this code I get another error saying Invalid expression term 'if'
Code:
	   List<string> ActionToDoList = new List<string>{"action17", "action18", "action19", "action20", "action21", "action22"};    
		        
		if ("G17".Equals(shortName) && active)
        {
			ActionToDoList.ForEach(item =>
			
			if (action != null)
				{
                action.Do();
				}

			});
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals

Last edited by hc_wolf; 03-21-2012 at 08:20 PM.
Reply With Quote
  #4  
Old 03-22-2012, 04:21 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Hm look at my example.

ActionToDoList.ForEach(item =>
{
AiAction action = GamePlay.gpGetAction(item); //<== you forget this line
if (action != null)
{
action.Do();
}
});

Second problem:

if ("G17".Equals(shortName) && active)
{
ActionToDoList.ForEach(item =>
{ //<== you forget this bracket
if (action != null)
{
action.Do();
}

});
Reply With Quote
  #5  
Old 03-22-2012, 05:46 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Yes that got it. Gees mate. I am gonna have to put your name in lights in this next mission to be released hahaha

Thanks so much
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
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 12:32 AM.


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