View Full Version : Are Destroyed triggers working ?
wildwillie
01-27-2012, 08:06 PM
I'm testing out triggers and was wondering if the TGroupDestroyed or TGroundDestroyed are working.
The triggers are defined in the .mis file as:
[Trigger]
D3_red_dest TGroundDestroyed 85 272438 200346 1250
Red_Fuel_Depot TGroundDestroyed 75 267827 197993 550
Blue_Fuel_Depot TGroundDestroyed 75 272015 208932 350
D3_blu_dest TGroundDestroyed 85 271991 205306 1100
De_Fuel_Column1 TGroupDestroyed 20_Chief 80
De_Bofors_Column TGroupDestroyed 22_Chief 80
GB_AAA_Column2 TGroupDestroyed 25_Chief 80
GB_AAA_Column1 TGroupDestroyed 26_Chief 80
In my script file I added the following:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
System.Console.WriteLine("Trigger (" + shortName + ") Mission #(" + missionNumber.ToString() + ") active(" + active.ToString() + ")");
}
Expecting that when the a trigger was executed it would write a line out in the console. So far it is not doing it, any Ideas ?
WildWillie
FG28_Kodiak
01-27-2012, 08:50 PM
Yes they working without problem for me, not tested with your example.
For testing i use this code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
GamePlay.gpLogServer(null, "missionNumber: {0}, shortName: {1}, active: {2}", new object[] { missionNumber, shortName, active });
}
hc_wolf
02-29-2012, 10:34 AM
Yes they working without problem for me, not tested with your example.
For testing i use this code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
GamePlay.gpLogServer(null, "missionNumber: {0}, shortName: {1}, active: {2}", new object[] { missionNumber, shortName, active });
}
I just posted on this myself and I do not think the TGroupDestroyed is working for vehicles, trains and moving ground units,
TGroupDestroyed is only working for air groups
TGroundDestroyed is workiing for static units. So you can destroy static objects
but the TGroupDestroyed does not seem to be triggering for gound units like 0_Chief only air groups. or prove me wrong????
see script here
http://forum.1cpublishing.eu/showthread.php?t=30069
FG28_Kodiak
02-29-2012, 03:10 PM
No it works for Groundgroups also.
Ok it not work for trains :/
but you can use OnActorDead as a Workaround:
example:
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (actor is AiGroundActor)
GamePlay.gpLogServer(null, "missionNumber: {0}, shortName: {1}, Type: {2}", new object[] { missionNumber, shortName, (actor as AiGroundActor).InternalTypeName() });
if (actor is AiGroundGroup)
GamePlay.gpLogServer(null, "Groundgroup: {0} destroyed", new object[] { actor.Name() });
}
you get for example:
Server: missionNumber: 0, shortName: 0_Chief3, Type: bob:Wagon.14T_Tank
Server: missionNumber: 0, shortName: 0_Chief4, Type: bob:Wagon.10T_Cattle
Server: missionNumber: 0, shortName: 0_Chief5, Type: bob:Wagon.10T_Cattle
Server: missionNumber: 0, shortName: 0_Chief1, Type: bob:Wagon.C_Class_0-6-0_tender
Server: missionNumber: 0, shortName: 0_Chief2, Type: bob:Wagon.14T_Tank
Server: missionNumber: 0, shortName: 0_Chief0, Type: bob:Wagon.C_Class_0-6-0
Server: missionNumber: 0, shortName: 0_Chief11, Type: bob:Wagon.12T_CoveredGoods_SR
Server: missionNumber: 0, shortName: 0_Chief10, Type: bob:Wagon.10T_Cattle
Server: missionNumber: 0, shortName: 0_Chief7, Type: bob:Wagon.12T_CoveredGoods_SR
Server: missionNumber: 0, shortName: 0_Chief6, Type: bob:Wagon.13T_5Plank_OpenGoods
So you can count how many Wagon are destroyed and if enough you can show a Message etc.
btw i found this in my log.txt
447] ERROR [VEHICLE] 0_Chief1 : Die by collision with crater
[447] ERROR [VEHICLE] 0_Chief2 : Die by collision with crater
[447] ERROR [VEHICLE] 0_Chief3 : Die by collision with crater
[447] ERROR [VEHICLE] 0_Chief4 : Die by collision with crater
[447] ERROR [VEHICLE] 0_Chief5 : Die by collision with crater
[449] ERROR [VEHICLE] 0_Chief0 : Die by collision with crater
[449] ERROR [VEHICLE] 0_Chief1 : Die by collision with crater
[449] ERROR [VEHICLE] 0_Chief2 : Die by collision with crater
[449] ERROR [VEHICLE] 0_Chief3 : Die by collision with crater
[449] ERROR [VEHICLE] 0_Chief4 : Die by collision with crater
[629] ERROR [VEHICLE] 0_Chief5 : Die by collision with crater
[629] ERROR [VEHICLE] 0_Chief1 : Die by collision with crater
[629] ERROR [VEHICLE] 0_Chief2 : Die by collision with crater
[631] ERROR [VEHICLE] 0_Chief0 : Die by collision with crater
May be this blocked the activation of the trigger?
hc_wolf
02-29-2012, 07:07 PM
Thanks FG28_Kodiak,
I thought about OnActorDead as possible work around.
Yes when I destroy the train I get the ERROR [VEHICLE]..... also and I think that is the reason the trigger is not working.
Have you tried swapping the train for a moving Vehicle or Column? You will notice the trigger still does not work. But unlike the train you will not get the ERROR message.
I think it is an issue with moving vehicles/trains.
Thanks for the above code. I will give it a shot. I think this is a bug for Dev team to fix.
FG28_Kodiak
02-29-2012, 09:28 PM
Have tried some ingame columns and custom columns also. Ive got always a trigger (TGroupDestroyed 50%)
used this mission
[PARTS]
core.100
bob.100
[MAIN]
MAP Land$Online_Cobra_(8x8)
BattleArea 0 0 81920 81920 10000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
player BoB_LW_LG2_I.000
[GlobalWind_0]
Power 3.000 0.000 0.000
BottomBound 0.00
TopBound 1500.00
GustPower 5
GustAngle 45
[splines]
[AirGroups]
BoB_LW_LG2_I.01
[BoB_LW_LG2_I.01]
Flight0 1
Class Aircraft.Bf-109E-4
Formation FINGERFOUR
CallSign 26
Fuel 100
Weapons 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_LW_LG2_I.01_Way]
NORMFLY 34708.43 19739.43 500.00 300.00
NORMFLY 35478.40 21053.40 500.00 300.00
[CustomChiefs]
Vehicle.custom_chief68 $core/icons/tank.mma
[Vehicle.custom_chief68]
Car.Guy_Lizard
Car.Ford_V8_E917_open
Car.Ford_V8_E917_open
Car.Ford_V8_E917_open
Car.Morris_CS8_tent
Car.Morris_CS8_tent
[Chiefs]
0_Chief Vehicle.custom_chief68 gb
[0_Chief_Road]
34625.00 21095.09 38.40 0 9 6.11
S 15 1 0.71 10.00 P 34678.90 21114.63
S 15 4 0.10 20.00 P 39425.20 20032.66
39584.00 20128.00 38.40
S 71 0 1.00 20.00 P 39641.00 20213.00
S 71 0 0.62 20.00 P 39937.95 20543.26
S 72 0 0.43 20.00 P 40035.79 20599.33
S 72 0 0.45 40.00 P 40064.12 20630.78
40123.36 20642.46 38.40
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
trigger TGroupDestroyed 0_Chief 50
and this to show the trigger
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);
GamePlay.gpLogServer(null, "missionNumber: {0}, shortName: {1}, active: {2}", new object[] { missionNumber, shortName, active });
}
}
vBulletin® v3.8.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.