PDA

View Full Version : Trigger...Spawn aircraft on destruction of a truck.


Aussie Pilot
11-20-2012, 11:42 PM
Well i have been reading and reading and reading but I still can't get this to work.This is all for testing purposes but even so.

I have 2 groups of He-111's I want to spawn in over the channel once a truck has been destroyed. Before setting up the script they would spawn in at mission begin and fly up to London and back no worries.

The aim here is for some new pilots to take off, see how the plane works and their sim goes on the internet. Then when everyone is ready, drop down and shoot up a friendly truck I want to set as the trigger to spawn the He-111's to come in later instead of at mission begin so we can all test again in combat. I know i could probably set up a timer or a fly through, but not everything seems to go to plane. Someone may take to long or someone may get lost and fly through the trigger. Using the truck gives you more control over when you want your spawn to work.

I have script c selected in both He-111 groups.

In the script window I have all names as "He-111 spawn". The type is set "Tgroupdestroyed", and the trigger (truck) is selected with a 2m radius and about 37% damage.
That, I would have thought looks about right.

Then in actions, I have the same name, then "Aspawngroup", then one of the two He-111 groups is selected.
Then I add another line the same way for the second He-111 group.

Hit save and it's all good. Well the truck spawns at mission begin, I take off in my Spit and shoot the truck up...great explostion and bit's everywhere, but no sign of the He-111's spawning.

Am I doing this right or have I missed something? Thanks.

salmo
11-21-2012, 03:43 AM
Try two destroy-group triggers (for the same vehicle) attached to 2 spawn-group actions (one for each He111 group). Action name must be identical to the relevent trigger name. Something like this ...


[PARTS]
core.100
bob.100
[MAIN]
MAP Land$English_Channel_1940
BattleArea 174580 194813 108250 74438 10000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
[splines]
[AirGroups]
BoB_LW_KuFlGr_706.01
BoB_LW_KuFlGr_706.02
[BoB_LW_KuFlGr_706.01]
Flight0 1 2
Class Aircraft.He-111H-2
Formation VIC3
CallSign 26
Fuel 100
Weapons 1 1 1 1 1 1 1
SpawnFromScript 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_LW_KuFlGr_706.01_Way]
NORMFLY 258970.100 214280.15 500.00 300.00
NORMFLY 222071.90 230428.05 500.00 300.00
[BoB_LW_KuFlGr_706.02]
Flight1 11 12
Class Aircraft.He-111H-2
Formation VIC3
CallSign 30
Fuel 100
Weapons 1 1 1 1 1 1 1
SpawnFromScript 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_LW_KuFlGr_706.02_Way]
NORMFLY 258600.70 213920.04 500.00 300.00
NORMFLY 222348.65 229874.48 500.00 300.00
[CustomChiefs]
[Chiefs]
0_Chief Vehicle.AEC_Matador gb
[0_Chief_Road]
224676.28 228375.41 38.40 0 4 4.17
S 2167 3 0.50 5.00 P 224686.52 228407.25
S 2167 0 0.24 20.00 P 224760.03 229823.34
224759.23 229827.11 38.40
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
vehicle_destroyed2 TGroupDestroyed 0_Chief 100
vehicle_destroyed1 TGroupDestroyed 0_Chief 100
[Action]
vehicle_destroyed2 ASpawnGroup 1 BoB_LW_KuFlGr_706.01
vehicle_destroyed1 ASpawnGroup 1 BoB_LW_KuFlGr_706.02

Aussie Pilot
11-21-2012, 04:04 AM
Thanks Salmo, also noticed that even though the text shows up in the mission file when i look at it in my documents folder via notepad, when i go back into FMB it is no longer there in the script window box.

Whats with that? is it because I did it wrong despite saving it.

Edit: I have also just found out my naming may be wrong. I had a space between name words, I see you used an underscore, so i'll give that a try as well.

It's the little things aye.

FG28_Kodiak
11-21-2012, 04:40 AM
You can use a script:


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


public class Mission : AMission
{

public override void OnBattleStarted()
{
base.OnBattleStarted();

MissionNumberListener = -1;
}


public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);


GamePlay.gpLogServer(null, "Trigger: {0} activated", new object[]{shortName}); // for testing remove if not longer needed


if (shortName.Equals("PlaneSpawnTrigger")) // insert the triggername between the ""
{
AiAction action = GamePlay.gpGetAction("SpawnAirgroup1"); // insert the actionname between the ""

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

action = GamePlay.gpGetAction("SpawnAirgroup2"); // insert the actionname between the ""

if (action != null)
action.Do();
}
else
{
AiAction action = GamePlay.gpGetAction(shortName);

if (action != null)
action.Do();
}

}


}

Aussie Pilot
11-24-2012, 12:43 AM
Try two destroy-group triggers (for the same vehicle) attached to 2 spawn-group actions (one for each He111 group). Action name must be identical to the relevent trigger name. Something like this ...


