PDA

View Full Version : trigger points and spawning


smokincrater
12-03-2011, 09:17 PM
G`day, having trouble getting the FMB to spawn other units from a trigger. For instance I want the computer to spawn a RAF unit when the Luftwaffe pass through a point(trigger) on the map. Also i want to spawn returning escorts on the way home for the returning bombers.

Also has can anyone give me a tip for getting the computer to select the best runway for take off( I.e. the one i want).

FG28_Kodiak
12-03-2011, 10:09 PM
Can you post your mission, so we can take a look at it?

The start direction depends on wind direction. To get your prefered runway you must change the wind direction in the mission preferences (View-Menu).

smokincrater
12-04-2011, 05:19 AM
how can i post the mission to you?

smokincrater
12-04-2011, 05:56 AM
runway issue sloved. Now all i have to work out is how get the tiggers and actions working as i have no idea about scripting!

FG28_Kodiak
12-04-2011, 06:45 AM
Without scripting your trigger and the action must have the same name.
Example, if your trigger has the name 'SpawnAirgroup1' your action must have the name 'SpawnAirgroup1', also.


To post your mission. Zip the files and upload it via 'Manage Attachment' found under Additional Options if you post a message.

smokincrater
12-04-2011, 07:46 AM
Posted zip file!!

Tried renaming triggers and actions but did not work. Thank you also for this.

ATAG_Bliss
12-04-2011, 10:04 AM
Hi smokin,

Just had a quick look at this through the notepad. What are you trying to do with the passthroughs? Are you wanting to spawn certain planes if a particular air/ground group goes through the passthrough area?

FG28_Kodiak
12-04-2011, 10:15 AM
Corrected:
By spawning Airgroups you should activate "only Script spawn" in their options.

You use passthroughs-Triggers, there is a problem the are activated two times on enter and on leave. To avoid the second activation, you should deaktivate the trigger via script.
Sometimes if a Group is not spawning, it helps to select it again in the action-options.


So i've added a little script:

using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

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 = false;
}
}


Tested the Mission, now it should work.

BGs_Ricky
12-04-2011, 10:52 AM
Hi Kodiak,

does the script you just put here avoid a further activation of a passthrough trigger ?
I've been looking for one since I made a small mission weeks ago and couldn't find a way to spawn an air group only once, as another was spawned everytime the condition was met again (in that case red planes flying through it).

Thx !

FG28_Kodiak
12-04-2011, 11:59 AM
Yes.

I deactivate it with
GamePlay.gpGetTrigger(shortName).Enable = false;
so it is not activated a second time.

BGs_Ricky
12-04-2011, 12:22 PM
Great, thank you very much !! :)

smokincrater
12-05-2011, 09:34 AM
Thank you, very much Kodiak. Now i can get on with planning some missions. By the way can you link groups of bombers together to create a guppe? Also is there a glossary or tutorial for scripting?

Atag, the first problem was that i could not get the aircraft actioned when the lead group hit the trigger pont.

FG28_Kodiak
12-05-2011, 10:41 AM
By the way can you link groups of bombers together to create a guppe?

You can use the follow-command (waypoints) but its a bit tricky to get it work accurate.

Lookaloft
12-08-2011, 08:37 AM
Hi Kodiak,

I downloaded your Spawning.zip but can’t see what it brings about. I loaded Bf110.mis and flew the Bf110 to the SpawnArea (near Fruges) but nothing happened. Can you help please?

FG28_Kodiak
12-08-2011, 09:04 AM
Can you show me your mission, please?
May be you use a wrong trigger, but difficult to say without the mission.

Lookaloft
12-08-2011, 06:07 PM
Hi Kodiak,
I downloaded the mission + submissions and send them to you as requested. As a matter of fact they are the same as you attached as Spawning.zip in your answer to Atag Bliss a few days ago but with a slight difference. What I did was starting the Bf110 and flew to Fruges through the SpawnArea but nothing was spawned . What can be achieved with these missions? How can one make them work?

FG28_Kodiak
12-08-2011, 06:22 PM
Ok i see, i use this DeSpawnArea to remove the red ground targets reaching this point.

The ground targets spawn automatically, if not you should check the path to the submissions

you will find it in the cs-file
string SubMissionsPath = @"missions\Single\Tests\Bf110Sub\";

Simply test:
Play the mission, open the console Window, if there are messages like "file not found", then you must adjust the path.

Lookaloft
12-08-2011, 09:50 PM
Great! It works now. Path to the submissions was wrong. Thank you very much Kodiak!