View Full Version : blue won message
melasuda
03-27-2012, 09:53 AM
Hi, there is my cuestion.
I create a scrip to launch message wen a 1 objetive is destroy.
But how can i launch test message if all target all destroyed?.
There is my scrip
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;
if ("calaiscompleto".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("objetivo este de calais completado");
GamePlay.gpGetTrigger(shortName).Enable = false;
GamePlay.gpGetTrigger("dunkerkecompleto").Enable = false;
}
if ("dunkerkecompleto".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("objetivos este de dunkerke completado");
GamePlay.gpGetTrigger(shortName).Enable = false;
GamePlay.gpGetTrigger("calaiscompleto").Enable = false;
}
}
Thx
FG28_Kodiak
03-27-2012, 10:17 AM
There are different approches to this problem, in these i use a counter
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
const int MinSubMissionsforBlueSuccess = 2; //two Objectives successfull to win this Battle
int BlueMissionSuccesses = 0;
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();
if ("calaiscompleto".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("objetivo este de calais completado");
GamePlay.gpGetTrigger(shortName).Enable = false;
GamePlay.gpGetTrigger("dunkerkecompleto").Enable = false;
BlueMissionSuccesses++; // Added
}
if ("dunkerkecompleto".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("objetivos este de dunkerke completado");
GamePlay.gpGetTrigger(shortName).Enable = false;
GamePlay.gpGetTrigger("calaiscompleto").Enable = false;
BlueMissionSuccesses++; // Added
}
if (BlueMissionSuccesses >= MinSubMissionsforBlueSuccess)
{
GamePlay.gpHUDLogCenter("Blue Win!");
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
melasuda
03-27-2012, 11:35 AM
Thank.
I go to test it this afternoon.
melasuda
03-28-2012, 05:03 PM
Hi Kodiak.
Frist thx for the scrip
Second.
I have a problem. When I destroy frist target, message target destroy run well, but wen i destroy second target, no appears message on screen and not show blue won.:rolleyes:
FG28_Kodiak
03-28-2012, 05:15 PM
Hm seems a it's a problem with the trigger, can you show me your mission please?
melasuda
03-28-2012, 06:44 PM
I solved it, and add a new condition to red won message.
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
const int MinSubMissionsforBlueSuccess = 2; //two Objectives successfull to win this Battle
int BlueMissionSuccesses = 0;
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();
if ("centro".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("centro completado");
GamePlay.gpGetTrigger(shortName).Enable = false;
BlueMissionSuccesses++; // Added
}
if ("grupo2".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("grupo2 completo");
GamePlay.gpGetTrigger(shortName).Enable = false;
BlueMissionSuccesses++; // Added
}
if ("tiempo".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("red win");
GamePlay.gpGetTrigger(shortName).Enable = false;
GamePlay.gpGetTrigger("centro , grupo2").Enable = false;
}
if (BlueMissionSuccesses >= MinSubMissionsforBlueSuccess)
{
GamePlay.gpHUDLogCenter("Blue Win");
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
And this is the mission to test
[PARTS]
core.100
bob.100
[MAIN]
MAP Land$Online_Map
BattleArea 0 0 40960 40960 10000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
[GlobalWind_0]
Power 3.000 0.000 0.000
BottomBound 0.00
TopBound 1500.00
GustPower 5
GustAngle 45
[splines]
[AirGroups]
BoB_RAF_F_FatCat_Early.01
[BoB_RAF_F_FatCat_Early.01]
Flight0 1
Class Aircraft.SpitfireMkIIa
Formation VIC3
CallSign 26
Fuel 100
Weapons 1
Scramble 1
SpawnFromScript 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_RAF_F_FatCat_Early.01_Way]
NORMFLY 19904.00 23573.33 500.00 300.00
NORMFLY 24320.00 29823.10 500.00 250.00
LANDING 25664.00 30143.10 500.00 250.00
[CustomChiefs]
[Stationary]
Static5 Stationary.Austin_K2_Ambulance gb 19573.80 20469.03 0.00
Static4 Stationary.Austin_K2_Ambulance gb 19631.32 20529.08 0.00
Static3 Stationary.Austin_K2_Ambulance gb 19691.38 20571.60 0.00
Static2 Stationary.Austin_K2_Ambulance gb 20438.89 20873.56 0.00
Static1 Stationary.Austin_K2_Ambulance gb 20433.95 20898.26 0.00
Static0 Stationary.Austin_K2_Ambulance gb 20433.95 20922.96 0.00
[Buildings]
[BuildingsLinks]
[Trigger]
paso TPassThrough 5 2 24309 24881 1250
grupo2 TGroundDestroyed 33 19641 20530 300
tiempo TTime 300
centro TGroundDestroyed 32 20431 20894 100
[Action]
paso ASpawnGroup 1 BoB_RAF_F_FatCat_Early.01
[BirthPlace]
BirthPlace_0 1 24000 24597 0 16 1 1 . . .
BirthPlace_1 2 23023 21822 1000 5 1 1 . . .
[BirthPlace1]
Aircraft.Bf-110C-7
Aircraft.Bf-109E-1
Aircraft.Ju-87B-2
Aircraft.Bf-109E-4
hc_wolf
03-28-2012, 10:34 PM
Yes I over come this problem a while back. But I was not getting the second "obective complete" because I was spawning my groups off a ttime and the trigger for the groups was already triggered. You have to hard code the spawn not have it in the Mis file. Well this works for me anyway.
if ("BG2_1".Equals(shortName) && active) //name of the Ttime spawn [trigger]
{
AiAction action = GamePlay.gpGetAction("BGSpawn2_1"); //name of the [action] spawn
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
//Added section to generate new trigger
ISectionFile f = GamePlay.gpCreateSectionFile();
string sect = "Trigger"; //dont touch
string key = "Trigger name here"; //put tgroupDestroy [Trigger] name here
string value = " TGroupDestroyed BoB_LW_KuFlGr_606.02 50"; //just add the flight or chief name here
f.add(sect, key, value);
GamePlay.gpPostMissionLoad(f);
}
melasuda
03-29-2012, 12:07 AM
uf, If i use this scrip... i get same actión?
because,my English regular and I no hunderstand you good.
vBulletin® v3.8.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.