[PARTS]
core.100
bob.100
[MAIN]
MAP Land$English_Channel_1940
BattleArea 174580 194813 108250 74438 10000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
[splines]
[AirGroups]
BoB_LW_KuFlGr_706.01
BoB_LW_KuFlGr_706.02
[BoB_LW_KuFlGr_706.01]
Flight0 1 2
Class Aircraft.He-111H-2
Formation VIC3
CallSign 26
Fuel 100
Weapons 1 1 1 1 1 1 1
SpawnFromScript 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_LW_KuFlGr_706.01_Way]
NORMFLY 258970.100 214280.15 500.00 300.00
NORMFLY 222071.90 230428.05 500.00 300.00
[BoB_LW_KuFlGr_706.02]
Flight1 11 12
Class Aircraft.He-111H-2
Formation VIC3
CallSign 30
Fuel 100
Weapons 1 1 1 1 1 1 1
SpawnFromScript 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_LW_KuFlGr_706.02_Way]
NORMFLY 258600.70 213920.04 500.00 300.00
NORMFLY 222348.65 229874.48 500.00 300.00
[CustomChiefs]
[Chiefs]
0_Chief Vehicle.AEC_Matador gb
[0_Chief_Road]
224676.28 228375.41 38.40 0 4 4.17
S 2167 3 0.50 5.00 P 224686.52 228407.25
S 2167 0 0.24 20.00 P 224760.03 229823.34
224759.23 229827.11 38.40
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
vehicle_destroyed2 TGroupDestroyed 0_Chief 100
vehicle_destroyed1 TGroupDestroyed 0_Chief 100
[Action]
vehicle_destroyed2 ASpawnGroup 1 BoB_LW_KuFlGr_706.01
vehicle_destroyed1 ASpawnGroup 1 BoB_LW_KuFlGr_706.02



Hi Salmo.
Well i have tried everything you said. I even went back to scratch and pretty much copied your mission with one less bomber group but I still can't get them to spawn.
I ended up copying your mission you put here pasting it into a mission file, added a spawn area at lypmne and it worked great. I then proceeded to swap back and forth between mine and yours to compare. But even though I can't see it, something is stopping my bombers from spawning on destruction of the truck.

I know i could just use your but then I wouldn't learn anything or find out whats wrong with mine. So i've attached a copy of mine if you don't mind having a look for me when you get a chance, it would be much appreciated.

salmo
11-24-2012, 07:46 AM
I can't see a problem with your triggers, it should work

Aussie Pilot
11-24-2012, 11:11 AM
I can't see a problem with your triggers, it should work

Thanks Salmo, I'll try it again.
Something I did notice today while trying your mission online with some others, when i started the mission we shot the truck and the he 111's didn't spawn. I restarted the mission and it worked. When we tried a third time they didn't spawn again so i restarted again and it worked. So it seems that perhaps it's not loading properly everytime.
Do you know what CLOD requires in regard to interent speed to host a stable session? I know RoF is pretty demanding, I can't host that. My internet is with Telstra, their ultimate 3.0 cable which gives me 117 mbps download and 2.40 mbps upload, which is pretty damn good for Oz. Can't wait for the fibre to be run. I was hosting and flying from the same game though...if that makes a difference.

salmo
11-24-2012, 11:47 AM
Thanks Salmo, I'll try it again.
Something I did notice today while trying your mission online with some others, when i started the mission we shot the truck and the he 111's didn't spawn. I restarted the mission and it worked. When we tried a third time they didn't spawn again so i restarted again and it worked. So it seems that perhaps it's not loading properly everytime.
Do you know what CLOD requires in regard to interent speed to host a stable session? I know RoF is pretty demanding, I can't host that. My internet is with Telstra, their ultimate 3.0 cable which gives me 117 mbps download and 2.40 mbps upload, which is pretty damn good for Oz. Can't wait for the fibre to be run. I was hosting and flying from the same game though...if that makes a difference.

You might have found the issue. Multiplayer code is severely crippled. It is possible that the triggers only work intermittently. It may be better to use some C# script to achieve what you want. This will give you a more consistent result.

superbee15
11-24-2012, 01:24 PM
Salmo/Kodiak

Been working with AP on this. Tonight I built Training Mission to same concept as AP. i.e. Truck (enemy) beside airfield and on it's 50% destruction, I spawn some He111's.

I combined scipt for Triggers covered by Kodiak in this thread with other script to get rid of used planes.

To check working I placed 2 Spits in mission with target to destroy truck. They do and I get successful spawn of He111's.

However, as soon as I remove Spits from mission and take out the truck myself there are no He111's spawned. I tied this twice to confirm.

Script and also mission file (with Spits still in) attached.

We appreaciate any help.

Regards